# Creating an Order

You need to first use this endpoint to create an order on our systems. We will then return an url where you will redirect the user.

**Endpoint:** [**https://api-pay.just.money/v1/checkout/newOrder**](https://api-pay.just.money/v1/checkout/newOrder)\
\
**Request Type:&#x20;**<mark style="color:blue;">**POST**</mark>\
\
**Format:&#x20;**<mark style="color:blue;">**JSON**</mark><br>

### **POST Params:**

**wallet.evm \[String]**\
Specify BSC and Polygon wallet address where you want to receive funds e.g. 0xd0545256AcaA8a20bDC077c0D104fc84dcDc4289

**wallet.tron \[String]**\
Specify wallet in Tron format where you want to receive funds e.g. THgyXyKoPFxvMri6A8r8P4nSMPFrUbbUkz

**src \[String]**\
Specify your platform e.g. WOOCOMMERCE\_6\_5\_1. If you don't use ready-made plugin from us then specify here API

**returnUrl \[String]**\
Your return url where you want your client to be redirected after the payment. Please make sure your url has some identification in the url e.g. orderId, so you can show correct confirmation/receipt for the user

**statusHookUrl \[String]**\
Url that we call when order has been confirmed. When you receive this call you will receive secret, orderId (order id in your systems), hash, transactionHash and network in POST body as JSON object. \
Example POST body that it sends to the hook:

```json
{
    "secret": "xxx",
    "orderId": "xxx",
    "hash": "xxx",
    "transactionHash": "xxx",
    "network": "xxx" //TRON, BSC, ETH, POLY, FANTOM, AVAX OR CRONOS
}
```

Before returning a response you this call you need to call our getStatusByHash endpoint to verify that the call is valid, from us and that transaction is confirmed.\
If it returns {"status":"DONE"} then you must respond to this call with the secret we sent. This means that you have acknowledged the call, and it will make sure we won't keep pinging your hook again.

**totalAmount \[String]**\
Total USD amount with 2 decimals as String e.g. 12.00

**orderId \[String]**\
Your unique order ID that identifies your order. We will send this when we call statusHookUrl

**currency \[String]**\
Currency of your order e.g. USD. At the time of writing we only support USD

### Example POST body:

```json
{
    wallets: {
        "evm": "addressHere",
        "tron": "addressHere",
    },
    "src": "API",
    "returnUrl": "URL_TO_YOUR_THANKYOU_PAGE", // or https://pay.just.money/thankyou
    "statusHookUrl": "https://yourdomain.com/yourHookUrl",
    "totalAmount": "100",
    "orderId": "ORDER_ID_IN_YOUR_SYSTEM",
    "currency": "USD"
}
```

### **Returns:**

```json
{
  "id": "OUR_ORDER_ID",
  "hash": "HASH",
  "paymentUrl": "PAYMENT_URL",
}
```

or on error (with status code 500):

```json
{ error: "Server error" }
```

You will need to redirect user to the paymentUrl that we send after you have saved these details in your system.\
You will need our order id and hash on later stage.
