---
page_title: Create MOTO Order with Payments
product: API Reference
page_source: https://juspay.io/in/docs/api-reference/docs/express-checkout/create-moto-order-with-payments
openapi: https://juspay.io/in/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fin%2Fdocs%2Fapi-reference%2Fdocs%2Fexpress-checkout%2Fcreate-moto-order-with-payments
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/api-reference/llms.txt
---

## API Version: default


# Create MOTO Order with Payments



Parameters from Create Order API and Payments API can be used in this API. 

Please refer to the specification document of individual APIs. Parameters from Create Order API need to be included in the format**order.<parameter_name>** 

For example, **order.metadata.JUSPAY:gateway_reference_id** 

> **Note**
> If you are a PCI-compliant merchant, you can combine the Create Order API request with the Payments API request in a single API request. 
> 
> The sample request and response are shown below.

## Endpoints:
- Sandbox: https://sandbox.juspay.in/txns

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

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string
- Value:   Example:- Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==
- Tags: required, Base 64 encoding
## Headers:

#### x-merchantid:
Merchant ID provided by Juspay
- 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:
### Code Snippets:

#### Request Code Snippet:

```request
curl --location 'https://sandbox.juspay.in/txns' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-merchant-id: <merchant_id>' \
--header 'x-routing-id: customer_1122'\
--header 'Authorization: Basic <API Key setup on Juspay dashboard>' \
--data-urlencode 'order.order_id=ord_jkbvgusvb' \
--data-urlencode 'order.customer_id=cust_169' \
--data-urlencode 'order.currency=INR' \
--data-urlencode 'payment_method_type=CARD' \
--data-urlencode 'card_number=5329xxxxxx72625' \
--data-urlencode 'card_exp_month=05' \
--data-urlencode 'card_exp_year=26' \
--data-urlencode 'format=json' \
--data-urlencode 'payment_method=MASTERCARD' \
--data-urlencode 'redirect_after_payment=true' \
--data-urlencode 'merchant_id=<merchant_id>' \
--data-urlencode 'order.return_url=https://merchant.in/payments' \
--data-urlencode 'order.amount=1' \
--data-urlencode 'tavv=AGU+nY4+Tn+qxxxxMSAAADFA==' \
--data-urlencode 'auth_type=MOTO'

```

### Sample Request and Response:

#### 400 Response:
```json
{
  "status": "Bad Request",
  "error_code": "invalid_request_error",
  "error_message": "Can't find a suitable gateway to process the transaction"
}

```

#### 200-Charged Response:
```json
{
  "order_id": "ord_jkbvgusvb",
  "status": "CHARGED",
  "payment": {
    "authentication": {
      "url": "https://sandbox.juspay.in/v2/pay/finish/mid/mozq4D58xxxxUyUR2ELk/ord_jkbvgusvb",
      "method": "GET"
    }
  },
  "txn_uuid": "mozq4D58xxxxUyUR2ELk",
  "offer_details": {
    "offers": []
  },
  "txn_id": "ord_jkbvgusvb"
}

```

#### 200-Authorized Response:
```plaintext
{
    "txn_id": "test-test_1729084726-1",
    "order_id": "test_1729084726",
    "status": "AUTHORIZED",
    "payment": {
        "authentication": {
            "url": "https://api.juspay.in/v2/pay/finish/test/moztwCQq4CbDuKhABVN/test_1729084726",
            "method": "GET"
        }
    },
    "offer_details": {
        "offers": []
    },
    "merchant_return_url": "https://merchant.in/payments",
    "txn_uuid": "moztwCQq4CbDuKhABVN"
}

```

## Query Parameters:

#### key1:
- Tags: String, Mandatory
## Body Parameters:
### Basic Parameters:

#### order.order_id:
- Description: Unique Identifier for the order. Should be Alphanumeric with character length less than 21.
- Value:  Example:- order-id-9876580
- Tags: String, Mandatory

#### order.amount:
- Description: The amount that the customer has to pay. Will accept stringified double or integer values with up to two decimal places. 
- Value:  For example, "100.15" and "100" are valid input but "100.1532" is not valid.
- Tags: String, Mandatory

#### order.customer_id:
- Description: It is the ID with which merchant refers to a customer object. This id is used to access the stored payment methods, allow EMI transactions and setup subscriptions.In case of guest login it should be an empty string.
- Value:  Example:- customer-id-007
- Tags: String

#### order.customer_email:
- Description: Email address of the customer. If the backend gateway requires it, then you must send this value.
- Value:  Example:- test@gmail.com
- Tags: String

#### order.customer_phone:
- Description: Mobile number or fixed line number of the customer. If the backend gateway requires it, then you must send this value.
- Value:  Example:-  9999999912
- Tags: String

#### order.currency:
- Description: ISO string of the currency. Use INR for the Indian Rupee. Among other accepted values are EUR, USD, GBP. Default value: INR
- Tags: String, Mandatory

#### order.return_url:
- Description: A fully qualified URL which the customer will be redirected after payment completion. It is also required to provide the control back to SDK after the completion of transaction. This URL shouldn't contain any query parameters or Ip address. This URL takes higher precedence over the common return URL configured in your account settings.
- Value:  Example:- https://shop.merchant.com
- Tags: String

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

#### payment_method_type:
- Description: Depending on type of payment to be processed.
- Value:  Example:- CARD
- Tags: String, Mandatory

#### payment_method:
- Description: One of VISA/MASTERCARD/MAESTRO/AMEX/RUPAY. This is usually inferred from the card number itself and we will take care of this if you are unable to provide this from your end.
- Tags: String, Mandatory

#### card_token:
- Description: A valid card token is obtained using /card/list API. If you send this parameter, then card_number, name_on_card, card_exp_year, card_exp_month fields are not required.
- Tags: String, Conditional

#### card_number:
- Description: A valid credit/debit card number 

Either card_number or card_token is requried.
- Tags: String, Conditional

#### name_on_card:
- Description: Card holder name. Should contain alphabetical characters only.
- Tags: String

#### card_exp_year:
- Description: Represent the expiry year of the card as YY (two digits only) Required if you are passing card_number instead of card_token
- Tags: String, Conditional

#### card_exp_month:
- Description: Represent the expiry month of the card as MM (two digits only) Required if you are passing card_number instead of card_token
- Tags: String, Conditional

#### card_security_code:
- Description: CVV of the card. Usually three digits. Optional for all VISA saved cards, SODEXO saved cards, and saved cards of select issuing banks of MASTERCARD
- Tags: String, Conditional

#### redirect_after_payment:
- Description: This is a boolean variable and accepts true/false. We recommend that you set this to true and use the redirection flow. 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, Mandatory

#### 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, Mandatory

#### auth_type:
- Description: Pass this parameter with value MOTO to indicate a direct debit is expected.
- Value:  MOTO
- Tags: String, Mandatory
## API Responses:
### 200:

#### order_id:
- Tags: String, Mandatory

#### status:
- Tags: String, Mandatory

#### payment:
- Value:
  - **Authentication**:
    - Value:
      - **Url**:
        - Tags: String, Mandatory
      - **Method**:
        - Tags: String, Mandatory
    - Tags: String, Mandatory
- Tags: String, Mandatory

#### txn_uuid:
- Tags: String, Mandatory

#### txn_id:
- Tags: String, Mandatory
### 400:

#### status:
- Value:  Bad Request
- Tags: String

#### error_code:
- Value:  invalid_request_error
- Tags: String

#### error_message:
- Value: Can't find a suitable gateway to process the transaction
- Tags: String


---

## See Also

- [Create Order with Payments](https://juspay.io/in/docs/api-reference/docs/express-checkout/create-order-with-payments)
- [Webhooks](https://juspay.io/in/docs/api-reference/docs/express-checkout/webhooks)
