Swiftx API facilitate fast payments via bank tranfers to specified beneficiaries.
SwiftX payment API (2.5.1)
- Since quotes are not reusable since v2.5.0, we could now add requirement that quote also contains rate: Quote amount is in base currency (e.g. AED/BHD) and payment amount is in destination currency (e.g. INR) We now check that
payment_amount = quote_amount * quote_rate
/v2/payment_extendpoint is now merged with/v2/paymentendpoint; You must supply details, like sender name, dob, some document id etcQuotes are now per single payment (i.e. no quote reuse, which was possible by accident)
For more efficient routing you can now add amount, bank and bank account details to the quote which allows for more efficient routing of payments.
You can now supply
external_idfor the payment order and fetch the payment status using that id.POST /v2/payment(external_idbody parameter)GET /v2/payments/{id}?external=true(external_idbody parameter)
You can now supply additional parameters to quote request (
amount,accandbankID). These allows us to return best possible quote and increase payment success rate.There is a new
/v2/payment_extendpoint which allows adding sender info. This allows payments for more countries.
Before using this API you need to obtain valid credentials:
- ACCESS KEY: Random base64 encoded string with custom prefix
- SECRET KEY: Random base64 encoded string
If possible, you need to keep ACCESS_KEY private and under no circumstances you should share your SECRET KEY. For user convenience, ACCESS KEY includes custom prefix in the value, e.g.
company-test-sIEUpUP7b41n51WYwhere the first part is your company tag, followed by key usage hint and last part is a random value.
For API authentication we use JWT/Bearer tokens, signed with your SECRET KEY
Currently supported JWT algorithms are:
HS256
JWT token header MUST include kid:
{
"alg": "HS256",
"typ": "JWT",
"kid": "someuser-demo-1234567890ABCDEF"
}JWT token body MUST include the following claims:
{
"sub": "someuser-demo-1234567890ABCD", /* (your `ACCESS KEY`), the same as `kid` */
"exp": 1234, /* (expiration time, UNIX timestamp, UTC) */
"iat": 1234, /* (issued at time, UNIX timestamp, UTC) */
"aud": "https://api.example.net", /* (API URL, e.g. "https://api.swiftxappdev.net") */
"iss": "https://api.example.com" /* (API URL, e.g. "https://api.swiftxappdev.net") */
}In addition to the above, you can add hmac claim for POST requests:
{
"hmac": "str (SHA256 HMAC of the raw POST body)"
}This allows attesting that POST payloads are not modified in transit.
Using fast expiring tokens with HMAC adds additional guards so your requests can't be intercepted/forged, nor replayed.
Swiftx doesn't provide JWT editor for the time being, you can use the excellent jwt.io (password is 'jwtv2')
Transactions accepted by the API can be in one of the following states. As soon as the order is accepted, you will get unique id in the response, which can base used to track the transaction.
Please note that orders rejected up-front by the API with 4xx (authentication or validation errors) are not represented in the state table, since they've never been accepted for processing.
| Status Category | Status | Description | Notes |
|---|---|---|---|
| In Progress | queued | Payment order accepted | Order is accepted and waiting to be submitted for processing |
| In Progress | pending | Payment order pending | DEPRECATED (see processing) |
| In Progress | processing | Payment order is processing | Payment submitted and accepted by processor |
| Success | succeeded | Payment executed successfully | |
| Failed | failed | Payment failed | Payment failed by the processor |
| Failed | rejected | Payment rejected | Payment rejected by processor or by API during processing (e.g API could not route) |
| Failed | canceled | Payment is canceled | DEPRECATED (see reversed) |
| Failed | reversed | Payment is reversed | Payment reversed (and refunded) on the processor side |
| Call Support | unknown | Payment state is unknown | Payment has encountered uknown status by the processor, needs manual intervantion |