SasaPay Checkout API
SasaPay API provides a checkout page that contains payment methods such as SasaPay,M-PESA,Airtel-Money,T-KASH and Card payments.
Endpoint: https://sandbox.sasapay.app/api/v1/payments/card-payments/
Request Parameters
Field | Type | Description | Examples |
---|---|---|---|
MerchantCode | String | A unique number assigned to an organization/merchant registered with ViewTech, through which payment is received (can be Paybill or Till number) | "2*****8" |
Amount | String | Amount to be paid to the requester's account | KES 300000.00 |
Reference | String | A unique reference for the transaction | "1234abc" |
Description | String | The reason for payment. | "True " |
Currency | String | The type of currency to be transacted | "KES " |
PayerEmail | String | The email of the payer | "KES " |
RedirectUrl | String(URL) | The url given after a successful request | "https://**.io/4bdd-47d5-a54d " |
SuccessUrl | String(URL) | The url given after a successful post request | "https://**.io/4bdd-47d5-a54d " |
FailureUrl | String(URL) | The url given when a post request fails | "https://**.io/4bdd-47d5-a54d " |
SasaPayWalletEnabled | Boolean | This is enabled if the merchant wants the customer to pay via sasapay wallet. | "True " |
AirtelEnabled | Boolean | This is enabled if the merchant wants the customer to pay via Airtel money. | "True " |
CardEnabled | Boolean | This is enabled if the merchant wants the customer to pay via card. | "True " |
MpesaEnabled | Boolean | This is enabled if the merchant wants the customer to pay via mpesa. | "True " |
Sample post request
Headers
Key: Authorization
Value: Bearer cFJZcjZ6anEwaThMMXp6d1FETUxwWkIzeVBDa2hNc2M6UmYyMkJmWm9nMHFRR2xWOQ==
Body:{
"MerchantCode": "6**980",
"Amount": "2",
"Reference": "TestCard",
"Description": "Payment for goods",
"Currency": "KES",
"PayerEmail":"janedoe@email.com",
"CallbackUrl": "https://webhook.site/c61eb2ad-****-494b-****-2aab6aa56636",
"SuccessUrl": "https://www.google.com/",
"FailureUrl": "https://www.google.com/",
"SasaPayWalletEnabled": false,
"MpesaEnabled": false,
"CardEnabled": true,
"AirtelEnabled": false
}
Response Sample
Field | Type | Description | Example |
---|---|---|---|
status | Boolean | This is a boolean true or false status that indicates the outcome of the response. true means success and false means transaction failed or intermittent error occured. | true |
detail | String | A description of the response sent by SasaPay API. | Redirect the customer to the given checkout url |
PaymentGateway | String | Service provider that authorizes payments processing. | CARD_PAYMENT |
MerchantRequestID | String | unique identifier for a transaction between Merchant and SasaPay API. | 763df0f8-a815-40f5-b13f-cdb4632793e6 |
CheckoutRequestID | String | A unique identifier of the transaction request generated by SasaPay API. | 663df0f8-a815-40f5-b13f-cdb4632793e9 |
ResponseCode | String | A code identifying the type of response sent. 0 means success and any other code means the transaction failed. | 0 |
ResponseDescription | String | Details describing the response sent. | Success. Request accepted for processing |
CheckoutUrl | String | The checkout page url that is unique to the transaction. | https://****.sasapay.***/c5c17bb7-***-4f32-****-981b628bfbb1 |
Sample response
{
"status": true,
"detail": "Redirect the customer to the given checkout url",
"PaymentGateway": "SasaPay",
"MerchantRequestID": "0710******280",
"CheckoutRequestID": "b6cb451a-ef9f-443d-8e64-045c210131df",
"ResponseCode": "0",
"ResponseDescription": "Success. Request accepted for processing",
"CheckoutUrl": "https://****.sasapay.***/c5c17bb7-***-4f32-****-981b628bfbb1"
}
Callback Results
After the payment request is processed, the RESULTS are sent to the API which forwards these results to your system through the callback URL sent with the initial request.
Results Parameters
Field | Type | Description | Example |
---|---|---|---|
MerchantRequestID | String | The unique id sent with the transaction request from the Merchant system | "25*******77" |
CustomerMobile | String | This mobile number from where the funds are requested | "2547*******7" |
ResultCode | String | The numeric status of the results, sent to the callback url | 0 means success, while any other code indicates that an error occurred. The specific error is describe in the ResultDesc field |
ResultDesc | String | This is a message from the API that gives the status of the request processing and usually maps to a specific result code value. | "Transaction processed successfully." |
CheckoutRequestID | String | This is a unique SasaPay transaction ID for every payment request. Same value is sent to the customer over SMS upon successful processing. | "6f3ebd0d-b892-4c4e-952a-f3eea030af85" |
BillRefNumber | String | This is a unique SasaPay transaction ID for every payment request. Same value is sent to the customer over SMS upon successful processing. It is usually returned under the ResultParameter array. | PR52 |
TransAmount | String | This is the amount that was transacted. It is usually returned under the ResultParameter array. | "10.00" |
TransactionDate | String | This is the date and time that the transaction completed SasaPay. | "20220305103101" |
ThirdPartyTransID | String | This is the transaction refrence from third party systems SasaPay. |
Result sample
{
"TransactionCode" : "SPEJ****444",
"CustomerMobile" : "",
"ResultCode" : "0",
"CheckoutRequestID" : "c5c17bb7-4fa5-****-babc-981b6****bfbb1",
"MerchantRequestID" : "TESTCARDPAYMENT2",
"ThirdPartyTransID" : "16975**7874835",
"ResultDesc" : "Transaction processed successfully.",
"SourceChannel" : "LINK-PAYMENT",
"TransactionDate" : "20231017125922",
"TransAmount" : "10.00",
"BillRefNumber" : "TESTCARDPAYMENT2",
"PaymentRequestID" : "PR1234"
}