Tokens
User tokens allow you to capture personal user data without needing to store the data in your application. When a token is created the api provides a unique ID to associate with a user account in your application.
A user token consists of 4 parts:
- User information
- Organization Information (If business)
- Bank Account Information (Optional for buyers)
- Payment Settings
List tokens
The tokens
query is used to get a list of tokens that you have created. By default your organization already has a
token generated as part of the signup process.
Retrieve a token
You can retrieve a token using the token
query.
Create a token
A token is created using the tokenCreate
mutation.
All user details are required when creating a token.
Organization information, banking details and settings are optional and can be added at a later stage if/when needed.
Banking details can only be added to a token once and cannot be updated. When updating banking details you will need to recreate the token for the user. If you have active transactions they will use the token you provided when you created the transaction and can only be changed by contacting support.
Example of tokenCreate
In the above example an ID is returned, you can store this ID as part of your users profile and use it to update the token as needed.
Update a token
To updating a token only the ID and fields that require an update need to be submitted.
Example of tokenUpdate
Get the payment history of a token
You can get a payment history of a token by using the tokenStatement
query. This data can be used to present a list of
debits and credits to a user or be used for data reconciliation.
The statement works as a simple leger listing debits and credits.
There are several fields available in the query.
- Type: The type of transaction Debit (Remove money) or Credit (Add money)
- Amount: lists the value of the entry
- Status: The status of the transaction in most cases this will be accepted (ACSP). In the event of a withdrawal or payout this may show pending (PDNG), this means that the pay-out has been scheduled and will transition to accepted once payment has been confirmed by our bank.
- Reference: A description of where the funds are going or came from.
Deposit funds into token wallet
Users can deposit funds into their wallet using a link generated using the tokenDeposit
mutation.
When a user visits the link they will be prompted for a deposit amount. Once they have entered the amount that they would like to be deposited they can then use one of the payment options to make the deposit.
You can also limit the payment methods available to a user by setting the paymentMethods
field.
The timeout for the deposit page can be set using the minutes
field.
Withdraw funds from token wallet
If a user would like to have funds withdrawn and paid out to their bank account. The tokenAccountWithdraw
mutation can
be used.
Once created the request will appear as a debit entry in the statement.
The mutation will return a true
if the request was successful and false
if it was not.
Real Time Clearance (Instant EFT)
To trigger a real time clearance set rtc
to true
Transferring funds between tokens
Funds can be transferred between wallets. The source wallet needs to have enough funds for a transfer to be successful.
- The sourceId is the wallet with the funds
- The destinationId is where the funds will be sent to
- Value is the amount that will be transferred
- Reason is a description of the transfer, this will also appear on the destination wallet statement
Testing payments with token Wallets
To help test wallet payments. Funds can be added to a token using the tokenUpdateFunds
mutation.