Technical flow - Prepaid Payments

  1. The user selects a product, confirms the booking and clicks on PAY in the Switch App .

  2. Switch server hits the PhonePe server sending order details like merchantId, transactionId, OrderId, transactionContext, cartDetails and redirectionURL as described in the PhonePe initiate Transaction Request() API.

transactionContext takes trackingInfo as input which is used on the PhonePe APP to take a user to their specific booking inside the Switch App. Example :

"trackingInfo": {
        "type": "HTTPS",
        "url": "https://google.com"
      },

For eg.,
In the image below, a ​user can click on “View Details” to get redirected to the Food Switch App on PhonePe and list the booking details corresponding to the transaction Id. You can find the details here.

Switch need to share its cart details with PhonePe in initiate API. You can find the details for your use-case here

"cartDetails": {}
  1. PhonePe's server sends back the response of initiateTransaction API () API to the Switch server which needs to be passed onto the Switch.
    Example:
    In response to initiateTransaction API() API, Switch server would receive “redirectionURL” field which needs to be opened on the Switch merchant application

Sample Curl Request (Please see the API for more details)

curl -X POST \
  https://apps-uat.phonepe.com/v3/transaction/sdk-less/initiate \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 8e494653-a3ce-2bb1-b5ad-4c0f27569401' \
  -H 'x-client-id: MerchantMID' \
  -H 'x-verify: A2C1905C07A5548EC44E65ECC80EC75769308DFF47821EB13CAAD1504BFE1582###1' \
  -d '{ "request": "ewoJIm1lcmNoYW50SWQgIjogIlJBWk9SUEFZTUFJTiAiLAoJImFtb3VudCI6IDEwMDAwMDAwLAoJInZhbGlkRm9yIjogOTAwMDAwLAoJInN1Yk1lcmNoYW50SWQiOiAiOTE3YzNlNWU1MDMzOTE5ZTNjNWRkN2I5YWRiYWFmYjVmMjBmOWMxYiIsCgkidHJhbnNhY3Rpb25JZCI6ICJZR1lHWTg4ODg4VUlIR0dUWWlpaWlpVFlVWVUiLAoJIm1lcmNoYW50T3JkZXJJZCI6ICJZR1lHWTg4ODg4VUlIR0dUWWlpaWlpVFlVWVUiLAoJInRyYW5zYWN0aW9uQ29udGV4dCI6ICJld29KSW05eVpHVnlRMjl1ZEdWNGRDSTZJSHNLQ1Fra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N3S0NRa0pJbkYxWVc1MGFYUjVJam9nTVFvSkNYMWRDZ2w5Q2dwOSIsCgkicmVkaXJlY3RVcmwiOiAiaHR0cHM6IC8vdGVzdC1tZXJjaGFudC5jb20vb3JkZXIvNDIzMTQyMzMyMzIiCn0="}'
  1. To open the PhonePe's Payments page, the Switch App opens redirectionURL field received from the Switch server API.

  2. PhonePe payments page opens and the user is shown all the payment options of the PhonePe APP.

  3. The user completes the payment on the PhonePe APP and is redirected back to the 'redirectionURL' of the Switch App which was sent in the response of the initiateTransaction API() API.

  4. The Switch checks the status of the transaction asking its server.

  5. The Switch server hits getTransactionStatus() API on PhonePe server's, receiving the status of the transaction.

  6. Switch server would receive the status as pending until PhonePe receives a confirmation from the Bank.

  7. As soon as PhonePe receives a callback from the Bank of Payment success or Failure, the Switch server would receive success or failure in getTransactionStatus() API.

  8. Order fulfilment page is shown by the Switch App.