You can leverage Paytm’s best in class Payment Gateway in your Mini Program. For the same we leverage the App Invoke Flow
The flow for the same works like this:
- User adds items to your cart and clicks on Proceeds to Pay
- User is then shown a popout of Paytm PG right within Paytm App, where all configured payment modes are visible.
- User completes payment and is landed back seamlessly to your Mini Program.
Once the user has clicked the pay button the merchant app backend server should call the Initiate Transaction APINote: callbackUrl in Initiate Transaction API is mandatory in case of Mini Programs PG flow. Merchant during Initiate Transaction API can either use the default callbackURL(https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=#OrderId# where #OrderId# is actual OrderId used for initating transaction) or pass their custom URL . Please ensure that the custom URL should not throw any network error and should be secured by SSL layer.
The checksum parameter to be passed during the Initiate Transaction call can be created using the Paytm checksum library
The merchant app server will get a Transaction Token from Paytm server.
Third-party apps need to call the payment JS API with the required following payload.
amount : Amount to be charged/deducted from the user
orderId : Generated by the Merchant app server
txnToken : The merchant app server gets this token from PG backend
mid : Unique MID provided by Paytm
Paytm processes the transaction with the user’s bank and returns transaction response to your App.
You call the Transaction Status API to verify the transaction response
Notify the payment status to user and proceed with the order/service fulfilment.