Opening Payment Page
Step 1
Copy startPayment( ) function to your activity
Step 2
Update Your Backend URL
Step 3
Copy Response Handler to your activity
Step 4
Call openPaymentPage( ) function
This function has end-to-end code for opening the payment page on your frontend.
In the next steps, lets look at the changes required to run it in your setup and also understand the things happening inside this function.
Inside sendPostRequest() function call, replace http://10.0.2.2:5000 with the URL of your backend.
This function will hit the /initiateJuspayPayment API endpoint in your backend, create an order and will give SDK Payload in response (Please refer to the sample response of Create Session function)
Copy createHyperPaymentsCallbackAdapter() function in your project file to handle events emitted by SDK to communicate about the transaction status.
On payment completion, this function transfers the flow to ‘ResponsePage’ activity where we display the payment status.
openPaymentPage() function is responsible for opening the payment page