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
openPaymentPage( ) function call
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 ‘http.post’ 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.
Copy hyperSDKCallbackHandler() function in your project file to handle events emitted by SDK to communicate about the transaction status. On payment completion, this function transfers flow to ‘payment_page.dart’ file where we display the payment status.
openPaymentPage( ) function is responsible for opening the payment page