Echezona Standard
Echezona Standard provides a flexible server-side payment processing solution that integrates seamlessly into your application. This allows you to handle transactions securely while maintaining a smooth user experience.
Features
- Server-side payment initiation.
- Redirection to a secure Echezona checkout page.
- Automatic redirection back to your website after successful or failed transactions.
- Simplified post-payment processing.
How It Works
-
Create Payment Endpoint
Send a
POST
request to the Echezonacreate payment
endpoint with the payment details. -
Receive Payment Link
On success, you'll receive a payment link in the response. Redirect your customer to this link for payment.
-
Transaction Completion
After payment, the customer is redirected back to your website. Use the response to handle post-payment processes such as updating order statuses or providing confirmation.
API Reference
Endpoint
POST Payments/Initialize
Headers
Authorization: Bearer
To authorize this API request, you need to include your apiKey
as a bearer token. This is done by setting the Authorization header in your request. The header should have the format:
Authorization: "Bearer your_api_key"
Note: Get your API key from Settings > API Keys in your dashboard.
Request Body
Parameter | Type | Description |
---|---|---|
amount | string | The transaction amount in the smallest currency unit. |
currency | string | The currency for the transaction only NGN is supported. |
email | The customer's email address. | |
transactionId | string | A unique identifier for the transaction. |
callbackUrl | string | The URL to which Echezona will return to and send transaction status updates. |
metadata | array | A list of key-value pairs containing additional information about the transaction. |
metadata[].name | string | The name of a metadata field. |
metadata[].value | string | The value of the corresponding metadata field. |
productId | string | An identifier for the product being purchased. |
productDescription | string | A description of the product being purchased. |
applyConviniencyCharge | boolean | Set true if the customer incurs the transaction fee or false if it's you, the merchant. |
mode | string | The payment mode/environment (Test or Live ). |
Example Request Body
{
"amount": 5000,
"currency": "NGN",
"email": "customer@example.com",
"callbackUrl": "https://yourwebsite.com/thank-you",
"transactionId": "generated_trxn_id",
"mode": "Live"
}
Response
Field | Type | Description |
---|---|---|
responseCode | string | The code indicating the status of the response (e.g., 00 for success). |
responseMessage | string | A message describing the result of the request (e.g., Authorization URL created ). |
data | object | Contains details related to the payment URL and access code. |
data.paymentUrl | string | The URL for the payment page. |
data.accessCode | string | A unique code to identify the payment request. |
This structure aligns the response body with the provided JSON example.
Example Response Body
{
"responseCode": "00",
"responseMessage": "Authorization URL created",
"data": {
"paymentUrl": "https://checkout.echezona.com/PMMGWFAFxVxHOpG",
"accessCode": "PMMGWFAFxVxHOpG"
}
}
Integration Steps
-
Call the Initialize Payment API Use the above endpoint to generate a payment link.
-
Redirect the Customer Redirect your customer to the
payment_link
provided in the response. -
Handle Post-Payment After the transaction, the customer will be redirected to the
callbackUrl
. Validate the transaction status on your server to confirm payment.
Example Code (Node.js)
const axios = require("axios");
const createPayment = async () => {
const paymentData = {
mode: "Live",
apiKey: "enter API key",
amount: "50",
currency: "NGN",
email: "john@doe.com",
phone: "08012345678",
firstName: "John",
lastName: "Doe",
callBackUrl: "https://your-website/thank-you", // replace with your desired callback URL
transactionId: Math.floor(Math.random() * 99999999) + "",
};
try {
const response = await axios.post(
"https://api.echezona.com/Payments/Initialize",
paymentData
);
console.log("Payment Link:", response.data.data.payment_link);
} catch (error) {
console.error("Error creating payment:", error.response.data);
}
};
createPayment();
Redirect URLs
After payment completion, customers are redirected to your specified callbackUrl
. Use this opportunity to:
- Confirm the transaction status by querying the Echezona API.
- Display a payment success or failure message.
Security Tips
- Always validate payment status on your server.
- Use HTTPS to secure communications with the Echezona API.
Support
For questions or assistance, please contact our support team at hello@echezona.com.