Payment Gateway
Initialize Transaction
POSTEndpoint: https://app.moneta.ng/api/v1/transaction/initialize
Initialize a transaction from your backend by preparing the necessary parameters for the payment gateway.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Amount in kobo (e.g., 800000 for ₦8,000) |
| string | Required | Customer's email address | |
| callback_url | string | Required | URL to redirect after payment |
| payment_type | string | Required | Payment method (e.g., 'card') |
| channel | string | Required | Payment channel |
| metadata | object | Optional | Additional information about the transaction |
Code Examples
PHP Example
php
<?php
$email="";
$amount="";
$payment_type="";
$callback_url="";
$mac = "";
$mystring = $email . $amount. $payment_type . $callback_url;
$hash = hash_hmac('sha512', $mystring, $mac, false);JavaScript Example
javascript
import * as CryptoJS from 'crypto-js';
function generateHash(email, amount, payment_type, callback_url, mac) {
const myString = email + amount + payment_type + callback_url;
return CryptoJS.HmacSHA512(myString, mac).toString(CryptoJS.enc.Hex);
}Response
Success Response
{
"status": "success",
"responseCode": "00",
"url": "your callback URL",
"ref_no": "Moneta Reference",
"type": "card",
"authorization_url": "payment link"
}Important Note
Always verify the transaction status using the verification endpoint after receiving a callback.