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/
{
"client": {
"email": "[email protected]",
"phone": "256770123456",
"country": "UG",
// "full_name": "Jane Rose",
// "personal_code": "10231",
// "tax_number": "70002307552",
// "city": "Kampala",
// "street_address": "Ntinda",
// "zip_code": "124538",
// "state": "Nakawa"
},
"purchase": {
"currency": "UGX",
"products": [
{
"name": "Example One",
"price": "500"
}
]
},
"reference": "Your unique transaction reference",
"skip_capture": false,
"brand_id": "{{BrandId}}"
}
The transaction ID in JSON response is then used to execute request(Step 2) to initiate a STK Push 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 STK Push 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}/
s2s*
String
true
pm*
String
paytota_proxy
You will receive a callback on your webhook URL regarding the status of the transaction
Successful transaction (status = paid)
Failed transaction (status = error)
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
Content-Type*
String
application/json
Authorization*
String
Bearer {{secret key}}
Last updated