Merchant Server Implementation

Sample Project to implement Merchant Server.



SDK Changes on Merchant Server


There are some changes required on merchant server to make use of the latest SDK.

  • For version 1.0.x SDK needs merchant server to redirect the request to /pay in Snap endpoint.
  • For version 1.1.x and above SDK needs merchant server to redirect the request to /transactions in Snap endpoint.

Merchants need to implement the following web services for SDK to work correctly. Note the below points, accept and return Content-Type JSON

  • Content-Type: application/json
  • Accept: application/json



Mandatory


  • Create Token (Checkout) : This API proxies the request to Snap Backend. This process generates the token necessary for the secure communication between Mobile SDK and Midtrans.



Optional


We also additionally call a few endpoints if 1-Click or 2-Clicks is enabled :

  • To Store Credit Card Tokens: We explicitly invoke POST on /users/<userid>/tokens to allow the backend to store generated credit card token after a successful Credit card charge.
  • To Retrieve Credit card Tokens : We explicitly invoke GET GET /users/<user_id>/tokens to retrieve saved card list.

The UserId refers to a generated UUID to associate card collection to each unique user. The mobile SDK generates this UUID during the initialization.