Login

2. Post Checkout Request

Initiate a checkout request to retrieve list of payment options to display

POST https://developer.tingg.africa/checkout/v2/custom/requests/initiate

The initiate checkout request endpoint will process the request as follows:

  1. Log the checkout request on the checkout platform that will be used for subsequent processing of charges requests, payment receipt, payment acknowledgments and refunds.
  2. (Optional) Raise an invoice and send a message to customer (SMS/email) that will contain a link to access the checkout request logged by merchant.
  3. Log merchant callback details i.e. payment web-hook URL in which an instant payment notification will be posted to.

📘

NOTE:

The POST checkout request function is necessary to retrieve the list of payment options configured for the service.

Header Parameters

HeaderValueRequired
AuthorizationBearer <Bearer_Token> generated during authenticate request in step 1.YES
Content-Typeapplication/jsonYES

Request Parameters

Parameter NameTypeDescriptionRequired
merchantTransactionIDstringUnique identifier of the request for paymentTRUE
currencyCodestringCurrency of the amount to be collectedTRUE
requestAmountdoubleMerchant amount to be collected.TRUE
countryCodestringThe ISO 3166-1 alpha-2 code of the country you wish to collect payment for. The country code ensures we present valid payment options available in that particular country.TRUE
accountNumberstringA unique reference number identifying the customer's accountTRUE
serviceCodestringMerchant's service code. This can be found here.TRUE
dueDatestringTime window a customer should complete making a payment. If not passed passed time defaults to 12 hours. Date format is YYYY-MM-DD hh:mm:ss.TRUE
requestDescriptionstringShows the description of the item being purchased.FALSE
customerFirstNamestringCustomer first nameFALSE
customerLastNamestringCustomer last nameFALSE
MSISDNstringCustomer's phone number formatted as given in the E.164 phone numbering.TRUE
customerEmailstringCustomer emailFALSE
paymentWebhookUrlstringA server to server URL endpoint that will be called to notify a merchant of a complete payment.TRUE
successRedirectUrlstringThe URL where the customer will be redirected on merchant's site once a full payment is made.TRUE
failRedirectUrlstringURL where the customer will be redirected to if a full payment is not done within the payment window.TRUE
extraDataJSONAdditional data specific to a client's applicationFALSE

Example

{
    "merchantTransactionID" : "<unique_transaction_id>",
    "requestAmount" : 100.50,
    "currencyCode" : "KES",
    "accountNumber" : "ACC12345",
    "serviceCode" : "TESTSERVICE",
    "dueDate" : "0000-00-00 00:00:00",
    "requestDescription" : "Getting service/good x",
    "countryCode" : "KE",
    "customerFirstName" :"John",
    "customerLastName" : "Smith",
    "MSISDN" : "<valid_mobile_number>",
    "customerEmail" : "[email protected]",
    "paymentWebhookUrl" : "https://my.url.com/webhook/receive",
    "successRedirectUrl" : "<YOUR_SUCCESS_REDIRECT_URL>",
    "failRedirectUrl" : "<YOUR_FAIL_REDIRECT_URL>",
    "extraData": {
      "bundleID": "30GB"
    }
}

Response Parameters

Parameter NameTypeDescription
statusCodeintegerRequest status code. See full status code details below.
200 - Checkout request status fetched successfully from the checkout platform
500 - Generic failure occurred. Could be as a result of a system failure on the checkout platform
1003 - The serviceCode sent in the checkout request did not match any the checkout platform service
1004 - Duplicate request. A similar checkout request already exists in the checkout platform. Could be as a result of re-posting a checkout request or re-using a merchantTransactionID.
1006 - The checkout request posted was missing a languageCode
1007 - The checkout request posted was missing a countryCode
1012 - The checkout request posted had an invalid callbackURL
1013 - The checkout request posted was not valid JSON
1014 - Missing merchantTransactionID.
1017 - Missing serviceCode.
1018 - Missing MSISDN.
1019 - Invalid MSISDN.
1025 - Missing currencyCode.
1026 - Missing amount.
1027 - Invalid amount
1028 - Missing accountNumber.
statusDescriptionstringDescription of the transaction status.
checkoutRequestIDintegerUnique request ID identifying the transaction provided by the checkout platform.
merchantRequestIDstringTransaction ID as given by the merchant identifying the transaction.
originalCurrencyCodestringA 3 digit ISO code for the original currency of the amount. This will be as provided by the merchant.
convertedCurrencyCodestringA 3 digit ISO code for the converted currency of the amount. This will be different of the service in use supports a different currency from the one provided in the request
requestAmountdoubleRequest amount that was provided by the merchant.
convertedAmountdoubleConverted amount that will be billed in the local currency. This is a multiplication of the original amount time and the conversion rate available
conversionRatedoubleThe rate of conversion available when the provided currency is converted into the working currency
paymentOptionsJSON ArrayA list of payment options available for the service selected. More information on the option parameters can be found under Fetch Payment Options.

Examples

Successful Response:

{
    "status": {
        "statusCode": 200,
        "statusDescription": "Successfully processed request"
    },
    "results": {
        "checkoutRequestID": 407073,
        "merchantTransactionID": "MTX437913",
        "conversionRate": 1,
        "originalCurrencyCode": "KES",
        "requestAmount": 6207,
        "convertedCurrencyCode": "KES",
        "convertedAmount": 6207,
        "paymentOptions": [
            {
                "paymentModeName": "USSD Push",
                "paymentModeID": 3,
                "serviceCode": "TESTSERVICE",
                "payerClientName": "Safaricom Limited",
                "payerModeID": 1,
                "paymentOptionCode": "Mobile Money",
                "payerClientCode": "SAFKE",
                "countryCode": "KE",
                "clientLogo": "Safaricom_Limited_10-Oct-2017_1507650496.png",
                "serviceName": "Test Service",
                "minChargeAmount": 1,
                "maxChargeAmount": 70000,
                "currencyCode": "KES",
                "paymentInstructions": "<p>You will receive a prompt on mobile number <b>^CHARGE_MSISDN^</b>.<br/> Enter your M-Pesa PIN to authorize your payment of <b>KES ^CHARGE_AMOUNT^</b> to account number <b>^ACCOUNT_NUMBER^</b>. </p>",
                "languageCode": "en"
            },
        ]
    }
}

Failure Response:

{
    "status": {
        "statusCode": 1014,
        "statusDescription": "The merchant transaction id field is required."
    },
    "results": null
}

Authentication Failure Response:

{
    "message": "Unauthenticated.",
    "status_code": 500
}