Hey! These docs are for version 3.2, which is no longer officially supported. Click here for the latest version, 1.0!

Handling the Redirection Method

Once you have the response for a Transaction API request, you will need to take the next step to redirect the customer, depending on the payment.authentication.method attribute, which can either be GET or POST:
Handling the "GET" redirection method:     (click to open)
If you receive GET as the authentication method in the response, then take the value in the “URL” attribute and redirect the user to this location. You may load the URL directly into the customer’s browser. You can easily achieve this by send HTTP 302 from your server. However, if the API call was made from the browser, then you can utilize the code snippet provided.
<!-- Example for handling GET response -->
<script type="text/javascript">
 // assuming that you are passing the JSON response of /txns API directly here
 function handleJuspayGetResponse(juspayResponse) {
   window.location.href = juspayResponse.payment.authentication.url
Handling the "POST" redirection method:   (click to open)

If you receive POST as the authentication method in the response, then the “params” attribute will hold a map containing key-value pairs, which will be used in redirecting the customer with a form. Example HTML code is given to you. Depending on your client language, choose the appropriate way to create the form

<form method="POST" action="$authentication.url" id="authForm">
  {{ for key in  $authentication.params }}
  <input type="hidden" name="$key" value="$authentication.params[$key]">
  {{ end }}
<script type="text/javascript">

For Web, you can create a form with these parameters as hidden variables and auto submit the form. Example code in Javascript: Serialize Parameters.

For Android, serialize this data such that it can be loaded to WebView directly via postData. Example code in Java: Serialize Parameters.