---
page_title: Cash On Delivery Payment
product: API Reference
page_source: https://juspay.io/in/docs/api-reference/docs/express-checkout/cash-on-delivery-payment
openapi: https://juspay.io/in/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fin%2Fdocs%2Fapi-reference%2Fdocs%2Fexpress-checkout%2Fcash-on-delivery-payment
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/api-reference/llms.txt
---

## API Version: default


# COD Payments



Create a payment transaction for Cash on Delivery. Once the COD transaction API is hit, the transaction will routed via **CASH**  gateway and the status will be directly marked **COD_INITIATED** . 

> **Note**
> * Please configure ‘**CASH** ’ gateway with ‘Cash Payment‘ enabled on Juspay Dashboard under ‘**PG Control Center** ’
> 
> ![Image](https://dth95m2xtyv8v.cloudfront.net/tesseract/assets/api-reference/image%20(6).png)
> 
> 

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

- Production: https://api.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=CASH" \
-d "payment_method=CASH" \
-d "redirect_after_payment=true" \
-d "format=json"
```

### Sample Response:

#### Response:
```json
{
    "payment": {
        "authentication": {
            "method": "GET",
            "url": "https://api.juspay.in/v2/pay/start/Merchant/moza9eKBUeLNYeNH1C?cardIssuerBankName%3DCASH%26cardType%3D%26paymentMethod%3DCASH%26paymentMethodType%3DCASH"
        }
    },
    "status": "COD_INITIATED",
    "txn_uuid": "moza9eKBUeLNYeNH1C",
    "resp_message": "Transaction is successful",
    "resp_code": "TXN_SUCCESS",
    "offer_details": {
        "offers": []
    },
    "order_id": "test1734681959",
    "txn_id": "Merchant-test1734681959-2"
}
```

## Body Parameters:
### Parameters:

#### order_id:
- Description: order_id pertaining to the order for which the payment is started.
- Tags: string, Mandatory

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

#### payment_method_type:
- Description: Must be CASH.
- Tags: string, Mandatory

#### payment_method:
- Description: Must be CASH.
- Tags: string, Mandatory

#### 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: f 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
## 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


---

## See Also

- [Wallet Direct Debit](https://juspay.io/in/docs/api-reference/docs/express-checkout/wallet-direct-debit)
- [UPI Intent Payment](https://juspay.io/in/docs/api-reference/docs/express-checkout/upi-intent-payment)
