Direct Card Checkout

Merchants seeking to integrate card payments into their checkout process must adhere to the following guidelines to successfully complete the transaction request.

The Request is similar in someway with the Mobile Money Checkout Request/

API

Request URL

{{base_url}}/api/create-order

Request

FieldDescriptionTypeOptional/Mandatory
codePayment code indicating card payments (102)intMandatory
merchant_order_idUnique identifier for the merchant's orderstringMandatory
amountAmount of the transaction in the specified currency. Minimum is 1000 TZSintMandatory
currencyCurrency code for the transaction (e.g., "TZS")stringMandatory
merchant_cancel_urlURL to redirect in case of cancellation (not used)valid url stringOptional
merchant_redirect_urlURL to redirect upon successful transaction (not used)valid url stringOptional
metadataAdditional metadata for the transaction (if applicable)JSONOptional
billingBilling information for card payments (see subfields)JSONMandatory
merchant_webhookURL for receiving transaction notifications (webhook)valid url stringMandatory
product_countNumber of products in the transactionintMandatory
customer_emailCustomer's email addressvalid email stringMandatory
customer_nameCustomer's namestringMandatory
customer_phoneCustomer's phone numberstringMandatory
customer_useridCustomer's user ID (if applicable)string/int
maxLength=100
Optional
is_recurringFlag indicating if the transaction is recurringboolOptional
shouldFailIndicates whether the transaction should be processed and succeed or not. Values can be (true) or (false). default is false. This is only important when you set your environment to Playground in your Dashboard.boolOptional

Billing Subfields

SubfieldDescriptionOptional/Mandatory
addressCustomer's street addressstringMandatory
stateCustomer's state or regionstringMandatory
cityCustomer's citystringMandatory
postcodeCustomer's postal codestringMandatory
country_codeCustomer's country (Default "TZ")stringOptional
phoneCustomer's phone numberstringMandatory

Initiating this request triggers the Card payment process. Upon successful initiation, the merchant receives a payment URL in response. This URL is provided to the customer to facilitate the completion of the transaction.

Sample Request

{
    "code": 102, // 102 for Card Payments
    "merchant_order_id": "5",
    "amount": 10000,
    "currency" : "TZS",
    "merchant_cancel_url": "https://www.yoursite.com/cancel", 
    "merchant_redirect_url": "https://www.yoursite.com/success", 
    "metadata": {
        "anykey": "anyvalue",
        "another_anyKey": "another_anyvalue"
    },
    "billing": { 
        "address": "Kinondoni Moroco",
        "state": "Dar es Salaam",
        "city": "Dar es Salaam",
        "postcode": "00000",
        "country_code": "TZ",
        "phone": "255789000111"
    },
    "merchant_webhook": "https://webhook.site/#!/2250a4d1-a6e2-4ac8-97b2-26dda65da334", // mandatory
    "product_count": "1",
    "customer_email": "[email protected]", 
    "customer_name": "Johnny Mnemonic",  
    "customer_phone": "255789000111",
    "customer_userid": 2,
    "shouldFail" : false
}

Sample Response

Payment Response

Upon initiating a card payment request, the merchant receives a response containing important information regarding the transaction process. Below is an explanation of each field in the response:

  • order_id: The unique identifier for the order or transaction initiated by the merchant.
  • status: Indicates the outcome of the payment request. In this case, it's set to 203, indicating a successful transaction.
  • result: Describes the result of the transaction process. Here, it's set to "dispatched," signifying that the payment notification has been successfully dispatched.
  • message: Additional information or notification message related to the payment process. Here, it states that a payment notification has been logged.
  • metadata: Optional data provided by the merchant during the payment request. It can include any custom key-value pairs specific to the transaction.
  • payment_url: The URL generated by the payment gateway for the customer to proceed with the payment. This URL redirects the customer to the payment page where they can complete the transaction.
{
  "order_id": "5",
  "status": 203,
  "result": "dispatched",
  "message": "Payment notification logged",
  "metadata": { "anykey": "anyvalue", "another_anyKey": "another_anyvalue" },
  "payment_url": "http://example.com/Ahesmey"
}

This response confirms the request has being received and provides the merchant with the necessary information, including the payment URL, to facilitate the customer's payment process.

📘

If the initialisation process fails, the merchant should read what caused the issue and rectify it, otherwise you may get in touch for more assistance

Upon customer payment completion using the URL provided in the previous step, the Merchant will be alerted using the web-hook url they provided in the initial request.

Summary

1
Merchant Sends Request
2
Gateway Processes the Request
3
Gateway Responds with Payment URL
4
Merchant Redirects Customer to theGiven Payment URL
5
Customer Completes Transaction
5
Gateway Alerts the Merchant on the Changed Status of the Transaction
6
Merchant Verifies the Transaction Status
7
Merchant Completes/Fails Transaction