Integration Steps

Overview

  1. As soon as the customer clicks on the check out button to pay the amount through Phonepe, you need to create an order with parameters like transaction amount, merchant order id, transaction id, etc. Encode the request payload into base 64 and create the X-Verify of the encoded value, salt key, salt index and end-points using the SHA256 algorithm

  2. Post the request to Phonepe server using v4 Debit API, Phonepe will provide redirect URL in the response to your server

    • You can initiate the payment by calling the v4 debit API. As soon as the customer clicks on the checkout button to pay the amount through Phonepe, you need to create an order with parameters like transaction amount, merchant order id, transaction id, etc.
    • Encode the request payload into base 64
    • Create the X-verify of the encoded value using the SHA256 algorithm, salt key, salt index, base64 encoded request body, and endpoint URL. X-verify must be created at the server-side only. Calculating the X-verify at the client-side may lead to the risk of salt keys getting exposed
      Please refer to section for calculating X-verify
    • Once X-verify is created, you need to Post the transaction request to Phonepe server with request attributes mentioned in v4 Debit API
  3. You need to redirect your customer to redirect the URL shared by PhonePe.

  4. Customer fills the payment details and completes the authentication.

  5. Phonepe posts the UI callback response on the redirect URL shared in the transaction request by you.

  6. The response is encoded in base 64. Decode the response and validate the X-verify to ensure that the response has not tampered

  7. Verify the response with check status API to match the transaction id, merchantorderid, amount and the status of the transaction

  8. Once the payment is validated against the order, fulfill the order