Card Payment
Process payments via credit and debit cards with secure payment pages
Card Payment
Process payments through credit and debit cards using our secure payment gateway. This provides a seamless checkout experience for customers who prefer card payments.
Overview
Card payments are processed through our secure payment gateway, providing PCI-compliant handling of sensitive card information. Customers are redirected to a secure payment page to complete their transaction.
Endpoint
POST https://api.bridgeagw.com/make_paymentRequest Headers
Authorization: Basic <base64_encoded_credentials>
Content-Type: application/jsonRequest Body
{
"service_id": 1,
"reference": "Payment for Order #123",
"transaction_id": "TXN_001",
"trans_type": "CTM",
"amount": 25.00,
"nw": "CRD",
"nickname": "John Doe",
"payment_option": "CRD",
"currency_code": "USD",
"currency_val": "1",
"callback_url": "https://your-site.com/webhook/payment-status",
"request_time": "2025-01-15 14:30:00",
"landing_page": "https://your-site.com/payment-success"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
service_id | integer | Yes | Your service identifier |
reference | string | Yes | Payment reference/description |
customer_number | string | No | Not required for card payments |
transaction_id | string | Yes | Unique transaction identifier |
trans_type | string | Yes | Must be "CTM" for collections |
amount | number | Yes | Payment amount |
nw | string | Yes | Must be "CRD" for card payments |
nickname | string | Yes | Customer's display name |
payment_option | string | Yes | "CRD" for cards only, "CRM" for both cards and mobile money |
currency_code | string | Yes | Currency code (e.g., "USD", "EUR", "GHS") |
currency_val | string | Yes | Currency value for display |
callback_url | string | Yes | URL to receive payment notifications |
request_time | string | Yes | Request timestamp |
landing_page | string | Yes | URL to redirect after successful payment |
Payment Options
| Option | Code | Description |
|---|---|---|
| Cards Only | CRD | Only credit/debit card payment option |
| Cards + Mobile Money | CRM | Both card and mobile money options |
Supported Currencies
| Currency | Code | Description |
|---|---|---|
| US Dollar | USD | United States Dollar |
| Euro | EUR | European Union Euro |
| Ghana Cedi | GHS | Ghanaian Cedi |
| British Pound | GBP | British Pound Sterling |
Response
Success Response (200)
{
"response_message": "Successful",
"response_code": "000",
"redirect_url": "https://cardspaymentpage.com/en/payment/123456789"
}Error Response (401)
{
"response_message": "You are not allowed to use this service",
"response_code": "100"
}Example Usage
curl -X POST "https://api.bridgeagw.com/make_payment" \
-H "Authorization: Basic <your_credentials>" \
-H "Content-Type: application/json" \
-d '{
"service_id": 1,
"reference": "Payment for Order #123",
"transaction_id": "TXN_001",
"trans_type": "CTM",
"amount": 25.00,
"nw": "CRD",
"nickname": "John Doe",
"payment_option": "CRD",
"currency_code": "USD",
"currency_val": "1",
"callback_url": "https://your-site.com/webhook/payment-status",
"request_time": "2025-01-15 14:30:00",
"landing_page": "https://your-site.com/payment-success"
}'const response = await fetch('https://api.bridgeagw.com/make_payment', {
method: 'POST',
headers: {
'Authorization': 'Basic <your_credentials>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
service_id: 1,
reference: "Payment for Order #123",
transaction_id: "TXN_001",
trans_type: "CTM",
amount: 25.00,
nw: "CRD",
nickname: "John Doe",
payment_option: "CRD",
currency_code: "USD",
currency_val: "1",
callback_url: "https://your-site.com/webhook/payment-status",
request_time: "2025-01-15 14:30:00",
landing_page: "https://your-site.com/payment-success"
})
});
const result = await response.json();
if (result.response_code === "000") {
// Redirect customer to payment page
window.location.href = result.redirect_url;
} else {
console.error('Payment initiation failed:', result.response_message);
}import requests
url = "https://api.bridgeagw.com/make_payment"
headers = {
"Authorization": "Basic <your_credentials>",
"Content-Type": "application/json"
}
data = {
"service_id": 1,
"reference": "Payment for Order #123",
"transaction_id": "TXN_001",
"trans_type": "CTM",
"amount": 25.00,
"nw": "CRD",
"nickname": "John Doe",
"payment_option": "CRD",
"currency_code": "USD",
"currency_val": "1",
"callback_url": "https://your-site.com/webhook/payment-status",
"request_time": "2025-01-15 14:30:00",
"landing_page": "https://your-site.com/payment-success"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result['response_code'] == '000':
# Redirect customer to payment page
redirect_url = result['redirect_url']
print(f"Redirect customer to: {redirect_url}")
else:
print(f"Payment initiation failed: {result['response_message']}")Payment Flow
- Initiate Payment: Send payment request with transaction details
- Get Redirect URL: Receive secure payment page URL
- Redirect Customer: Send customer to payment page
- Customer Payment: Customer enters card details and pays
- Payment Processing: Card payment is processed securely
- Redirect Back: Customer is redirected to your landing page
- Callback Notification: You receive confirmation via webhook
Security Features
- PCI DSS Compliant: Secure handling of card information
- 2D & 3D Secure: Support for 2D and 3D Secure authentication
- Tokenization: Card details are tokenized for security
- Fraud Detection: Advanced fraud detection and prevention
- SSL Encryption: All data transmitted over HTTPS
Supported Card Types
- Visa: All Visa credit and debit cards
- Mastercard: All Mastercard credit and debit cards
- American Express: American Express cards
- Local Cards: Country-specific card networks
Integration Examples
React Integration
const handleCardPayment = async (paymentData) => {
try {
const response = await fetch('https://api.bridgeagw.com/make_payment', {
method: 'POST',
headers: {
'Authorization': 'Basic <your_credentials>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
service_id: 1,
reference: paymentData.reference,
transaction_id: paymentData.transactionId,
trans_type: "CTM",
amount: paymentData.amount,
nw: "CRD",
nickname: paymentData.customerName,
payment_option: "CRD",
currency_code: paymentData.currency,
currency_val: "1",
callback_url: "https://your-site.com/webhook/payment-status",
request_time: new Date().toISOString(),
landing_page: "https://your-site.com/payment-success"
})
});
const result = await response.json();
if (result.response_code === "000") {
// Redirect to payment page
window.location.href = result.redirect_url;
} else {
throw new Error(result.response_message);
}
} catch (error) {
console.error('Payment error:', error);
}
};Best Practices
- Landing Page: Always provide a landing page for post-payment redirect
- Currency Handling: Use appropriate currency codes for your market
- Error Handling: Implement comprehensive error handling
- Testing: Test with small amounts and test cards first
- Monitoring: Monitor payment success rates and failures
Sandbox testing
In sandbox mode, card collection uses the same endpoint and request body as production. Only the four test PANs below are accepted. Any other card number returns 019.
| Brand | nw | customer_number (PAN) | response_code | Result |
|---|---|---|---|---|
| Visa | VIS | 4111111111111111 | 000 + redirect_url | Success |
| Visa | VIS | 4242424242424242 | 000 + redirect_url | Success |
| Mastercard | MAS | 5105105105105100 | 000 + redirect_url | Success |
| Mastercard | MAS | 5555555555554444 | 000 + redirect_url | Success |
| Any other PAN | any | (any other value) | 019 | Not allowed |
The redirect_url returned in sandbox points to a test payment page. After the simulated redirect flow completes, your callback_url receives a success callback. Use payment_option: "CRD" for cards only, or "CRM" for a page offering both cards and mobile money.
Example sandbox request:
{
"service_id": 12345,
"reference": "Order #123",
"transaction_id": "CARD-SANDBOX-001",
"trans_type": "CTM",
"amount": 25.00,
"nw": "VIS",
"customer_number": "4111111111111111",
"nickname": "John Doe",
"payment_option": "CRD",
"currency_code": "USD",
"currency_val": "1",
"callback_url": "https://your-site.com/webhook/payment-status",
"request_time": "2026-01-15T14:30:00Z",
"landing_page": "https://your-site.com/payment-success"
}Notes
- Card payments require a landing page for post-payment redirect
- Currency code and value are required for proper display
- Payment pages are mobile-responsive and optimized for conversion
- All card data is handled securely and never stored on your servers
- Support for international cards and multiple currencies