Request Card Payment
The GovBill API supports card payments as described in the Supported Countries section. The section below will guide you through the process of accepting Card (VISA/Mastercard)
Last updated
The GovBill API supports card payments as described in the Supported Countries section. The section below will guide you through the process of accepting Card (VISA/Mastercard)
Last updated
Card is supported in a few countries as listed (to be updated from time to time). Test card numbers are also described in section. We equally recommend that you go through the section to have a high-level understanding of the funds collection process.
The table below describes the request parameters that are used for the collection request. Most will be collected from the paying customer and some are custom configurations based on your wishes (e.g. who bears the transaction charge, whether or not you wish to trigger the confirmation process by yourself).
merchant_reference
String
true
The unique reference for this request. Alternatively, the value auto can be passed and a reference will be created for you by the platform
transaction_method
String
true
The transaction method to be used. This will be CARD for this request
provider_code
String
true
currency
String
true
The 3 character ISO currency code for the request currency
amount
Number
true
The amount being requested
customer_name
String
true
The name of the customer
customer_email
String
false
The email of the customer
description
String
false
The description/narration for the transaction
charge_customer
Boolean
false
Whether or not the customer should bear the charge for the transaction. Defaults to false if the parameter is not set explicitly
require_confirmation
Boolean
false
Whether or not the requesting merchant account wishes to explicitly do the second step (confirmation). Currently defaults to true
redirect_url
String
true
The URL that GovBill will redirect to when the transaction is complete
After collecting the necessary card payment information from your customer, prepare your request payload as demonstrated below.
POST
https://gwapisdbx.govbill.ug/collections/initialize
The request is sent as a JSON body as demonstrated by the sample request below. Sample responses (acknowledgement and failure) are also shared.
If in step 1 you chose that you wish to explictly handle the request confirmation, then it becomes mandatory that you send the transaction confirmation API request. If the request in step 1 is successful and responds with an acknowledgement (HTTP code 202), you should listen and handle the transaction charges webhook/callback. This will be sent to the collection callback URL that's configured on your merchant account. The callback is sent as a JSON POST request and we recommend that the confirmation request is done after the arrival of this callback. Below is a sample payload.
POST
https://gwapisdbx.govbill.ug/collections/confirm
The confirmation request will respond with an acknowledgement just like in Step 1 above. The response will also have a payment_url to which the customer needs to be redirected to complete the transaction.
The provider code as obtained from the payment options the previous section
Every merchant account is expected to have configured a callback/webhook URL for collections. For all collections that transition to the final state (COMPLETED, FAILED or CANCELLED), a JSON POST request will be made to the callback URL. Sample callback payloads (request bodies) are shared below. Be sure to check out to see how you should verify the signature(s) in the request headers and how to respond.