How to Collect Payments with Atlas
Step-by-step guide to collecting payments by initiating a checkout session via the Atlas API, redirecting customers to the hosted checkout page, and confirming payments via webhooks.
Tip
Skip the integration process and collect payments using the Atlas UI .
Prerequisites
To follow this guide, you need the following:
- A verified Atlas account. If you don't have one, you can sign up for free and follow this guide to verify your Atlas account.
- An Atlas API Key. You can fetch your API Key from your Atlas dashboard .
- Configured and setup webhooks on Atlas. See our guide on Configuring and Verifying Atlas webhooks.
Collecting a payment
To collect a payment using the Atlas API, you have to make a POST request to the Initialize Checkout endpoint with details of the customer, the amount, and currency you want to collect the payment in.
For example:
const axios = require("axios");
const initiateCheckout = async () => {
const url = "https://atlas.tryduplo.com/api/v1/checkout/initiate";
const data = {
currency: "NGN",
first_name: "John",
last_name: "Doe",
email: "john.doe@example.com",
amount: 1000,
source_reference: "CHK_SRC_001",
};
const config = {
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
};
try {
const response = await axios.post(url, data, config);
console.log(response.data);
return response.data;
} catch (error) {
console.error("Error:", error.response?.data || error.message);
throw error;
}
};
// Call the function
initiateCheckout();Note
The only currency supported in your region is NGN.
For added security, you can encrypt the request payload before sending it to the Atlas API.
When you send the request, you will receive a response similar to the code block below:
{
"requestId": "abcd1234-5678-90ef-ghij-1234567890kl",
"requestTimestamp": "2025-07-16 09:15:00",
"message": "Checkout Transaction Initiated successfully.",
"statusCode": 200,
"data": {
"checkoutUrl": "https://checkout.tryduplo.com?ref=CHK_6WZSIYEK43",
"checkoutReference": "CHK_6WZSIYEK43",
"amount": {
"value": 1000,
"currency": "NGN",
"formatted": "NGN 1000.00"
}
}
}The response will contain a link to a checkout page where you can redirect your customer to. Once your customer completes a payment, Atlas will verify the payment and send you a webhook to confirm the final status of the transaction.
Follow this guide to learn how you can configure and verify webhooks from Atlas .
Once your application verifies that the webhook was sent by Atlas and has not been used before, you can fulfil the service.
Related guides
How is this guide?
Last updated on