Prerequisites

Ensure that you have the One Click Checkout product activated. You can activate it from here.


Integration Steps

One Click Checkout is supported on Shopify and for custom websites.

Shopify Integration

To integrate One Click Checkout on Shopify, follow the guide here.

Custom Websites

For custom websites, use any of our web and app checkout integrations and make the following changes:

  1. Order Creation Requirements: Ensure the following parameters are passed when creating an order:

    • cart_details: Include detailed information about the cart.
    • one_click_checkout: Include one click checkout configuration details under the object product.
Sample cURL
curl --location --request POST 'https://sandbox.cashfree.com/pg/orders' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-version: 2022-09-01' \
--header 'x-client-id: TEST430329ae80e0f32e41a393d78b923034' \
--header 'x-client-secret: TESTaf195616268bd6202eeb3bf8dc458956e7192a85' \
--data-raw '{
    "order_amount": 1,
    "order_currency": "INR",
    "customer_details": {
        "customer_id": "USER123",
        "customer_name": "user123",
        "customer_email": "user@cashfree.com",
        "customer_phone": "9999999999"
    },
    "order_meta": {
        "return_url": "https://www.cashfree.com/devstudio/preview/pg/web/checkout?order_id={order_id}"
    },
    "products": {
        "one_click_checkout": {
            "enabled": true,
            "conditions": [
               {
                   "action": "ALLOW",
                   "values": [
                       "checkoutCollectAddress",
                       "checkoutAuthenticate"
                   ],
                   "key": "features"
               }
           ]

        }
    },
    "cart_details": {
        "cart_items": [
            {
                "item_id": "cart_id_1",
                "item_name": "T Shirt",
                "item_description": "Test Description",
                "item_details_url": "https://chriscross.in/cdn/shop/files/95_800x.jpg",
                "item_image_url": "https://chriscross.in/cdn/shop/files/95_800x.jpg",
                "item_original_unit_price": 1,
                "item_discounted_unit_price": 1,
                "item_quantity": 1,
                "item_currency": "INR"
            }
        ]
    }
}'
  1. Order Details Endpoint: This endpoint provides detailed order information, including:

    • Customer Information: Details about the logged-in user.
    • Shipping and Billing Addresses: Information about the recipient for whom the order was placed.
    • Applied Offers: Any discounts or offers applied at checkout.

    For more details on the API, refer to the documentation here.

The response includes a customer details object with information about the logged-in user, and the shipping address object contains details about the recipient for whom the order was placed.