Receive Payments - Direct Checkout v1.0

Simplified integration guide for EcobankPay Direct Checkout

Prerequisites

To successfully complete the integration and send requests, the following details are required:

REQUIREMENTSDESCRIPTION
Merchant KeyThis is a unique Key created by EcobankPay and assigned to third parties for integration.

Initiate payment transaction request to Gateway

Every request to EcobankPay gateway to initiate and process payment transactions must contain the below parameters.

The thing to note is that EcobankPay requires each transaction to be identified by a unique invoice ID and an amount due (in GHS for the avoidance of doubt).

Request:

Endpoint:

https://checkout.paywithonline.com/

Method:

POST

Required Parameters:

PARAMETERREQUIREDDESCRIPTION
merchant_keyYYour unique assigned Merchant Key
invoice_idYYour internally generated transaction invoice id. Should be unique for every transaction and not more than 25 characters in length.
totalYThe total payment due for the cart. Please note that the gateway will *NOT* compute this. We want the merchant to compute this him/herself and to add in any tax or shipping elements they may want to
success_urlNThe page to which EcobankPay will redirect the customer after customer completes the EcobankPay checkout process. Please note that this does not mean that payment has been received!
cancelled_urlNThe page to which EcobankPay will redirect the customer after customer cancels the EcobankPay checkout process.

Optional Parameters:

PARAMETERREQUIREDDESCRIPTION
extra_mobileNCustomer contact number (customer receives payment notification via SMS if provided)
extra_emailNCustomer email address (customer receives payment Email notification if provided)
extra_nameNCustomer name
descriptionNDescription of payment or order description/details
ipn_urlNThis specifies the url to which EcobankPay will send notification once payment is received.

Sample code on how to generate the Request:

<form action="https://checkout.paywithonline.com/" method="post">
  <div class="modal-body">
    <div class="row">
      <div class="col-lg">
        <input name="merchant_key" type="hidden" value="your_merchant_key">
        <input name="success_url" type="hidden" value="">
        <input name="cancelled_url" type="hidden" value="">
        <input name="ipn_url" type="hidden" value="">
        Invoice ID <input name="invoice_id" type="text" value="">
        Name <input name="extra_name" type="text" value="">
        Contact <input name="extra_mobile" type="text" value="">
        Email <input name="extra_email" type="text" value="">
        Total <input name="total" type="text" value="">
      </div>
    </div>
  </div>
</form>

Upon successful completion of payment process or cancellation of payment process on EcobankPay gateway checkout page by customer, the customer is re-directed to the success url or cancelled url page specified in the request respectively.

Handling payment notifications

Once the customer pays or cancels an invoice, depending on your site setup, EcobankPay can do two things:

  • Send an email informing you of the payment or cancellation
  • Send a notification to an IPN (instant payment notification) URL for your application to take some automated action

It is worth stressing the IPN notification from EcobankPay is not confirmation of a payment. Rather it is a prompt that an event of interest has happened to one of your invoices. It is your application's responsibility to query the EcobankPay gateway for details on the event using the status check end point. While this may sound complicated, it is not. Here's how it works:

  1. Once an invoice is paid or cancelled, EcobankPay does a GET to your IPN URL with the invoice_id parameter. Suppose, your IPN url is https://ipn_url.ecobankpay.com.gh/notify and a customer pays or cancels invoice with invoice ID AA123, EcobankPay will perform the GET requesthttps://ipn_url.ecobankpay.com.gh/notify?invoice_id=AA123. This call is meant to prompt your application that an event of interest has occurred with respect to this invoice.
  2. Your application will then make the GET callhttps://pgw.paywithonline.com/v1/gateway/json_status_chk?invoice_id=AA123&merchant_key=YOUR_MERCHANT_KEY to receive details of the event.
  3. EcobankPay responds to the query in the step above with a JSON object. Details of the response object are described as part of the status check end point.

Sample payment notification Request

Request:

Endpoint:

https://pgw.paywithonline.com/v1/gateway/json_status_chk

Method:

GET

Parameters:

PARAMETERREQUIREDDESCRIPTION
merchant_keyYYour unique assigned Merchant Key
invoice_idYInvoice Id of the particular transaction whose details to check

Response Codes

Below is the general response received for a payment status request sent.

PARAMETERVALUESVALUE TYPEDESCRIPTION
statusnew, paid, cancelled, awaiting_payment, failedStringTransaction status of payment:
new: payment transaction is new, initiated to the respective payment network
paid: payment made successfully by customer
cancelled: payment cancelled by customer
awaiting_payment: payment pending. Customer does not complete or cancel payment.
Failed: Transaction failed. Reason for failure is provided in status_reason parameter.
status_reasonFree textStringThis parameter holds detail description for a Failed Transaction status. For other status values, it is empty.

Gateway Error Codes

#ERRORDESCRIPTION
1.GW-001merchant_key missing or empty
2.GW-002invoice_id missing or empty
3.GW-003total/amount value missing or empty
4.GW-009Merchant is deactivated from receiving payments

Response Parameters

PARAMETERDESCRIPTION
psp_response_msgThis parameter gives explanation or description of the response error code for Card payments (if available).
psp_response_codeThis parameter is only available for Card Payment transactions. It holds the specific error code applied to a transaction.

Extra Parameters

PARAMETERVALUESVALUE TYPEDESCRIPTION
extraArray ObjectSub array of extra parameters available:
channelpayment channel used by customer
emailEmail address of customer if provided in initial request
Mobile_noPhone number of customer if provided in initial request