Skip to main content

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.

Alt test Endpoint: https://sandbox.sasapay.app/api/v1/payments/card-payments/

Request Parameters

FieldTypeDescriptionExamples
MerchantCodeStringA unique number assigned to an organization/merchant registered with ViewTech, through which payment is received (can be Paybill or Till number)"2*****8"
AmountStringAmount to be paid to the requester's accountKES 300000.00
ReferenceStringA unique reference for the transaction"1234abc"
DescriptionStringThe reason for payment."True "
CurrencyStringThe type of currency to be transacted"KES "
PayerEmailStringThe email of the payer"KES "
RedirectUrlString(URL)The url given after a successful request"https://**.io/4bdd-47d5-a54d "
SuccessUrlString(URL)The url given after a successful post request"https://**.io/4bdd-47d5-a54d "
FailureUrlString(URL)The url given when a post request fails"https://**.io/4bdd-47d5-a54d "
SasaPayWalletEnabledBooleanThis is enabled if the merchant wants the customer to pay via sasapay wallet."True "
AirtelEnabledBooleanThis is enabled if the merchant wants the customer to pay via Airtel money."True "
CardEnabledBooleanThis is enabled if the merchant wants the customer to pay via card."True "
MpesaEnabledBooleanThis 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

FieldTypeDescriptionExample
statusBooleanThis 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
detailStringA description of the response sent by SasaPay API.Redirect the customer to the given checkout url
PaymentGatewayStringService provider that authorizes payments processing.CARD_PAYMENT
MerchantRequestIDStringunique identifier for a transaction between Merchant and SasaPay API.763df0f8-a815-40f5-b13f-cdb4632793e6
CheckoutRequestIDStringA unique identifier of the transaction request generated by SasaPay API.663df0f8-a815-40f5-b13f-cdb4632793e9
ResponseCodeStringA code identifying the type of response sent. 0 means success and any other code means the transaction failed.0
ResponseDescriptionStringDetails describing the response sent.Success. Request accepted for processing
CheckoutUrlStringThe 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

FieldTypeDescriptionExample
MerchantRequestIDStringThe unique id sent with the transaction request from the Merchant system"25*******77"
CustomerMobileStringThis mobile number from where the funds are requested"2547*******7"
ResultCodeStringThe numeric status of the results, sent to the callback url0 means success, while any other code indicates that an error occurred. The specific error is describe in the ResultDesc field
ResultDescStringThis 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."
CheckoutRequestIDStringThis 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"
BillRefNumberStringThis 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
TransAmountStringThis is the amount that was transacted. It is usually returned under the ResultParameter array."10.00"
TransactionDateStringThis is the date and time that the transaction completed SasaPay."20220305103101"
ThirdPartyTransIDStringThis 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"
}