Pay with Transfer
(with Dynamic Virtual Accounts on Anchor)
Anchor’s Pay with Transfer API allows organizations to create dynamic virtual accounts that receive payment via bank transfer. Dynamic Virtual accounts are temporary and will expire as defined by the expiry time or after completion of the designated transaction. This means that dynamic virtual accounts cannot be used for multiple transactions.
Authentication and Authorization
Anchor API uses API keys to authenticate requests. All requests must be made over HTTPS and authenticated over standard HTTP basic authentication. Any request sent without API Key will fail. Refer to our Authentication page for more information.
Making Collections with Pay With Transfer:
Collecting payments using pay with transfer's dynamic virtual accounts is a simple 3-step process:
- Generate account number through the Pay with Transfer API endpoint.
- Display the generated account number to your customer for payment via bank transfer.
- Upon successful payment, we send a webhook event with the payment details.
Receiving Payment with Pay with Transfer
The Create Pay with Transfer API endpoint allows you to pass the details of your transaction(expected payment amount, customer details and reference) along with other configuration attributes to ensure secure and precise transfers. Here is a sample payload to the Pay with Transfer API containing transaction details and other additional information.
| Method | Endpoint |
|---|---|
| POST | {{baseUrl}}/pay/pay-with-transfer |
{
"data": {
"type": "PayWithTransfer",
"attributes": {
"reference": "112132122s",
"customer": {
"fullName": "Example",
"email": "[email protected]"
},
"expiryTime": 3600,
"provider": "ninepsb",
"amount": 100000,
"metadata": {
"key1": "value1",
"key2": "value2"
}
}
}
}
{
"data": {
"id": "17238938974046179170-anc_pwt",
"type": "PayWithTransfer",
"attributes": {
"reference": "000050",
"expiryDate": "2024-08-17T12:54:57.404702",
"bank": {
"provider": "ninepsb",
"name": "9 Payment Services Bank"
},
"status": "Active", // /"Expired"/"Canceled”
"accountName": "GreatBiz/Sylvester",
"accountNumber": "5031290222"
},
"relationships": {
"merchant": {
"data": {
"id": "17218985830710-anc_og",
"type": "Merchant"
}
},
"payment": {
"data": {
"id": "17238931808317296510-anc_py",
"type": "PayIn"
}
}
}
}
}Request Payload Parameters
| Field | Type | Description | Mandatory |
|---|---|---|---|
| type | string | This is the type of resource, in this case, PayWithTransfer | Y |
| attributes.reference | string | A unique reference identifier for the dynamic virtual account. This should be alpha-numeric and less than 100 characters (e.g., “testejbw456789”) | Y |
| attributes.customer | object | This is a JSON object | Y |
| attributes.customer.fullName | string | The name that will be associated with the dynamic virtual account. This is the name that will be visible to the sender (e.g., “Merchant/Sylvester Simple LLC”). Where name is not passed, it will default to the merchant name. | N |
| attributes.customer.email | string | This is the email that will be associated with the dynamic virtual account | Y |
| attributes.expiryTime | integer | The duration (in seconds) before the virtual account expires. All Dynamic Virtual Accounts will expire one hour after creation | Y |
| attributes.provider | string | The provider handling the virtual account transactions. (e.g., “ninepsb”) | N |
| attributes.amount | integer | The amount expected to be received in minor units (e.g., 10000 for ₦100). | Y |
| metadata | object | Our endpoints allow for additional information to be stored in our system in key-value pairs. | N |
Error Handling
If the request fails due to invalid inputs or transaction control issues, the API will return an error response with details on what went wrong. Examples of common errors include invalid provider names, incorrect expiry time formats, or unsupported transaction reference. Learn more about error handling.
Handling Webhooks When a payment is received successfully, Anchor sends you an event (payin.received) to the webhook URL that you provide. Learn more about using webhooks.
{
"data": {
"id": "17314910010651037850-anc_py_et",
"type": "payin.received",
"attributes": {
"createdAt": "2024-11-13T09:43:21.065172119"
},
"relationships": {
"payIn": {
"data": {
"id": "17314909327443804742-anc_py",
"type": "PayIn"
}
}
}
}
}
Updated 6 days ago