Create Order

This API endpoint allows you to create orders by sending an HTTP POST request to the specified URL. The request should include the customer ID, currency, items (with name, quantity, and price), and a notify URL in the payload.

The response to this request will have a status code of 200 and will include various details of the created order, such as the order ID, account ID, customer details, order status, items purchased, shipping information, discounts, totals, risk score, fee, confirmation status, creation and update timestamps, and a payment link.

  • Embed the pay_link in your GUI.

  • Receive the payment webhook confirmation in the notify_url.

  • Review the payment is paid by creating a Get Order request.

  • Ecart Pay will redirect to the customer the redirect_url for order confirmation.

Important information:

notify_url (Webhook will be triggered to this url): You will receive a post notification with the order id to this url when an order status has changed. You can then use the Get Order method to verify order details.

redirect_url (Order Confirmation Landing Page): The customer will be redirected to this url, once the payment is complete. You should have a success and error page. If you received a successful payment, you should show the order details with the order confirmation.

pay_link (Ready to use Payment Link): Use this url to get the predefined payment window. Ecart Pay already handles all the necessary security validations for a safe payment transaction.

Here is an example of the response:

{
    "id": "65b0565f7f9f32242108746a",
    "account_id": "5d2d436e3199ae000449065b",
    "customer_id": "657b928db4c08f6f66847b09",
    "type": "order",
    "number": "OR00006612A",
    "status": "created",
    "first_name": "Roberto Alejandro",
    "last_name": "Ramirez Gonzalez",
    "phone": "8114999999",
    "currency": "MXN",
    "country": "MX",
    "items": [
        {
            "name": "Brazalete religioso plateado BR3017",
            "quantity": 1,
            "price": 243.33,
            "discount": 0,
            "total": 243.33,
            "tax": 0,
            "is_service": false,
            "taxes": []
        }
    ],
    "shipping_items": [],
    "discounts": [],
    "totals": {
        "subtotal": 243.33,
        "total": 243.33,
        "tax": 0,
        "discount": 0,
        "shipping": 0
    },
    "risk_score": 0,
    "risk_notes": [],
    "fee": 0,
    "confirmed": false,
    "confirm": false,
    "notify_url": "https://example.com/customer/290",
    "auto_billing": false,
    "created_at": "2024-01-24T00:14:23.735Z",
    "updated_at": "2024-01-24T00:14:23.735Z",
    "pay_link": "https://sandbox.ecartpay.com/checkout?id=65b0565f7f9f32242108746a"
}

Creating an Order

The request should include the customer ID, currency, items (with name, quantity, and price), and you may add a notify URL in the payload.

The response to this request will have a status code of 200 and will include various details of the created order, such as the order ID, account ID, customer details, order status, items purchased, shipping information, discounts, totals, risk score, fee, confirmation status, creation and update timestamps, a payment link, and more. With this, you can:

  • Embed the pay_link in your GUI.
  • Receive the payment webhook confirmation in the notify_url.
  • Review the payment is paid by creating a Get Order request.
  • Ecart Pay will redirect to the customer the redirect_url for order confirmation.

Response Key Features

  • pay_link: A ready-to-use URL for a secure payment window. Embed this link in your GUI to allow customers to complete the payment.
  • notify_url: A webhook URL to receive order status updates. When the order status changes, EcartPay sends a POST request with the order ID to this URL.
  • redirect_url: After payment is completed, customers are redirected to this URL. Ensure this page displays order details (on success) or an error message (on failure).
📘

Visit our Documentation to learn more about Orders.

💻

Integration

Check our Backend Integration documentation if you would like to learn more about implementing order creation as part of a workflow.

Language
Click Try It! to start a request and see the response here!