Create an instance of the paymentRequest object where the redirectUrl value should be an "upi://" Intent URI.
Using the Step 1 paymentRequest object, Check if we can make the payment using the intent flow using hasEnrolledInstrument() / canMakePayment() methods.
hasEnrolledInstrument() method supports the latest browser whereas in case you are using the older browser then you can consider the canMakePayment() method.
This method will return true/false.
- If true is returned then display the PhonePe/BHIM UPI option on the checkout page.
- If false is returned then do not display the PhonePe/BHIM UPI option on the checkout page.
Call A /v4/debit API with extra property paymentScope: MSITE_INTENT and get the redirect Url in the response.
Create an instance of the paymentRequest object where you need to pass the actual intent URI from the response of /v4/debit API as the value of the redirectUrl.
Now call the .show() method using the Step 4 paymentRequest object. Here the PhonePe app will open and the user can complete the payment.
Once the payment is completed, You will receive the response on the handlePaymentResponse() method.
Once the response is received, You need to check the status with the backend.
Updated 5 months ago