Collection/Purchase

Step 1 - Initiate

This API method is utilized to trigger a collection/purchase request, resulting in a JSON response being returned to you.

POST {base url}/api/v1/purchases/

Headers

Name
Type
Description

Authorization*

Bearer {{secret key}}

Content-Type*

String

application/json

{
    "client": {
        "email": "[email protected]",
        "phone": "256751123456"
    },
    "purchase": {
        "currency": "UGX",
        "products": [
            {
                "name": "Example One",
                "price": "500"
            }
        ]
    },
    "reference": "Your unique transaction reference",
    "skip_capture": false,
    "brand_id": "{{BrandId}}",
    "payment_method_whitelist": ["airtel", "mtnmomo"],
}

The transaction ID in JSON response is then used to execute request(Step 2) to initiate a PIN prompt on the Subscriber's mobile handset to be debited.

Step 2 - Execute

You have two methods to execute the transaction

  • Redirect the customer to the {{checkout_url}} provided in the response from step 1 on the Paytota platform. Take note the following parameters should be added to your Initial JSON body on using this method success_redirect, failure_redirect After the payment is processed, the system will redirect the customer back to your website.

  • Alternatively, you can initiate a PIN prompt on the subscriber handset by sending a form-data request through your backend system. Following a successful execution, you will receive asynchronous status update via webhook. The notification will have the status 'pending_execute'.

Using the transaction ID received in Step 1, this method is then queried by sending a form-data request to initiate a PIN prompt on the subscriber handset.

POST {base url}/p/{id}/

Headers

Name
Type
Description

Content-Type*

String

multipart/form-data

Request Body

Name
Type
Description

Phone*

String

256751123456

pm*

String

Should be airtel or mtnmomo

You will receive a callback on your webhook URL regarding the status of the transaction

Callback Example

Check Collection/Purchase Status

This method is used to query the collections/purchases transaction status using the transaction ID. Please note that this API also requires authorization using the Secret Key.

GET {base url}/api/v1/purchases/{id}/

Headers

Name
Type
Description

Content-Type*

String

application/json

Authorization*

String

Bearer {{secret key}}

Last updated