Hosted Checkout
These sections walk you through the process of connecting with our hosted checkout. Technical knowledge of the technologies used in this area is required.
API/Backend Implementation:
With just few steps, you can integrate a smooth payment experience for your users in your current applications by using the Airgate Payment Link Rest API
Send a POST request to this endpoint
/payment_initiate_hosted
const axios = require('axios');
let data = JSON.stringify({
"amount": 1000,
"user": {
"name": "Alex Hunter",
"phone": "08134575575",
"email": " alexhunter@callphoneng.com "
},
"callback_url": <YOUR_CALLBACK_URL>,
"customer_transaction_ref": <YOUR_UNIQUE_REFERENCE>, // optional
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/payment_initiate_hosted' ,
headers: {
'secret-key': 'YOUR_SECRET_KEY',
'merchant-key': 'YOUR_MERCHANT_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});Frontend Implementation
If above request was successful, you should get a response in the format below. You can decide to redirect your customer to the link, render via WebView, etc., it's up to you
{
"message": "payment initiated",
"link": "https://pay.airgate.ng/payment_process/hosted/c5683ed4-a5d9-48ab-9812-a2da9da4703b?mode=sandbox&callback=https://airgate.ng"
}Once payment process is completed and the request hits your server, make a GET request to this endpoint to confirm transaction status
/payment_process/confirmation/{AIRGATE_TRANSACTION_REF}or/payment_process/confirmation_by_cutomer_ref/{CUSTOMER_TRANSACTION_REF}
let config = {
method: 'GET',
url: '/payment_process/confirmation/{AIRGATE_TRANSACTION_REF}',
headers: {
'mode': <YOUR_MODE>
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Last updated