Bridge API DocsBridge API Docs
Bridge API Docs
Api reference

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_payment

Request Headers

Authorization: Basic <base64_encoded_credentials>
Content-Type: application/json

Request 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

ParameterTypeRequiredDescription
service_idintegerYesYour service identifier
referencestringYesPayment reference/description
customer_numberstringNoNot required for card payments
transaction_idstringYesUnique transaction identifier
trans_typestringYesMust be "CTM" for collections
amountnumberYesPayment amount
nwstringYesMust be "CRD" for card payments
nicknamestringYesCustomer's display name
payment_optionstringYes"CRD" for cards only, "CRM" for both cards and mobile money
currency_codestringYesCurrency code (e.g., "USD", "EUR", "GHS")
currency_valstringYesCurrency value for display
callback_urlstringYesURL to receive payment notifications
request_timestringYesRequest timestamp
landing_pagestringYesURL to redirect after successful payment

Payment Options

OptionCodeDescription
Cards OnlyCRDOnly credit/debit card payment option
Cards + Mobile MoneyCRMBoth card and mobile money options

Supported Currencies

CurrencyCodeDescription
US DollarUSDUnited States Dollar
EuroEUREuropean Union Euro
Ghana CediGHSGhanaian Cedi
British PoundGBPBritish 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

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"
  }'

JavaScript

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);
}

Python

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

  1. Initiate Payment: Send payment request with transaction details
  2. Get Redirect URL: Receive secure payment page URL
  3. Redirect Customer: Send customer to payment page
  4. Customer Payment: Customer enters card details and pays
  5. Payment Processing: Card payment is processed securely
  6. Redirect Back: Customer is redirected to your landing page
  7. 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

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