Skip to main content
Version: 1.0.1

Customer to Business (C2B)

Merchants can request payment from a customer either using customer mobile number or SasaPay alias number.

1. Make payment requests from your customer

Request by customer mobile number

In order to make a payment request using customer's mobile number, you need to make a POST call

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

Request Parameters

FieldTypeDescriptionExample
MerchantCodeNumericA unique number assigned to an organization/merchant registered with ViewTech, through which payment is received (can be Paybill or Till number)2****8
NetworkCodeNumericA unique five digit code used for identifying the various mobile money providers.SasaPay(0) 63902(MPesa) 63903(AirtelMoney) 63907(T-Kash)
PhoneNumberNumericThis is the phone number identifying a customer who is making the payment.07********8
TransactionDescStringAdditional information/comment that can be sent along with the request from your system“Payment for shopping”
AccountReferenceAlpha-NumericThis is an identifier of the payment request transaction.07*******23452
CurrencyStringStandardization that defines alpha codes and numeric codes for the representation of currenciesKES
AmountNumericThe amount of money to be requested from the customer.50.00
CallBackURLURLThis is the URL where SasaPay will send the results after the payment process is completed. This is provided when creating the application.https://pos******f7-b813
Request sample
Headers
Key: Authorization
Value: Bearer Q1k2RW5SOGlsYUZnRzNGMk1DNlE1T1gzemFtY
Body :
{
"MerchantCode": "9***0",
"NetworkCode": "0",
"PhoneNumber": "2547******280",
"TransactionDesc": "Pay for groceries",
"AccountReference": "07******0",
"Currency": "KES",
"Amount": 1,
"CallBackURL": "https://pos******f7-b813"
}

Response Parameters

FieldTypeDescriptionExample
statusBoolThis is a true or false status that indicates the status of the response. true means success and false means an error occurred or the request failed.Please refer to the response codes table above.true
**detailStringA description of the response status sent by SasaPay API.
PaymentGatewayStringService provider that authorizes payments processing“SasaPay”
MerchantRequestIDAlpha-NumericA unique identifier for a transaction between Merchant and SasaPay API."763df0f8-a815-40f5-b13f-cdb4632793e6"
CheckoutRequestIDAlpha-NumericA unique identifier of the transaction request"763df0f8-a815-40f5-b13f-cdb4632793e6"
ResponseCodeStringA code identifying the type of response sent. 0 eans success and any other code means the transaction failed.“0”
ResponseDescriptionStringDetails describing the response sent"Payment Request staged for processing successfully"
CustomerMessagestringThe message to show how the payment can be done manuallyGo to SasaPay App/USSD \n Select Paybill...
Response Sample
{
"status": true,
"detail": "OTP sent. Share the code to complete transaction",
"PaymentGateway": "SasaPay",
"MerchantRequestID": "07102440280",
"CheckoutRequestID": "b6cb451a-ef9f-443d-8e64-045c210131df",
"ResponseCode": "0",
"ResponseDescription": "Success. Request accepted for processing",
"CustomerMessage": "For manual payment Go to SasaPay App/USSD \n Select Paybill \nEnter Business number 94000\n Enter account Number 07102440280\nEnter Amount 1Enter M-pesa pin"
}

Request by customer alias number

In order to make a payment request using customer's alias number, you need to make a POST call

Alt test Endpoint: https://sandbox.sasapay.app/api/v1/payments/request-payment-by-alias/

Request Parameters

FieldTypeDescriptionExample
MerchantCodeNumericA unique number assigned to an organization/merchant registered with ViewTech, through which payment is received (can be Paybill or Till number)2****8
AliasNumberNumericThis is the unique number identifying a customer who is making the payment. It is assigned to a customer when they register with SasaPay7***8
AccountReferenceAlpha-NumericThis is an identifier of the payment request transaction.07*******23452
TransactionDescStringAdditional information/comment that can be sent along with the request from your system“Payment for shopping”
AmountNumericThe amount of money to be requested from the customer.50.00
CurrencyStringStandardization that defines alpha codes and numeric codes for the representation of currenciesKES
TransactionFeeNumericThis the amount charged as the transaction fee for request payment.0
CallBackURLURLThis is the URL where SasaPay will send the results after the payment process is completed. This is provided when creating the application.https://po******dd-47d5-a54d
Request sample
Headers
Key: Authorization
Value: Bearer Q1k2RW5SOGlsYUZnRzNGMk1DNlE1T1gzemFtY
Body:
{
"MerchantCode": "9***0",
"AliasNumber": "1**0",
"TransactionDesc": "Pay for groceries",
"AccountReference": "1102541",
"Currency": "KES",
"Amount": 10.00,
"TransactionFee":0,
"CallBackURL": "https://po******dd-47d5-a54d"
}

Response Parameters

FieldTypeDescriptionExample
statusBoolThis is a true or false status that indicates the status of the response. true means success and false means an error occurred or the request failed.Please refer to the response codes table above.true
detailStringA description of the response status sent by SasaPay API."OTP sent. Share the code to complete transaction"
PaymentGatewayStringService provider that authorizes payments processing“SasaPay”
MerchantRequestIDAlpha-NumericA unique identifier for a transaction between Merchant and SasaPay API."763df0f8-a815-40f5-b13f-cdb4632793e6"
CheckoutRequestIDAlpha-NumericA unique identifier of the transaction request"763df0f8-a815-40f5-b13f-cdb4632793e6"
ResponseCodeStringA code identifying the type of response sent. 0 eans success and any other code means the transaction failed.“0”
ResponseDescriptionStringDetails describing the response sent"Payment Request staged for processing successfully"
CustomerMessagestringThe message to show how the payment can be done manuallyOTP sent. Share the code to complete transaction
Response Sample
{
"status": true,
"detail": "OTP sent. Share the code to complete transaction",
"PaymentGateway": "SasaPay",
"MerchantRequestID": "1102541",
"CheckoutRequestID": "40d16ff2-60f4-4dff-ae99-a681d0324876",
"ResponseCode": "0",
"ResponseDescription": "Success. Request accepted for processing",
"CustomerMessage": "OTP sent. Share the code to complete transaction"
}

2. Process Payment

After the payment request you will need to process the transaction by making a POST call to the following endpoint:

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

FieldTypeDescriptionExample
MerchantCodeStringA unique number assigned to an organization/merchant registered with ViewTech, through which payment is received (can be Paybill or Till number)60**80
CheckoutRequestIDAlpha-NumericA unique identifier of the transaction request.763df0f8-a815-40f5-b13f-cdb4632793e6
VerificationCodeStringThis is a 6 digit code sent to a mobile number making payment. This is the code the authorizes processing of the transaction.123456
Sample Request
Headers
Key: Authorization
Value: Bearer Q1k2RW5SOGlsYUZnRzNGMk1DNlE1T1gzemFtY
Body:
{
"CheckoutRequestID": "5fb0db20-2550-4612-bb7d-71bf0a4e25f6",
"MerchantCode": "600980",
"VerificationCode": "525474"
}

Response Parameters

FieldTypeDescriptionExample
statusBoolThis is a true or false status that indicates the status of the response. true means success and false means an error occurred or the request failed.Please refer to the response codes table above.true
detailNumericThis is the message from the API describing the status of the transaction."Transaction submitted for processing"
Response Sample
{
"status": true,
"detail": "Transaction is being processed"
}

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
MerchantRequestIDDecimalThe unique id sent with the transaction request from the Merchant system"25*******77"
CustomerMobileStringThis mobile number from where the funds are requested"2547*******7"
ResultCodeNumericThe 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"
BillRefNumberJSON ObjectThis 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
TransAmountNumberThis 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"
Result sample
{
"MerchantRequestID": "25472****77",
"CheckoutRequestID": "3a412fbd-73d2-49a3-9091-b65e51a5e9b5",
"ResultCode": 0,
"ResultDesc": "Transaction processed successfully.",
"TransAmount": "2.00",
"BillRefNumber": "25472****77",
"TransactionDate": "20220309081002",
"CustomerMobile": "254715****344"
}