createCheckoutTransaction
Creates a new checkout transaction for a specified amount and currency. This is the first step in the checkout flow, returning a transaction object with an ID used for all subsequent operations. Before calling this function, ensure you have a validcheckoutId from your Dynamic dashboard. If no checkoutId is provided, the SDK falls back to the first checkout configured for your environment.
Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
amount | string | The payment amount (e.g., '25.00'). |
currency | string | The fiat currency code (e.g., 'USD'). |
checkoutId | string (optional) | The checkout configuration ID from the Dynamic dashboard. Falls back to the first configured checkout if omitted. |
destinationAddresses | DestinationAddress[] (optional) | Settlement addresses for receiving funds. Each entry has an address and chain. |
expiresIn | number (optional) | Time in seconds before the transaction expires. |
memo | object (optional) | Arbitrary metadata to attach to the transaction. |
DestinationAddress
| Field | Type | Description |
|---|---|---|
address | string | The wallet address to receive settlement funds. |
chain | Chain | The blockchain chain (e.g., 'EVM', 'SOL'). |
Returns
Promise<CheckoutTransactionCreateResponse> - A promise that resolves to the created transaction:
CheckoutTransaction object includes:
Examples
Basic checkout
With destination addresses
With expiration and metadata
Related
Checkout Flow- End-to-end checkout guideattachCheckoutTransactionSource- Attach a wallet source to the transactiongetCheckoutTransactionQuote- Get a conversion quotesubmitCheckoutTransaction- Submit the transaction for signing and broadcastcancelCheckoutTransaction- Cancel a pending transaction