Step 6: create an order

Now that you know how to create a quote, let's try creating an order. An order can be for an internal currency exchange and/or an outbound payment. In this example, we'll be making a payment.

info

All quotes expire after 12 seconds, so you may want to create a new one before trying this request.

SandboxProduction
Copy
Copied
curl -i -X POST \
  'https://api-sandbox.equalsmoney.com/v2/orders/trade?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": "E2T0A7VKQEKB",
    "quoteRequestId": "115f6752-ca44-4ef2-9629-f0c9d97fb17d-80-79.3651",
    "payments": {
      "amount": 80,
      "currency": {
        "budgetId": "{budgetId}",
        "currencyCode": "GBP"
      },
      "recipientId": "{recipientId}"
    }
  }'
Copy
Copied
curl -i -X POST \
  'https://api.equalsmoney.com/v2/orders/trade?accountId={accountId}' \
  -H 'Authorization: ApiKey {apiKey}' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": "E2T0A7VKQEKB",
    "quoteRequestId": "115f6752-ca44-4ef2-9629-f0c9d97fb17d-80-79.3651",
    "payments": {
      "amount": 80,
      "currency": {
        "budgetId": "{budgetId}",
        "currencyCode": "GBP"
      },
      "recipientId": "{recipientId}"
    }
  }'

If your request is successful, you'll receive a 200 response. In production, you'll also receive OrderCreated. OrderCompleted, BoxCredited, and BoxDebited webhooks (not necessarily in that order). In sandbox, an order is never marked as completed — so you'll only receive the OrderCreated webhook.

Copy
Copied
{
  "orderId": "E2T0A7VKQEKB",
  "trade": {
    "rate": 0.9920634921,
    "inverseRate": 1.008,
    "from": {
      "amount": 80,
      "currency": "GBP"
    },
    "to": {
      "amount": 79.37,
      "currency": "USD"
    }
  },
  "settlement": {
    "date": "20240508",
    "price": {
      "amount": 80,
      "currency": "GBP"
    },
    "charges": {
      "fee": 0
    }
  }
}

Next