Step1 : Initiate API will give redirect Url in response which needs to open at the client-side using the below code.
On client side open the "redirection URL" using the below code
<body onload="window.location.href = '{{$data['request']['redirectUrl']}}'">
As soon as the above redirectUrl is called, the PhonePe payments page will open where a user will be able to complete the payment on the Switch Platform.
Step2: As soon as the user completes the payment, the user will be redirected to the redirectUrl which is merchant client-side URL given in the response of the Initiate API.
Note: PhonePe Switch does not share the status of the transaction at the client-side.
As soon as user completes the payment, he will be redirected to the merchant’s URL. A merchant needs to fetch the status of the transaction from the backend API.
Step3: Fetch the status of the transaction from the getStatus backend API.