---
page_source: https://juspay.io/in/docs/ec-api/docs/base-integration/wallet-redirection
page_title: Wallet Redirection
---

## API Version: default


# Wallet Payment



Create a payment transaction for paying from a prepaid **Wallet** . Once you have the response, depending on the “method” attribute, you will have to take the next step. If you receive GET, then take the value in the “URL” attribute and redirect the user to this location. If you receive POST, then “params” attribute will hold a map containing key-value pairs.

For Web, you can create a form with these parameters as hidden variables and auto submit the form. Example code in Javascript: [Serialize Parameters](https://gist.github.com/ramanathanrv/31c0b687f0177c37b892).

For Android, serialize this data such that it can be loaded to WebView directly via postData. Example code in Java: [Serialize Parameters](https://gist.github.com/ramanathanrv/59fb412e1c75a1d9398a).


| payment_method | Bank |
|---|---|
| MOBIKWIK | MobiKwik Wallet |
| PAYTM | PayTM |
| FREECHARGE | FreeCharge wallet |
| OLAMONEY | Ola Money wallet |
| PAYUMONEY | Payu Money wallet |
| AIRTELMONEY | Airtel Money |
| OXIGEN | Oxigen Wallet |
| PAYZAPP | PayZapp Wallet |
| JANACASH | Jana Cash |
| JIOMONEY | JioMoney |
| PHONEPE | PHONEPE / BHIM UPI |
| AMAZONPAY | Amazon Pay |
| PAYPAL | PAYPAL |



## HANDLING POST



When you get `POST` as the authentication method in the response, then the customer must be redirected using a form. Example HTML code is given to you. Depending on your client language, choose the appropriate way to create the form.


#### Handling POST Code Snippet:

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



## HANDLING GET



When you get `GET` as the authentication method in the response, you may load the URL directly into the customer’s browser. You can easily achieve this by sending HTTP 302 from your server. However, if the API call was made from the browser, then you can utilize the code snippet provided.


#### Request Code Snippet:

```request
<form method="POST" action="$authentication.url" id="authForm">
  {{ for key in  $authentication.params }}
  <input type="hidden" name="$key" value="$authentication.params[$key]">
  {{ end }}
</form>
<script type="text/javascript">
 document.forms["authForm"].submit()
</script>
```
## Endpoints:
- Sandbox: https://payments.sandbox.juspay.in/txns

- Production: https://payments.juspay.in/txns

## Request Type: 
POST

## Headers:

#### Content-Type:
application/x-www-form-urlencoded
- Tags: String, Mandatory

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Request Code Snippet:

```request
curl -X POST https://api.juspay.in/txns \
-H 'x-routing-id: customer_1122'\
-d "order_id=:order_id" \
-d "merchant_id=:merchant_id" \
-d "payment_method_type=WALLET" \
-d "payment_method=MOBIKWIK" \
-d "redirect_after_payment=true" \
-d "format=json"

```

### Sample Response:

#### Example Response (Having POST As The Method):
```json
{
  "order_id": ":order_id",
  "txn_id": ":txn_id",
  "status": "PENDING_VBV",
  "payment": {
    "authentication": {
      "method": "POST",
      "url": "https://wallet-url.com/payment-path/start",
      "params": {
        "key1": "v1",
        "key2": "v2",
        "key3": "v3"
      }
    }
  }
}
```

#### Example Response (Having GET As The Method):
```json
{
  "order_id": ":order_id",
  "txn_id": ":txn_id",
  "status": "PENDING_VBV",
  "payment": {
    "authentication": {
      "method": "GET",
      "url": "https://wallet-url.com/payment-path/start?hello=world"
    }
  }
}
```

## Body Parameters:
### Parameters:

#### order_id:
- Description: `order\_id` pertaining to the order for which the payment is started.
- Tags: string, Required

#### merchant_id:
- Description: ID of the merchant_account that you hold with us.
- Tags: string, Required

#### payment_method_type:
- Description: Must be `WALLET`
- Tags: string, Required

#### payment_method:
- Description: The actual payment method that was selected by the user. For WALLET transactions, it must be one of the below table.
- Tags: string, Required

#### redirect_after_payment:
- Description: This is a boolean variable and accepts true/false. We recommend that you set this to true. If set to `true`, then the user is redirected to the `return\_url` configured for the order. If set to `false`, then the user will be stopped at the response page from the gateway. Your client should be able to read the page/title to infer that the user has completed the transaction.
- Tags: string, Required

#### format:
- Description: If it is set to `json`, then the response will be HTTP 200 with a JSON formatted text. Otherwise, the response is HTTP 302 with the Location attribute having the destination URL.
- Tags: string, Required

#### offers:
- Description: The key offers should be passed only when juspay offers are being used. The value for this key can set as the offerID which is received from /v1/offers/list api
- Tags: array of Strings
## API Responses:
### 200:

#### order_id:
- Description: :order_id
- Tags: string

#### txn_id:
- Description: :txn_id
- Tags: string

#### status:
- Description: PENDING_VBV
- Tags: string

#### payment:
- Value:
  - **Authentication.method**:
    - Tags: string
  - **Authentication.url**:
    - Tags: String
  - **Authentication.params**:
    - Description: Only when you have POST as the authentication method
    - Value:
      - **Key1**:
        - Tags: String
      - **Key2**:
        - Tags: String
      - **Key3**:
        - Tags: String
    - Tags: Object
- Tags: object
### 400:

#### status:
- Description: error
- Tags: string

#### error_message:
- Description: Order timed out
- Tags: string

#### error_code:
- Description: invalid_request
- Tags: string
