Payment Flow

Understanding the flow of payment transactions with EcobankPay

Payment Transaction Flow

1

Customer selects items and proceeds to checkout

Customer browses merchant's website/app, selects products/services, and initiates the checkout process.

2

Merchant creates payment request

Merchant creates a payment request containing the required parameters (merchant_key, invoice_id, total, etc.) and sends it to the EcobankPay API.

Key Operations:

  • Generate a unique invoice ID
  • Calculate order total
  • Create secure hash using merchant_key, invoice_id, and total
  • Send POST request to EcobankPay endpoint
3

EcobankPay returns checkout URL

EcobankPay processes the request, validates the secure hash, and returns a checkout URL for the customer to complete the payment.

Response Content:

{
  "invoice_id": "unique-invoice-id",
  "tx_reference": "ecobankpay-transaction-reference",
  "url": "https://pgw.paywithonline.com/v1/checkout/8a7b6c5d4e3f2g1h",
  "success": true,
  "message": "Invoice created"
}
4

Customer is redirected to EcobankPay checkout

Merchant redirects the customer to the checkout URL provided by EcobankPay.

Checkout Process:

  • Customer is taken to a secure EcobankPay-hosted page
  • Payment options are displayed (Mobile Money, Cards, etc.)
  • Customer selects preferred payment method
5

Customer completes payment

Customer enters payment details and confirms payment on the EcobankPay checkout page.

Payment Methods:

  • Mobile Money: Customer enters phone number and confirms payment on mobile device
  • Card Payment: Customer enters card details and completes 3D Secure verification if required
  • QR Payments: Customer scans QR code with mobile banking app
6

EcobankPay processes payment

EcobankPay processes the payment through the selected payment method provider.

7

Customer is redirected back to merchant site

After payment is completed (or cancelled), the customer is redirected back to the merchant's success_url or cancelled_url.

8

EcobankPay sends notification to merchant

EcobankPay sends a notification to the merchant's IPN URL to inform about the payment status.

IPN Process:

  1. EcobankPay makes a GET request to merchant's IPN URL with invoice_id
  2. Merchant receives the notification and acknowledges receipt
9

Merchant verifies payment status

Merchant queries the EcobankPay API to verify the payment status using the invoice_id.

Status Verification:

  1. Merchant makes a GET request to the status check endpoint
  2. EcobankPay returns payment status (paid, cancelled, failed, etc.)
  3. Merchant updates order status in their system
10

Merchant fulfills order

If payment is successful, merchant fulfills the order and sends confirmation to the customer.

Payment Lifecycle

A payment in the EcobankPay system can go through several states during its lifecycle:

StatusDescriptionNext Steps
newPayment transaction is new, initiated to the respective payment networkWait for customer to complete payment
awaiting_paymentPayment pending. Customer has not completed or cancelled payment yet.Wait for customer to complete payment
paidPayment made successfully by customerFulfill order
cancelledPayment cancelled by customerUpdate order status, notify customer
failedTransaction failed. Reason for failure is provided in status_reason parameter.Review error, update order status, notify customer

Important Considerations

  • Always verify payment status: Never rely solely on the redirect to your success URL as confirmation of payment. Always verify the payment status using the status check endpoint.
  • Handle IPN notifications properly: IPN notifications are not confirmation of payment but rather a prompt to check the payment status. Always query the status check endpoint when receiving an IPN notification.
  • Secure hash validation: Always validate the secure hash in your requests to ensure data integrity.
  • Unique invoice IDs: Always use unique invoice IDs for each transaction to avoid confusion and ensure proper tracking.
  • Error handling: Implement comprehensive error handling to provide a smooth experience for your customers.