Payments: checkout and withdrawals
Take crypto payments from your server (1.7.0+). A checkout is a payment request for an exact amount that settles to the address you set on your project’s Payments page. Your customer pays in the native coin, USDC or USDT on any network you can be refunded on, and your server is told when it settled. A withdrawal is the reverse: send what you hold and it settles to any chain, asset and address.
Before the first call: set at least one settlement address on the Payments page (one EVM address covers Base, Ethereum, Arbitrum and Polygon; Solana and Tron are optional), turn Payments on, and give your secret key the payments scope (“Accept payments” in the dashboard).
const decane = new DecaneClient({ projectSecret: process.env.DECANE_PROJECT_SECRET });
// 25 USDC (6 decimals). Amounts are always base units.
const checkout = await decane.createCheckout({
amount: "25000000",
orderRef: "order_42",
successUrl: "https://shop.example/thanks",
expiresIn: 600, // seconds, 60 to 3600
});
checkout.url; // the hosted checkout page: send your customer hereWhat the customer sees
The hosted page names your project, then asks which network they pay from and which token. It shows the exact amount, the deposit address, a QR code and the countdown, follows the payment on its own and returns them to your successUrl. They are never asked for a refund address: a payment that cannot settle (too little, too much, too late) is refunded to your address on their network, and you sort it out with them. A network is only offered where you have an address.
With no settlementChainId, a checkout settles on Base when you have an EVM address, then the other EVM chains, then Solana, then Tron.
Knowing it was paid
Decane posts payment.completed (or payment.failed / payment.expired) to your project’s webhook, signed like every Decane webhook. Each is sent once: if your endpoint was down, reconcile with getPayment or listPayments.
// after verifying x-decane-signature over `${timestamp}.${rawBody}`
if (event.event === "payment.completed") {
fulfil(event.data.orderRef ?? event.data.id);
}Every call
decane.createCheckout({ amount, settlementChainId?, orderRef?, successUrl?, metadata?, expiresIn? })
decane.createWithdrawal({ originChainId, originAsset, amount, destChainId, destAsset, destAddress, refundTo })
decane.getPayment(id) // one payment
decane.listPayments(limit?) // newest first
decane.paymentOptions() // what your checkouts can be paid with
decane.createDepositAddress(userRef, settlementChainId?) // a reusable address per userErrors: PAYMENT_ERROR (bad input, an expired checkout, payments off) and PAYMENT_PROVIDER (the deposit router). A key without the payments scope answers INSUFFICIENT_SCOPE.