Direct Credit Payout Workflow
Overview
This integration guide will run you through how to use Assembly to do payouts to your users via direct credit (ACH / DE / BECS). To pay your users you only need their BSB and Account Number
Getting Started
Before you can run your direct credit workflow there are a few setup steps that need to be completed so that all of the pieces are available.
Prerequisites
You will need to capture specific details from your users for you to be able to send direct credits.
The setup discussed in this guide makes use of a float to fund your payout. The float will require sufficient funds and periodic top-ups (see inbound payments below). Your funding bank account must allow PayID payments, as the float is paid in by a customer reference number and PayID email address.
Terminology used
The following terminology is used throughout this guide:
- Platform refers to your platform (you, your website, app, marketplace etc.).
- User refers to your customer who will have a User record in Assembly.
- Item is the mechanism for moving funds between users in the API.
- Payin is money being paid into the Assembly ecosystem.
- Payout is money being paid out of the Assembly ecosystem to a bank account.
- ASM is shorthand for Assembly
- Float User is a User you create who holds the balance of funds you wish to payout to
your users. - Callback is Assembly speak for a Webhook.
API steps
Setup steps
We recommend that you create callbacks (webhooks) on the following objects to receive notifications from us of state and status changes.
- Transactions
- Items
- Users
- Batch Transactions
- Accounts
To create a callback, you would call POST /callbacks
, more information on callbacks can be found here.
Inbound payments (topping up your float - PreLive only)
The following steps allow you to add funds to a user’s digital wallet in our prelive environment. In the real world, you would sent us a payment and we would match it to the wallet. For the purposes of testing, you can add funds to wallets as needed.
- Create a user for your Float User.
POST /users
- Get the digital wallet account ID for your Float User.
GET /users/:id/wallet_accounts
- Get the NPP reference details for the user (this is just so you can add money to the account in PreLive).
GET /wallet_accounts/:id/npp_details
- (Pre-live Only) Fund a user’s digital wallet with NPP.
PATCH /testing/wallet_accounts/process_npp_payin
{
"crn": "Customer reference number - reference from wallet",
"payid": "PayID - pay_id from wallet",
"amount": 10000 // Amount in cents
}
- Get the digital wallet account ID and balance for your Float User.
GET /users/:id/wallet_accounts
Outbound payments (paying your users)
These steps are how you will send funds to your users using the API from funds that are in your Float user’s digital wallet.
- Create a user for your customer (who you want to pay) if they don’t exist already.
POST /users
- Update the user for your customer if they already exist (if needed).
PATCH /users/:id
- Add a bank account for your customer (you’ll need the bank account ID in step 8).
POST /bank_accounts
- Set the bank account as the disbursement (or payout) account.
PATCH /users/:id/disbursement_account
- Create an Item (use Type=2) to move money from your Float User to your customer.
POST /items
- Fund the Item with your Float User’s digital wallet (use the ID you got in Step 5 on the Inbound payment steps)
PATCH /items/:id/make_payment
- Check the Callback payload to see how your user’s wallet was funded.
GET /callbacks/id:/responses
- Create a withdraw request on the wallet to pay to your user’s nominated bank account (use the bank account ID from step 3)
POST /wallet_accounts/:id/withdraw
{
"account_id": abc 123456789,
"custom_descriptor": "Custom Descriptor",
"amount": 10000 // Amount in cents
}
-
As part of step 8 you will receive a disbursements object. Please hold on to the
id
field as you will need to pass it on to us to progress payment -
Check the wallet balance of your user to confirm funds have been sent.
GET /wallet_accounts/:id
-
(Pre-Live only) You can call the following API which moves all pending
batch_transactions
intobatched
state. As a result this API will return all thebatch_transactions
that have moved frompending
toexported
. This will simulate the step of the flow where we batch payments and will result in you receiving abatch_transactions
webhook
GET /batch_transactions/export_transactions
{
"transactions": [
{
"id": "439970a2-e0a1-418e-aecf-6b519c115c55",
"batch_id": null,
"status": "batched",
"type": "payment",
"type_method": "direct_credit"
}
]
}
- (Pre-Live only) You can call the following API which moves one or more
batch_transactions
intobank_processing
state12700
. This will simulate the step of the flow where we send payments to our bank and will result in you receiving abatch_transactions
webhook
PATCH /batches/:id/transaction_states
{
"exported_ids" : ["439970a2-e0a1-418e-aecf-6b519c115c55"],
"state": 12700
}
{
"aggregated_jobs_uuid": "c1cbc502-9754-42fd-9731-2330ddd7a41f",
"msg": "1 jobs have been sent to the queue.",
"errors": []
}
- (Pre-Live only) You can call the same API from the step above to move one or more
batch_transactions
to the final states of processing being eithersuccessful
state12000
orinvalid_account_details
state12360
. This will simulate the step of the flow where we complete the processing of the payment and will result in you receiving abatch_transactions
webhook
PATCH /batches/:id/transaction_states
{
"exported_ids" : ["439970a2-e0a1-418e-aecf-6b519c115c55"],
"state": 12000
}
{
"aggregated_jobs_uuid": "c1cbc502-9754-42fd-9731-2330ddd7a41f",
"msg": "1 jobs have been sent to the queue.",
"errors": []
}
Alternatively to waiting for webhooks you can check the Callback payload to see that the payout was completed.
GET /callbacks/id:/responses
Design considerations
User data design
When designing how this workflow will interface with your platform, we suggest storing a map of specific object IDs on your side in order to reduce the number of API calls required throughout the API workflow.
your_customer_id | asm_user_id | asm_bank_account_id | asm_digital_wallet_id | Asm_user_npp_crn (for payins) |
---|---|---|---|---|
10001001 | 5b8f59b6-32c1-44a3-8f5b-b9e2c77bc265 | fb35b028-76fb-44df-86ac-822dccf1cd7d | dcdfdb78-27e7-485d-90c0-11ffbf950d72 | 1000023456 |
10001002 | efe6f8c1-0a30-484a-b085-9d9d0539dbfc | 4355de7b-18c2-4892-b800-b7bbb6f0a9b3 | 054cd04e-19f1-4938-908b-8e9e5c212f4d | 1000098653 |
Custom descriptors
For direct credit payouts you have the option of customising the payment description seen by your customers.
It's an extra parameter on the withdraw call named custom_descriptor. You can have a string of up to 13 alphanumeric characters. It will then be prefixed by the word a 4 digit batch ID (example: "1234: Reference 123") or "ASM:" (example: "ASM:Reference 123"). Most banking portals already pull your platform’s name in other parts of their transaction detail.
/wallet_accounts/:id/withdraw?account_id=&amount=&custom_descriptor
Workflow summary
Once you’ve run through the API steps, and implemented something like the above in your platform, the sequence of calls to run the payout workflow in production will be reduced.
This flow assumes that you have a callback (webhook) service running, that your user exists and that a bank account has been added, and set as a disbursement / payout account.
- Create an Item to move money from your Float User to your customer.
POST /items
- Fund the Item with your Float User’s digital wallet (use the ID you got in Step 5 on the Inbound payment steps)
PATCH /items/:id/make_payment
- Create a withdraw request on the wallet to pay to your user’s nominated bank account (use the bank account ID from step 3)
POST /wallet_accounts/:id/withdraw
Failed Direct Credit Payouts
In the case of a failure relating to the direct credit payouts the batch_transactions
object will be transitioned to invalid_account_details
. In this case you should verify the account details with the user and aim to create a new account with the correct details before reattempting the payment
Additional Details
For a list of payout error codes please refer to: Common error messages
For a list of statuses please refer to: Statuses
For FAQs payouts please refer to:
Updated almost 4 years ago