Você está na página 1de 17

Snapmint Merchant Integration Document

Version 4.01
31st January, 2019
By Nalin Agrawal (nalin@snapmint.com)

1 Implement the integration 2


1.1 Test and production dashboards 2
1.2 Host for submission of post requests 2
1.3 Integration of Javascript 2
1.4 Integration of Payment form (POST Method) 2
1.4.1 Form field descriptions 4
1.4.2 Generating checksum 7
1.5 Response 8
1.5.1 Confirming Checksum Response 8

2. Post Checkout flow for authorizing orders 9


2.1 Getting Authorized orders that can be captured for inventory check and shipment 9
2.1.1 GET URL for Test/Production 9
2.1.2 Success/Failure response of the API 9
2.2.1 GET URL for Test/Production 10
2.2.2 Success/Failure response of the API 10
2.3.1 GET URL for Test/Production 11
2.3.2 Success/Failure response of the API 12
2.4 Check Pre Approved Limit 12
2.4.1 GET URL for Test/Production 12
2.4.2 Success/Failure response of the API 13
2.5 Order Status 13
2.5.1 GET URL for Test/Production 13
2.5.2 Success/Failure response of the API 14
2.6 Get and Sign Agreement 15
2.6.1 GET URL for Test/Production 15
2.6.2 Success/Failure response of the API 15
2.6.3 GET URL for Test/Production 16
2.6.4 Success/Failure response of the API 16

1. Website integration
1 Implement the integration

1.1 Test and production dashboards

Environment POST URL

Testing https://sandbox.snapmint.com/merchants/sign_in

Live/ Production https://console.snapmint.com/merchants/sign_in

1.2 Host for submission of post requests

When user selects Snapmint as payment options, the url should be redirected to the following
url along with the POST parameters mentioned in section 1.4
Environment POST URL

Testing https://sandboxapi.snapmint.com/v1/public/online_checkout

Live/ Production https://api.snapmint.com/v1/public/online_checkout

1.3 Integration of Javascript

· Please go to your production or testing environment. The javascript code for testing and
production environment are the same.
You will be able to access the Javascript at :
https://console.snapmint.com/merchants/my_account
· Copy the Javascript code and place it on all the pages of the website where you would
like to communicate EMI pricing to the customer
· Javascript can be modified after a consultation with your team

1.4 Integration of Payment form (POST Method)


The following is the form with all the fields that enables a buyer to make a payment. The
compulsory fields are marked in the value.
Please replace the value by actual values. If you do not wish to send Optional fields
replace them by blank (“”)
<form id="snapmint" name="snapmint" method="post"
action="https://sandboxapi.snapmint.com/v1/public/online_checkout">
<!--Setup-->
<input type="hidden" name=merchant_key” value="Compulsory"/>
<input type="hidden" name=merchant_confirmation_url” value="Compulsory"/>
<input type="hidden" name=merchant_failure_url” value="Compulsory"/>
<input type="hidden" name=checksum_hash” value="Compulsory"/>
<!--Setup End-->

<!--Order Details-->
<input type="hidden" name=shipping_fees” value="Optional"/>
<input type="hidden" name=discount_code” value="Optional"/>
<input type="hidden" name=order_id” value="Compulsory"/>
<input type="hidden" name=order_value” value="Compulsory"/>

<input type="hidden" name=udf1” value="Optional"/>


<input type="hidden" name=udf2” value="Optional"/>
<input type="hidden" name=udf3” value="Optional"/>
<!--Order Details End-->

<!--User Details-->
<!--Basic Details-->
<input type="hidden" name=full_name” value="Compulsory"/>
<input type="hidden" name=email” value="Compulsory"/>
<input type="hidden" name=mobile” value="Compulsory"/>

<!--shipping address-->
<input type="hidden" name="shipping_full_name” value="Compulsory"/>
<input type="hidden" name="shipping_address_line1” value="Compulsory"/>
<input type="hidden" name="shipping_address_line2” value="Compulsory"/>
<input type="hidden" name="shipping_city” value="Compulsory"/>
<input type="hidden" name="shipping_zip” value="Compulsory"/>

<!--billing address-->
<input type="hidden" name="billing_full_name” value="Compulsory"/>
<input type="hidden" name="billing_address_line1” value="Compulsory"/>
<input type="hidden" name="billing_address_line2” value="Compulsory"/>
<input type="hidden" name="billing_city” value="Compulsory"/>
<input type="hidden" name="billing_zip” value="Compulsory"/>
<!--User details End-->

<!--Product details-->
<!--Product 1-->
<input type="hidden" name="products[][sku]" value="Compulsory"/>
<input type="hidden" name="products[][name]" value=" Compulsory"/>
<input type="hidden" name="products[][quantity]" value="Compulsory"/>
<input type="hidden" name="products[][item_url]" value="Optional"/>
<input type="hidden" name="products[][unit_price]" value="Compulsory"/>
<input type="hidden" name="products[][udf1]" value="Optional"/>
<input type="hidden" name="products[][udf2]" value="Optional"/>
<input type="hidden" name="products[][udf3]" value="Optional"/>
<!--Product 2-->
<input type="hidden" name="products[][sku]" value="Compulsory"/>
<input type="hidden" name="products[][name]" value="Compulsory"/
<input type="hidden" name="products[][quantity]" value="Compulsory"/>
<input type="hidden" name="products[][item_url]" value="Optional"/>
<input type="hidden" name="products[][unit_price]" value="Compulsory"/>
<input type="hidden" name="products[][udf1]" value="Optional"/>
<input type="hidden" name="products[][udf2]" value="Optional"/>
<input type="hidden" name="products[][udf3]" value="Optional"/>
<!--Product details End-->

<!-- User Transaction Details →

<input type="hidden" name="prev_transactions_count" value="Optional"/>


<input type="hidden" name="total_transactions_count" value="Optional"/>
<input type="hidden" name="avg_transaction_value" value="Optional"/>
<input type="hidden" name="digital_mode_transactions_count" value="Optional"/>

<!-- User Transaction Details End-->

<input type="submit" value="Make Payment"/>


</form>

** In the merchant initiated POST request, one of the mandatory parameters is the checksum
hash, mentioned in the section later. It is extremely critical for the merchant to calculate this
hash correctly before sending the request to Snapmint servers. The details for the same are in
section 2.1.4.2

1.4.1 Form field descriptions

Object type Object Object Object limitations


Description

Setup merchant_key Compulsory Your Merchant key as in your


account

Setup merchant_confirmation_url Compulsory Your confirmation URL

Setup merchant_failure_url Compulsory Your payment failure URL

Order Details checksum_hash Compulsory Please see section 2.1.4.2

Order Details shipping_fees Optional Shipping amount in float

Order Details discount_code Optional Alphanumeric value with max


length 25 characters
Order Details order_id Compulsory Alphanumeric value with max
length 16 characters

Order Details order_value Compulsory Order value after all discounts and
taxes in float

Order Details udf1 Optional User defined function,


alphanumeric with max length 50

Order Details udf2 Optional User defined function,


alphanumeric with max length 50

Order Details udf3 Optional User defined function,


alphanumeric with max length 50

User Details first_name Optional Only Alphabetical characters with


max length 15

User Details middle_name Optional Only Alphabetical characters with


max length 15

User Details last_name Optional Only Alphabetical characters with


max length 15

User Details full_name Compulsory Only Alphabetical characters or


“space” with max length 50

User Details email Compulsory EmailID

User Details mobile Compulsory Phone number

Shipping Details shipping_first_name Optional Only Alphabetical characters with


max length 15

Shipping Details shipping_last_name Optional Only Alphabetical characters with


max length 15

Shipping Details shipping_middle_name Optional Only Alphabetical characters with


max length 15

Shipping Details shipping_full_name Compulsory Only Alphabetical characters or


“space” with max length 50

Shipping Details shipping_address_line1 Compulsory String with max length 255


Shipping Details shipping_address_line2 Optional String with max length 255

Shipping Details shipping_city Optional Alphabetical with max length 25

Shipping Details shipping_zip Compulsory String with max length 6

Billing Details billing_first_name Optional Only Alphabetical characters with


max length 15

Billing Details billing_last_name Optional Only Alphabetical characters with


max length 15

Billing Details billing_middle_name Optional Only Alphabetical characters with


max length 15

Billing Details billing_full_name Compulsory Only Alphabetical characters or


“space” with max length 50

Billing Details billing_address_line1 Compulsory String with max length 255

Billing Details billing_address_line2 Optional String with max length 255

Billing Details billing_city Optional Alphabetical with max length 25

Billing Details billing_zip Compulsory String with max length 6

Product 1 products[][sku] Compulsory String with max length 255

Product 1 products[][name] Optional String with max length 255

Product 1 products[][quantity] Compulsory Integer

Product 1 products[][item_url] Optional String with max length 255

Product 1 products[][unit_price] Compulsory Float

Product 1 products[][udf1] Optional String with max length 255

Product 1 products[][udf2] Optional String with max length 255

Product 1 products[][udf3] Optional String with max length 255


Product 2 products[][sku] Optional String with max length 255

Product 2 products[][name] Optional String with max length 255

Product 2 products[][quantity] Optional Integer

Product 2 products[][item_url] Optional String with max length 255

Product 2 products[][unit_price] Optional Float

Product 2 products[][udf1] Optional String with max length 255

Product 2 products[][udf2] Optional String with max length 255

Product 2 products[][udf3] Optional String with max length 255

User Previous prev_transactions_count Optional Integer


Transaction
count

User total total_transactions_count Optional Integer


transaction
count

User average avg_transaction_value Optional Integer


transaction
value

User Digital digital_mode_transactions_co Optional Integer


mode transction unt
count

** Please add all the products in the cart. We verify the total order value with quantity and unit
price of the product for processing the loan application

1.4.2 Generating checksum

To generate the checksum hash:


SHA512 of following string: merchant_key|order_id|order_value|full_name|email|token
Testing
You will be able to access the merchant key and token for testing on your
dashboard at:
https://sandbox.snapmint.com/merchants/my_account
Production
You will be able to access the merchant key and token for testing on your
dashboard at:
https://console.snapmint.com/merchants/my_account

1.5 Response

The following response parameters are posted from Snapmint to Merchant

Object type Object Object limitations

Setup merchant_id Your ID as in your account

Order Details checksum_hash Please see section 2.1.5.1

Order Details snapmint_id Alphanumeric value with max length 16


characters

Order Details order_id Alphanumeric value with max length 16


characters

Order Details order_value Order value after all discounts and taxes in float

User Details email EmailID

User Details mobile Phone number

Loan Details bank_name Name of the lender

Loan Details purchase_amount Purchase amount

Loan Details subvention_fees Subvention

Status status Status of the loan application

Message message Any message particularly in case of errors

1.5.1 Confirming Checksum Response


The checksum response posted back to the merchant is a
SHA512 hash of: token|email|full_name|order_value|order_id|merchant_key
2. Post Checkout flow for authorizing
orders

This section describes the API's which we use for integration when any application is in
authorized state and which can be further processed for merchant inventory check and
shipment of the product to the end customer.

2.1 Getting Authorized orders that can be captured for


inventory check and shipment

2.1.1 GET URL for Test/Production


Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/getAuthorizedOrders?token=
merchant_token

Live/ Production http://snapmint.com/api/orders/getAuthorizedOrders?token=merchant


_token

2.1.2 Success/Failure response of the API

Success API Response


status": "success",
"orders": [
{
"order_id": "145000894",
"loan_serial": "001CD00001682APP",
"snapmint_id": 1682,
"emi_amount": 2280,
"tenure": 9,
"down_payment_amt": 4900,
"processing_fees": 500,
"down_payment_status": "none",
"emi_starts_from": "2017-01-10T17:30:00.000+05:30",
"created_at": "2016-12-12T10:44:15.000+05:30"
}

Failure API Response

"status": "Error",
"message": "Unauthorized or Incorrect parameters"

2.2 Capture Authorized orders if they are ready for shipment

2.2.1 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/captureOrder?token=mercha
nt_token

Live/ Production http://snapmint.com/api/orders/captureOrder?token=merchant_token

2.2.2 Success/Failure response of the API


Success API Response

{ "status": "success",
"order_id": "145000926",
"loan_serial": "004CD00002497APP",
"snapmint_id": 2497,
"order_status": "Captured",
"order_value": 22568,
"lender_name": "AU bank Ltd.",
"emi_amount": 2628,
"tenure": 6,
"down_payment_amt": 6800,
"processing_fees": 343,
"down_payment_status": "none",
"emi_starts_from": "2017-03-10T17:30:00.000+05:30",
"created_at": "2017-02-15T18:18:10.000+05:30"
}

Failure API Response

"status": "Error",
"message": "Please pass the order Id/ Multiple authorized orders with same Order ID "

2.3 Cancel existing orders

2.3.1 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/voidOrder?token=merchant_
token

Live/ Production http://snapmint.com/api/orders/voidOrder?token=merchant_token


2.3.2 Success/Failure response of the API
Success API Response

{
"status": "success",
"order_status": "Cancelled",
"order_id": "145000926",
"loan_serial": "004CD00002497APP",
"snapmint_id": 2497
}

Failure API Response

{
"status": "Error",
"message": "Order does not exist or order cannot be cancelled at this time/ Unauthorized or
Incorrect parameters "
}

2.4 Check Pre Approved Limit

2.4.1 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/check_preapproved_limit?mo
bile=1234567890&token=merchant_token

Live/ Production http://snapmint.com/api/orders/check_preapproved_limit?mobile=123


4567890&token=merchant_token
2.4.2 Success/Failure response of the API
Success API Response

{
"status": "success",
"is_pre_approved": True/False,
"pre_approved_limit": 2497
}

Failure API Response

{
"status": "Error",
"message": "User does not exist."
}

2.5 Order Status

2.5.1 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/getOrderStatus?order_id=123
45&token=merchant_token

Live/ Production http://snapmint.com/api/orders/getOrderStatus?order_id=12345&toke


n=merchant_token
2.5.2 Success/Failure response of the API
Success API Response

{
"status": "Success",
"order_id": "abc12345"
"loan_serial": "100CD00023974APP",
"order_status": "authorized"
"snapmint_id": "123456",
"emi_amount": "12345"
"tenure": "3",
"down_payment_amt": "10000"
"processing_fees": "100",
"down_payment_status": "success"
"emi_starts_from": "Sun, 10 Mar 2019 12:00:00 UTC +00:00",
"cashback": "100",
"created_at": "Sun, 10 Mar 2019 12:00:00 UTC +00:00"
}

Failure API Response

{
"status": "Error",
"message": "Order does not exist/ Please pass order id"
}
2.6 Get and Sign Agreement
This API is only relevant for merchants where ticket sizes exceed 1L and they use their own
platforms for completing the transactions.

2.6.1 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/get_agreement?loan_id=123
45&token=merchant_token

Live/ Production http://snapmint.com/api/orders/get_agreement?loan_id=12345&token


=merchant_token

2.6.2 Success/Failure response of the API


Success API Response

Sends a pdf file

Failure API Response

{
"status": "Error",
"message": "Incorrect Loan Id"
}
2.6.3 GET URL for Test/Production

Environment GET URL

Testing http://sandbox.snapmint.com/api/orders/signed_agreement?loan_id=1
2345&merchant_user_id=123&ip_address=xxx.xxx.xxx.xxx&domain=
www.domain.com&token=merchant_token

Live/ Production http://snapmint.com/api/orders/signed_agreement?loan_id=12345&m


erchant_user_id=123&ip_address=xxx.xxx.xxx.xxx&domain=www.do
main.com&token=merchant_token

2.6.4 Success/Failure response of the API

Success API Response

Sends a pdf file

Failure API Response

{
"status": "Error",
"message": "Incorrect Loan Id"
}

Você também pode gostar