Collect APIs
Direct card charge allows you to charge both local cards (issued in your country of operation) and international cards. This is useful if your customers are predominantly credit/debit card users, and you'd prefer for them to manage payments via your app.
Compliance required
Using direct card charge involves handling some very sensitive customer data, so a PCI DSS compliance certificate is required. When you've got one, contact your Relationship Manager to enable this feature on your account.
Payment flow
Card charge involves three main steps:
- Create Order: You send the transaction details and the customer's payment details to the charge card endpoint.
const axios = require('axios');
let data = JSON.stringify({
"customer": {
"firstname": "transact",
"lastname": "pay",
"mobile": "+2348134543421",
"country": "NG",
"email": "[email protected]"
},
"order": {
"amount": 100,
"reference": "",
"description": "Pay",
"currency": "NGN"
},
"payment": {
"RedirectUrl": "https://www.hi.com"
}
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://payment-api-service.transactpay.ai/payment/order/create',
headers: {
'api-key': 'PGW-PUBLICKEY-TEST-26795CB9393A4AF8BA931E8DA967FF3E',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
- Pay Order: We tell you the details needed to authorise the charge, you get those from the customer, and you send to the same charge card endpoint.
const axios = require('axios');
let data = JSON.stringify({
"reference": "",
"paymentoption": "C",
"country": "NG",
"card": {
"cardnumber": "5123450000784608",
"expirymonth": "01",
"expiryyear": "39",
"cvv": "193"
}
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://payment-api-service.transactpay.ai/payment/order/pay',
headers: {
'api-key': 'PGW-PUBLICKEY-TEST-26795CB9393A4AF8BA931E8DA967FF3E',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
- Verify Order: As a failsafe, you'll call our API to verify that the payment was successful before giving value (the verify transaction endpoint).
const axios = require('axios');
let data = JSON.stringify({
"reference": ""
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://payment-api-service.transactpay.ai/payment/order/verifyt',
headers: {
'api-key': 'PGW-PUBLICKEY-TEST-26795CB9393A4AF8BA931E8DA967FF3E',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Updated 7 months ago