Simpl Pay in 3: API Integration Sequence Diagram 2 API Integration Explanation 3 API Specifications 4
Simpl Pay in 3: API Integration Sequence Diagram 2 API Integration Explanation 3 API Specifications 4
Table of Contents
API Specifications 4
Initiate Transaction API 4
Transaction Status Redirection 10
Signature Verification 12
Transaction Status Update Via Webhook 14
Transaction Status API 14
Data Sharing API 17
Transaction Refund API 20
API Integration sequence diagram
API Integration Explanation
Step1: During checkout, the merchant calls the Initiate Transaction API with order details, user
details and the transaction_status_redirection_url (Used in step3)
Step 2: Simpl responds with a redirection_url which the merchant should launch in the browser
in order for the user to carry out the transaction with Simpl.
Step 3: Once the user goes through Simpl’s transaction flow, the status of the transaction is
passed to the Merchant by launching the transaction_status_redirection_url passed in step1
Step 4: If the transaction succeeded, the merchant verifies the transaction status by calling the
Transaction Status API. Merchant can skip this API call if the transaction fails.
Step 5: Merchant records the transaction status and fulfills or cancels the order depending on
the status.
This API needs to be initiated on load of product display page and checkout page. Data fetched
on these pages feeds our approval and underwriting models. It also helps Simpl to calibrate the
credit limit of the user as per their transaction indicators.This eventually leads to higher
transaction success rates.
API Specifications
This API responds with a redirection_url upon successful initiation. The merchant app should
then redirect the user to the redirection_url to complete the transaction.
Please note that this API should never be called from the client, doing so would expose the
authorization secret which could result in misuse and financial loss.
URL: https://sandbox-splitpay-api.getsimpl.com/api/v1/transaction/initiate
Request Headers:
content_type application/json
{
"merchant_client_id": "fab4d7f9-ab58-4805-aa3b-b0d3fd7b988e",
"transaction_status_redirection_url":
"https://merchant-website.com/simpl/transactions/status",
"transaction_status_webhook_url":
"https://merchant-website.com/simpl/transactions_webhook/status",
"user": {
"phone_number": "0000000000",
"email": "[email protected]",
"first_name": "",
"last_name": ""
},
"order_id": "BKS-5397",
"amount_in_paise": 500000,
"discount_in_paise": 3500,
"shipping_amount_in_paise": 3300,
"items": [
{
"sku": "Tea",
"category": "Food",
"description": "Green Tea",
"quantity": 5,
"rate_per_item": 1200
}
],
"device_params": {
"manufacturer": "OnePlus",
"model": "OnePlus6",
"rooted": true,
"android_id": "92184bf0a60baf71",
"ip_address": "13.235.154.11",
"lat_lng": "0.0,0.0"
"custom_param_1": "value_1",
"custom_param_2": "value_2"
},
"merchant_params": {
"customer_id": "Some unique ID",
"inventory_partner": {
"ip_id": "Some unique ID",
"ip_name": "Abc xyz",
"ip_phone_number": "7865432109",
"ip_email": "[email protected]",
"ip_address": "Block A, street 4, Bangalore"
},
"service_partner": {
"sp_id": "Some unique ID",
"sp_name": "Abc xyz",
"sp_phone_number": "7865432109",
"sp_address": "Block A, street 4, Bangalore"
}
},
"billing_address": {
"line1": "811, Crescent Business Park",
"line2": "Near Telephone exchange",
"city": "Bangalore",
"state": "Karnataka",
"country": "India",
"pincode": "560001"
},
"shipping_address": {
"line1": "811, Crescent Business Park",
"line2": "Near Telephone exchange",
"city": "Bangalore",
"state": "Karnataka",
"country": "India",
"pincode": "560001"
},
"metadata": {
"delivery_type": "express",
"custom_param_1": "value",
"custom_param_2": "value"
}
}
Response Codes
{
"success": true,
"data": {
"redirection_url":
"https://sandbox-splitpay.getsimpl.com/pay?token=b6a98535185823416e1dc717c5d5379e"
}
}
Error Codes
{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "amount_in_paise value is missing"
}
}
https://merchant-website.com/simpl/transactions/status?status=SUCCESS&order_id=AES12
34&transaction_id=9506244d-3f5e-4eea-b07e-f40087da36f7&nonce=18722057ed9da49f90
28c8d62f3ece69&signature=c1b09e56458dfc65ced6eeb0050005f08daef48a&signature_alg
orithm=HMAC-SHA1
https://merchant-website.com/simpl/transactions/status?status=FAILED&error_code=USER
_CANCELLED&order_id=AES1234&nonce=18722057ed9da49f9028c8d62f3ece69&signatu
re=c1b09e56458dfc65ced6eeb0050005f08daef48a&signature_algorithm=HMAC-SHA1
Error Codes
Signature Verification
The signature that is passed along with the status response must be verified before acting on
the status. The value of the signature (HMAC signature) parameter in the
transaction_status_redirection_url is computed using the algorithm specified by the
signature_algorithm (HMAC-SHA1) parameter .
Example
status=SUCCESS
order_id=AES&1234
transaction_id=9506244d-3f5e-4eea-b07e-f40087da36f7
nonce=18722057ed9da49f9028c8d62f3ece69
signature=c1b09e56458dfc65ced6eeb0050005f08daef48a
signature_algorithm=HMAC-SHA1
2. Except for signature and signature_algorithm, all the other parameters are used for
computing the signature.
Example
status=SUCCESS
order_id=AES&1234
transaction_id=9506244d-3f5e-4eea-b07e-f40087da36f7
nonce=18722057ed9da49f9028c8d62f3ece69
3. Percentage encode each key and value pair if they are decoded by the server. You can
skip this step if the key/value params are already Percent-encoded.
Example
Status
SUCCESS
Order_id
AES1234%26
Transaction_id
9506244d-3f5e-4eea-b07e-f40087da36f7
nonce
18722057ed9da49f9028c8d62f3ece69
Note the value of order_id has changed after encoding
4. Sort the parameters alphabetically (ASCII based sort) by the encoded key
Example
nonce
18722057ed9da49f9028c8d62f3ece69
order_id
AES1234%26
status
SUCCESS
transaction_id
9506244d-3f5e-4eea-b07e-f40087da36f7
5. Combine the key/value pair in sorted order and use the resulting string to compute the
HMAC signature
Example
nonce=18722057ed9da49f9028c8d62f3ece69&order_id=AES1234%26&status
=SUCCESS&transaction_id=9506244d-3f5e-4eea-b07e-f40087da36f7
6. The HMAC of the string can be calculated using the merchant_client_secret (secret
key) shared during the onboarding of the merchant. Simpl uses HMAC-SHA1 to
generate the signature.
Example
HMAC(
“sha1”, // cryptographic hash function used in the calculation of an HMAC
“Merchant_client_secret”, // secret key
“nonce=18722057ed9da49f9028c8d62f3ece69&order_id=AES1234%26&status
=SUCCESS&transaction_id=9506244d-3f5e-4eea-b07e-f40087da36f7” // message
)
Generated signature
c1b09e56458dfc65ced6eeb0050005f08daef48a
7. Compare the generated signature with the signature received in the status callback to
verify it.
Transaction Status Update Via Webhook
Optionally, the status of the transaction will also be sent to the merchant via a server-to-server
call right before the session expiry (30mins) to capture any missed status updates. This
functionality is enabled as soon as transaction_status_webhook_url param is passed during
the Initiate Transaction API call.
Please note that the webhook call will be triggered even if the status is previously updated via
status redirection url. Hence make sure to implement this in an idempotent way.
GET
https://<transaction_status_webhook_url>?status=SUCCESS&order_id=AES1234&transact
ion_id=9506244d-3f5e-4eea-b07e-f40087da36f7&nonce=18722057ed9da49f9028c8d62f3ec
e69&signature=c1b09e56458dfc65ced6eeb0050005f08daef48a&signature_algorithm=HM
AC-SHA1
GET
https://<transaction_status_webhook_url>?status=FAILED&error_code=USER_CANCELLE
D&order_id=AES1234&nonce=18722057ed9da49f9028c8d62f3ece69&signature=c1b09e5
6458dfc65ced6eeb0050005f08daef48a&signature_algorithm=HMAC-SHA1
The payload, error code and signature verification mechanism is same as the Transaction
Status Redirection section.
The Transaction Status API is used to verify the status of the transaction post transaction status
redirection from Simpl. This API should be called by the merchant when the status is SUCCESS
in transaction_status_redirection_url. For FAILED transactions, this API call can be skipped.
Please note that this API should never be called from the client, doing so would expose the
authorization secret which could result in misuse and financial loss.
URL:
https://sandbox-splitpay-api.getsimpl.com/api/v1/transaction_by_order_id/<order_id>/status
Request Headers:
Request Parameters:
Note that the order_id is passed in the url as a path parameter. order_id is the Merchant’s
order id that is passed to Simpl during Initiate Transaction API call.
Response Codes
{
"success": true,
"data": {
"id": "58992c70-2fa9-4293-bfb7-1ee7bd554a15",
"status": "SUCCESS",
"amount_in_paise": 20000
}
}
Error Codes
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Unauthorized"
}
}
Data Sharing API
This API ensures data-sharing between Simpl and merchant. On a high level, we expect
following data to be shared (formats mentioned in API detail):
1. User Data
2. Device data
3. Product/SKU/Order Data
This API needs to be initiated on load of product display page and checkout page. Data fetched
on these pages feeds our approval and underwriting models. It also helps Simpl to calibrate the
credit limit of the user as per their transaction indicators.
Please note that this API should never be called from the client, doing so would expose the
authorization secret which could result in misuse and financial loss.
URL: https://sync-data-sandbox.getsimpl.com/api/v1/merchants
Request Headers:
Please note that the below parameters represent the minimal base structure of the request
payload. Additional attributes specific to User, Order and Merchant has to be passed along with
this information as per the business agreement. Please refer to the example to see how
additional parameters would be passed.
{
"merchant_name": "merchant",
"user": {
"customer_id": "58932c70-2fa9-4293-bfb7-1ee7bd554a15",
"phone": "2222222222",
"first_name": "FName",
"last_name": "LName",
"email": "[email protected]",
"gender": "female",
"first_transaction_date": "2021-01-01T00:00:00"
},
"order": {
"order_id": "BKS-5397",
"order_description": "Shoes, Dresses",
"final_order_value": "100.00",
"payment_mode": "Card",
"loyalty_points_value": "85",
"discount_value": "25",
"timestamp": "2021-01-05T13:00:00",
"address_line1": "811, Crescent Business Park",
"address_line2": "Near Telephone exchange",
"city": "Bangalore",
"pin": "560001",
"status": "SUCCESS",
"platform": "MOBILE",
"os": "ANDROID"
},
"merchant_params": {
"loyalty_score": "55",
"fraud_score": "0.2"
}
}
Response Codes
Response Status Code Description
{
"success": true,
"data": {
"message": "OK!"
}
}
{
"success": false,
"data": {
"message": "INVALID_DATA_FORMAT"
}
}
Please note that this API should never be called from the client, doing so would expose the
authorization secret which could result in misuse and financial loss.
URL: https://sandbox-splitpay-api.getsimpl.com/api/v1/transaction/refund
Request Headers:
Key Value Comments
content_type application/json
{
"merchant_client_id": "fab4d7f9-ab58-4805-aa3b-b0d3fd7b988e",
"amount_in_paise": 500000,
"transaction_id": "e9a4c7e9-ab58-4805-aa3b-b0d3fd7b988e",
"reason": "Failed to deliver on time",
"order_id": "BKS-5397"
}
Response Codes
{
"success": true,
"data": {
"transaction_id": "e9a4c7e9-ab58-4805-aa3b-b0d3fd7b988e",
"refund_transaction_id": "526097c8-0c25-4d51-a80c-64fab3e311e6"
}
}
Error Codes
{
"success": false,
"error": {
"code": "BAD_REQUEST",
"message": "Amount value is missing"
}
}