Railsbank PHP SDK

v1.4 2019-08-20 21:17 UTC

This package is auto-updated.

Last update: 2021-10-19 00:48:18 UTC


This is the Railsbank integration using PHP.

This repository is actively used in projects, and we will be maintaining it regularly.

Build Status Total Downloads Latest Stable Version Latest Unstable Version Coverage Status License


[Click here to donate with Crypto


This is the Railsbank PHP SDK Kit that allows you to provide a full facility to create customer accounts, ledgers, and a mastercard for your business/service.

We use commands and queries to de-couple requests, and to allow the ability to use a messaging queue system (AWS SQS, RabbitMQ etc...).

  1. Simply set your application to store the service as a factory;
$railsbank = new Railsbank('demo.config.php', 'live_account');
  1. Create commands and queries as and when you need to (example below returns back a response to give you the API Version);

Example query: $response = $railsbank->handle(new GetVersion());

Example Command:

$command = new CreatePerson(
        'name' => 'Mr Sponge Bob',
        'date_of_birth' => '1983-02-02',
        'telephone' => '07000000001',
        'nationality' => 'British',
        'country_of_residence' => 'GB',
        'date_onboarded' => (new \DateTime('now'))->format('d-m-Y'),
        'address' => [ 'address_refinement' => 'Spongebob House, Indian Ocean, Ocean12' ],

$person = $railsbank->handle($command);

You will not need to validate data using this service. Validation happens at the command level. Any validation errors will return as a DomainException with a json error message.

The valid response will be an immutable object, with the option to see the the full response.

Important note; we are only supporting GBP. Our aim is to release this in v1.2.

Commands and Queries

Action Command or Query
GET Query\Version\GetVersion
GET Query\Me\Information
GET Query\Customer\GetLedger
GET Query\Customer\GetLedgers
GET Query\Customer\GetEndusers
GET Query\Customer\GetEnduser
GET Query\Transaction\GetTransaction
GET Query\Transaction\GetTransactions
GET Query\Card\GetCard
GET Query\Card\GetCards
GET Query\Card\GetCardsByLedgerId
GET Query\Card\GetCardImageUrl
GET Query\Card\GetPin
GET Query\Beneficiary\GetBeneficiaries
POST Command\Customer\EndUsers\CreatePerson
POST Command\Customer\Ledger\CreateLedger
POST Command\Customer\Ledger\CloseLedger
POST Command\Beneficiary\CreateBeneficiary
POST Command\Transaction\CreateTransaction
POST Command\Card\CreateCard
POST Command\Card\ActivateCard

Submitting bugs and feature requests

Bugs and feature requests are tracked on GitHub.

We are actively updating the SDK Kit.


You are free to reuse and adapt this content with credit, for non-commercial purposes. Please review License for further information.