Skip to main content

PayBridge Standard

PayBridge 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 PayBridge checkout page.
  • Automatic redirection back to your website after successful or failed transactions.
  • Simplified post-payment processing.

How It Works

  1. Create Payment Endpoint

    Send a POST request to the PayBridge create payment endpoint with the payment details.

  2. On success, you'll receive a payment link in the response. Redirect your customer to this link for payment.

  3. 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

Request Body

ParameterTypeDescription
amountstringThe transaction amount in the smallest currency unit.
currencystringThe currency for the transaction only NGN is supported.
emailemailThe customer's email address.
transactionIdstringA unique identifier for the transaction.
callbackUrlstringThe URL to which PayBridge will return to and send transaction status updates.
metadataarrayA list of key-value pairs containing additional information about the transaction.
metadata[].namestringThe name of a metadata field.
metadata[].valuestringThe value of the corresponding metadata field.
productIdstringAn identifier for the product being purchased.
productDescriptionstringA description of the product being purchased.
applyConviniencyChargebooleanWhether to apply a convenience charge to the transaction.
modestringThe 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

FieldTypeDescription
responseCodestringThe code indicating the status of the response (e.g., 00 for success).
responseMessagestringA message describing the result of the request (e.g., Authorization URL created).
dataobjectContains details related to the payment URL and access code.
data.paymentUrlstringThe URL for the payment page.
data.accessCodestringA unique code to identify the payment request.

This structure aligns the response body with the provided JSON example.

Integration Steps

  1. Call the Create Payment API Use the above endpoint to generate a payment link.

  2. Redirect the Customer Redirect your customer to the payment_link provided in the response.

  3. 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",
publicKey: "enter public 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.paybridge.com/payments/create",
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 PayBridge API.
  • Display a payment success or failure message.

Security Tips

  • Always validate payment status on your server.
  • Use HTTPS to secure communications with the PayBridge API.

Support

For questions or assistance, please contact our support team at support@paybridge.com.