Orders
sword.orders.create() orders:writeCreate an order
Creates a one-time order and its deposit address. Give checkoutUrl to the customer, or to the sword-checkout button.
- An order is open for 20 minutes.
- Each reference makes exactly one order; using it again answers 409 ORDER_EXISTS.
POST
https://sword-api-cadalt-d47a7a90dc84.herokuapp.com/v1/ordersPaste a test API key above to try it.
Authorization
Authorization: Bearer sk_test_… · sword-merchant sends it from apiKey or SWORD_API_KEY.
Body
amountstringrequiredDecimal amount, up to 6 decimals, such as "1.50". In your chain's stablecoin: USDT on Whitechain, USDC on Arc.
referencestringrequiredYour own id for the order, such as an invoice or cart id. Up to 128 characters.
refundDaysintegeroptionalDays after payment the customer may ask for a refund, 1 to 365. Default 7.
Create an order
import { Sword } from "sword-merchant";
const sword = new Sword({ apiKey: process.env.SWORD_API_KEY });
const order = await sword.orders.create({ amount: "0.001", reference: "playground" });
console.log(order);Example · The new order, pending payment.
{
"object": "order",
"id": "0x988b97f4c74ce8bf251de75e5791223464696d985112c4877d2c4c41b3794036",
"reference": "order-42",
"amount": "1",
"currency": "USDT",
"status": "pending",
"expiresAt": "2026-11-06T10:40:00.000Z",
"payer": null,
"paidAt": null,
"paymentTransaction": null,
"withdrawn": false,
"refund": {
"status": "none",
"requested": "0",
"approved": "0",
"refunded": "0"
},
"createdAt": "2026-11-06T10:20:00.000Z",
}