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
-
Create Payment Endpoint
Send a
POST
request to the PayBridgecreate 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
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 PayBridge 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 | Whether to apply a convenience charge to the transaction. |
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.
Integration Steps
-
Call the Create 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",
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.