Klasha Wire API
Summary
Give merchants the ability to send out funds from their collection balance via API using our internal Klasha rates.
Coverage
See all available currencies here
You can transfer money in four easy steps:
Generate a bearer token
Create a beneficiary
Generate a quote for the beneficiary
Initiate a payment
Integration step
Generate a bearer token
Using the Token endpoint on the Postman collection, the token can be obtained from the headers under the header name: token
POST
{{env_url}}/auth/account/v2/login
Request Body
username*
username
password*
password
{
"message": "success",
"error": null,
"data": {
"token": "This is your token"
}
}
Create a beneficiary
Make a POST call to the Create Merchant Beneficiary API to create your beneficiary
POST
{{env_url}}/merchant/merchantbeneficiary/create
Make a POST call to the Create Merchant Beneficiary API to create your beneficiary. See an example of the payload you need to encrypt and send in order to create a beneficiary
The encrypted JSON body for the request can be found in the Postman link.
You’d need to pass, as header the x-auth-token
. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.
Headers
Authorization*
Bearer {{token}}
x-auth-token
MERCHANT PUBLIC KEY
Request Body
accountNumber*
1234567890
bankName*
Bank Name
bankAddress*
Bank Address
beneficiaryName*
Beneficiary Name
beneficiaryAddress*
Beneficiary Address
country*
Country Name
countryCode*
US
currency*
USD
phone*
phone number
swiftCode*
SWFT1234
narration*
clothes
routingNumber*
12345
iban*
045
{
"message": "encrypted request"
}
Generate a quote
Make a POST call to the Create Quote API to generate your quote
POST
{{env_url}}/wallet/wire/generate/quote
Make a POST call to the Create Quote API to generate your quote. See an example of the payload you need to encrypt and send in order to generate your quote.
The encrypted JSON body for the request can be found in the Postman link as well as other APIs.
You’d need to pass, as header the x-auth-token
. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.
Headers
Authorization
Bearer {{token}}
x-auth-token
MERCHANT PUBLIC KEY
Request Body
sourceCurrency*
NGN
destinationCurrency*
USD
beneficiary*
beneficiar87954c4f-736a-4e09-b588-76ab9c13bafeyId
destinationAmount*
1000.00
{
"message": "encrypted request"
}
Initiate a payment
Make a POST call to the Initiate Payment API
POST
{{env_url}}/wallet/wire/initiate
Make a POST call to the Initiate Payment API to convert your quote into an initialised payment.
See an example of the payload you need to encrypt and send in order to generate your quote.
The encrypted JSON body for the request can be found in the Postman link as well as other APIs
You’d need to pass, as header the x-auth-token
. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.
Headers
Authorization
Bearer {{token}}
x-auth-token
MERCHANT PUBLIC KEY
Request Body
quoteToken*
842dcd42-8f95-4a3b-a5f3-07a3d0416119
beneficiary*
87954c4f-736a-4e09-b588-76ab9c13bafe
narration*
School fees
invoiceUrl*
www.invoiceURL.com
{
"message": "encrypted request"
}
Fetch all your payments
Make a GET call to the Fetch All API
GET
{{env_url}}/wallet/wire/fetch/all
Make a GET call to the Fetch All API to retrieve all your previously initiated wire payments.
The URL can be found in the Postman link well as other APIs
You’d need to pass, as header the x-auth-token
. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.
Headers
Authorization
Bearer {{token}}
x-auth-token
MERCHANT PUBLIC KEY
Response
{
"message": "success",
"error": null,
"data": [
{
"id": 46,
"sourceCurrency": "NGN",
"sourceAmount": 1628664.50,
"destinationCurrency": "USD",
"destinationAmount": 1000.00,
"narration": "Test",
"destinationFees": 27.50,
"sourceFees": 44788.27,
"rate": 0.000614,
"klashaWireStatus": "PENDING",
"transactionReference": "KWire-296aac06-f425-4d43-9e4c-611247959a88",
"merchantBeneficiary": "e0595f0b-16b4-4b62-a317-fa00af40a7ec",
"quoteToken": "71a6aff6-5c23-41e3-8b85-6918cf92ead6",
"createdAt": "2024-07-09T19:00:52.218",
"updatedAt": "2024-07-09T19:02:14.863"
},
{
"id": 60,
"sourceCurrency": "NGN",
"sourceAmount": 1631321.37,
"destinationCurrency": "USD",
"destinationAmount": 1000.00,
"narration": "Test",
"destinationFees": 27.50,
"sourceFees": 44861.34,
"rate": 0.000613,
"klashaWireStatus": "PENDING",
"transactionReference": "KWire-bae3f6dc-aaec-4e6a-a963-cffe1a3899c5",
"merchantBeneficiary": "633b70a6-da15-4bc5-b0ec-1eda041245e2",
"quoteToken": "dbd4e976-ad5e-4555-aee5-d4afa59849c5",
"createdAt": "2024-07-11T14:40:11.91",
"updatedAt": "2024-07-11T14:41:29.237"
}
...
]
}
Fetch a single payment by reference
Fetch by reference API to retrieve all your previously initiated wire payments.
GET
{{env_url}}/wallet/wire/fetch/by/reference/<ref>
Make a GET call to the Fetch by reference API to retrieve all your previously initiated wire payments.
The URL can be found in the Postman link well as other APIs
You’d need to pass the transactionReference
you obtained when you initiated the payment, as a path variable.
You’d need to pass, as header the x-auth-token
. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.
Headers
Authorization
Bearer {{token}}
x-auth-token
MERCHANT PUBLIC KEY
Response
{
"message": "success",
"error": null,
"data": {
"id": 46,
"sourceCurrency": "NGN",
"sourceAmount": 1628664.50,
"destinationCurrency": "USD",
"destinationAmount": 1000.00,
"narration": "Test",
"destinationFees": 27.50,
"sourceFees": 44788.27,
"rate": 0.000614,
"klashaWireStatus": "PENDING",
"transactionReference": "KWire-296aac06-f425-4d43-9e4c-611247959a88",
"merchantBeneficiary": "e0595f0b-16b4-4b62-a317-fa00af40a7ec",
"quoteToken": "71a6aff6-5c23-41e3-8b85-6918cf92ead6",
"createdAt": "2024-07-09T19:00:52.218",
"updatedAt": "2024-07-09T19:02:14.863"
}
}
Quote expiry logic
After you proceeded generating your quote, you can now convert that quote into an initiated payment.
The initiation would be successful if the quote is NOT expired.
A quote does not expire because of time but just if the rate in our system changed.
In case you try to initiate a payment with an expired quote, you’d have a Bad Request response with the the following body:
{
"message": "Quote has expired or does not exist!",
"error": "QuoteNotFoundException",
"data": null
}
Last updated