Paying new beneficiaries
Paying new beneficiaries
You can pass the details of the beneficiary you want to make payment to while initiating a payment and Waza would handle the creation of that beneficiary for you before attempting to start the payment process.
Payment information
Param | Required? | Description |
---|---|---|
amount | Yes | Amount (in the lowest currency value - kobo, pesewas or cent) you intend sending to the beneficiary. |
description | Yes | Description of the payment you're initiating |
customerReference | No | Unique case sensitive transaction reference. If you do not pass this parameter, Waza will generate a unique reference for you. |
metaData | No | Object containing any extra information you want recorded with the transaction. |
beneficiary | Yes | Object containing the information of your beneficiary as seen here |
Initialise payment
When you have all the details needed to initiate the payment, the next step is to pass these details over to our Payments API.
curl --request POST \
--url https://api.waza.co/api/payments \
--header 'waza-x-key: YOUR-API-KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"beneficiaryReference" : "beneficiary-reference",
"amount": 100,
"description": "MY API Transfer",
"customerReference": "my_first_ghs_payment",
"metaData": {"extra": "Sending GHS for NGN"},
"beneficiary": {
"type": "Business",
"bank": {
"code": "valid-bank-code",
"accountNumber": "valid-bank-account"
},
"country": "NGA",
"route": "bank_account",
"address": "Sample address",
"tag": "Sample tag",
"businessName": "JohnDoe Businesses",
"emailAddress": "[email protected]"
}
}
'
const https = require('https')
const params = JSON.stringify({
"beneficiaryReference" : "beneficiary-reference",
"amount": 100,
"description": "MY API Transfer",
"customerReference": "my_first_ghs_payment",
"metaData": {"extra": "Sending GHS for NGN"}
})
const options = {
hostname: 'api.waza.co',
port: 443,
path: '/api/payments',
method: 'POST',
headers: {
x-waza-key: 'YOUR-API-KEY',
'Content-Type': 'application/json'
}
}
const req = https.request(options, res => {
let data = ''
res.on('data', (chunk) => {
data += chunk
});
res.on('end', () => {
console.log(JSON.parse(data))
})
}).on('error', error => {
console.error(error)
})
req.write(params)
req.end()
A successful Payment API call should return a similar response structure as seen below:
{
"status": "success",
"message": "Transfer is being processed",
"data": {
"id": "d7fe321f-e2da-43746-ad0b-213b00de1463",
"beneficiaryReference": "cla77076a000871215mgbdxye",
"dateCreated": "2022-11-07T20:08:33.713Z",
"customerReference": "my_first_ghs_payment",
"state": "AWAITING_RECEIVE"
}
}
Updated 4 months ago