Brief Step by Step guide

Step1: Fill the forms as given below so that the integration team can assist you better with the integration

a.) Switch Integration Prerequisites

Step2: Activate Switch flow by sharing Razorpay preprod and production key with PhonePe team

A merchant needs to fill the details in the form.
You can know the details by checking the Razorpay Technical documentation .A merchant can find the sample code and details in the above documentation.

📘

The MID is needed for the activation of the Switch payment flow. Without the activation, the payment flow will not work.

Step 3: Getting ready

1.) Get the <YOUR_KEY_ID>:<YOUR_KEY_SECRET> from the Razorpay dashboard as given in the above documentation.

2.) Get activated Appunique ID from the PhonePe team which will be unique for each merchant. The details will be shared on the email once the Switch flow is activated for the merchant's Razorpay MID which was shard earlier in a form.

3.) Get APK and IPA from the documentation as here.

Step 4: Create and add a one new parameter (phonepe_switch_context) in the existing RazorPay code.

The sample code is mentioned below :

curl -u <YOUR_KEY_ID>:<YOUR_KEY_SECRET> \
-X POST https://api.razorpay.com/v1/orders \
-H "Content-Type: application/json" \
 -d '{
    "amount": 1000,
    "currency": "INR",
    "payment_capture": 1,
    "receipt": "merchant_txn_id",
    "phonepe_switch_context": {\"orderContext\": {\"trackingInfo\":{\"type\": \"HTTPS\",\"url\": \"https://test.merchant.com//particularorder\"}}}"
}'
  1. A new parameter phonepe_switch_context is added in the existing code in which details of the particular order needs to be sent.
  1. A merchant should keep payment_capture as 1 .
  2. A merchant is requested to implement Callback as mention in the document.

When a user clicks on Pay, the above code should trigger which will open the Switch Payment flow inside the PhonePe Application.

Step 5: Test the flow inside the PhonePe Application

How to test the flow inside PhonePe app can be found here

a.) Download the Apk and enter the static URL
b.) Enter the domains.
Request you to whitelist - **"api.razorpay.com" and all the domains which are used on the website.
c.) Enter appunique ID will be shared by the PhonePe team

📘

Note: The payment flow will work only inside the PhonePe application. A merchant needs to test the flow inside PhonePe application.

Step 6: Identification of the source of traffic as PhonePe

As few merchants have to hide other payment options and other payment banners for the PhonePe Switch users, they should know that the user is opening the website inside the PhonePe application.

📘

Note

There should be no options shown to the user, as soon as he clicks on Pay, automatically PhonePe Payments page should open.

This can be done in 2 ways:

  1. Use a separate URL for your store in the PhonePe Apps Platform.
  2. Identify user agent as ‘PhonePe’ sent in PhonePe webview.

Step 7: Share the test cases to PhonePe Integration team

Refer to the section here. Merchant testing team needs to share the commented test cases to the PhonePe integration team on email for PreProd signoff.