Collections/Payins - Redirect
We provide the following product/services via API to merchants for collections across channels
Environment Urls
Sandbox: https://devbox.paydestal.com/pay
Prod: https://api.paydestal.com/pay
Virtual Accounts
Card Processing
USSD Processing
Pay Redirect
Payment Redirect
You can call the Initialize Transaction Endpoint from your server to generate a checkout link, then redirect your users to the link so they can pay. After payment is made, the users are returned to your provided link in the callbackUrl
Default currency is presumed NGN except when specified differently.
< <form id="paymentForm" action="/saveAndPay" method="POST">
<input type="hidden" name="customerEmail" id="customerEmail">
<input type="hidden" name="amount" id="amount">
<input type="hidden" name="reference" id="reference">
<button type="submit" name="payBtn" id="pay-now" title="Pay now">Pay now</button>
</form>
<script>
const email = "[email protected]";
const amount = 4500;
const reference = "23445yyt";
// Populate the hidden input fields with values
document.getElementById('customerEmail').value = email;
document.getElementById('amount').value = amount;
document.getElementById('reference').value = reference;
</script>
Form-Data Request
const axios = require('axios');
const url = "{baseUrl}/api/v1/transaction/initialize";
const data = {
customerEmail: "[email protected]",
amount: "4500",
callbackUrl: "https://pay.tech/callback",
};
axios.post(url, data, {
headers: {
Authorization: "Bearer {your client secret}",
"Cache-Control": "no-cache",
"Content-Type: "multipart/form-data"
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});
JSON Payload Request
if you prefer to make a json request instead of the form-data above, the endpoint to call is the one used in the snippet below:-
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{your client secret}}");
const raw = JSON.stringify({
"amount": 4500,
"customerEmail": "[email protected]",
"callbackUrl": "https: //pay.tech/callback",
"reference": "3t4t4gthty754433455y5"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("{{baseUrl}}/pay/api/v1/transaction/initializer", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
{
"responseCode": "201",
"responseMessage": "Payment Order Created Successfully!",
"data": {
"amount": 4500.0,
"customerEmail": "[email protected]",
"currency": "NGN",
"reference": "06962146778",
"redirectUrl": "https://checkout.paydestal.com/charge/06962146778",
"callbackUrl": "https://paydestal.com",
"paymentStatus": "STARTED"
},
"success": true
}
Last updated