Create Order

Create Order Endpoint

Overview

The /order/create endpoint is designed for creating a new order with a list of products, specifying the wallet to be used for payment, and a reference for the order. This endpoint returns details about the order created, including an invoice with the payment status and exchange rates if applicable.

HTTP Request

POST /order/create

Content-Type

application/json

Request Body

Field

Type

Description

productList

Array

A list of products to be included in the order. Each product object includes sku, productType, quote, and quantity.

wallet

String

The wallet type to be used for the payment.

reference

String

A reference string for the order.

webhookUrl

URL String | Optional

Sample Request Body

{
    "productList": [
        {
            "sku": "038-00-range",
            "productType": "range",
            "quote": 5,
            "quantity": 1
        }
    ],
    "wallet": "EUR",
    "reference": "Test Reference",
    "webhookUrl" : "YOUR WEBHOOK URL"
}

Response

The response includes a message, data about the order including an id, exchange rates if applicable, and two invoices for wallet and retail

Read Order Invoice for information about the invoices and their structure.

Response

{
    "message": "No Message",
    "data": {
        "id": "xQg4IeRUNIcIfJSWx6Nl",
        "exchangeRates": [
            {
                "targetCurrency": "EUR",
                "rate": 0.00001263583522870862,
                "modifiedDate": {
                    "_seconds": 1711227854,
                    "_nanoseconds": 883000000
                },
                "baseCurrency": "IRT"
            }
        ],
        "invoice": "walletInvoice",
        "retailInvoice": "retailInvoice",
        "expiresAt": 1712096042072
    }
}

Order Valid size

Currently we have limitation on how many items you can include in your order which is:

  • Maximum quantity per SKU : 5

  • Maximum number of unique SKUs in one order: 5

  • Maximum total quantity : 25

Status Codes

Status Code

Description

200

OK - The order was successfully created.

403

Unauthorized - Authentication credentials are missing or invalid.

500

Internal Server Error - An unexpected error occurred on the server.

Error 400 troubleshooting:

Error 400 happens because of one of the below reasons, it is also returned in the response

Code

Message

Fix

400

Requested product list is bigger than allowed

Reduce the size of the order.

400

Your product list is not formatted well

The product list items should have unique SKUs

400

The entered quote doesn\'t match the SKU.

400

The entered quote is not in range

400

You have insufficient funds in your wallet to create this order

404

One or more product in the sent list are not found.

500

Your requested exchange is not supported

500

Requested item is out of stock

Notes

  • Ensure that the product list includes all necessary details as per your product catalog specifications.

  • The expiresAt field represents the UNIX timestamp (in milliseconds) indicating when the order or quote expires. (Normally 10 minutes)

  • Exchange rates and currency conversion details are provided based on the current rates and are frozen for this order until order expiration.


Last updated