Skip to main content

Dynamic Orders

Dynamic Orders recover a checkout when no liquidity covers the exact order amount. Checkout shows the customer specific nearby amounts that are available now. If the customer picks one, the order amount changes, payment options reload, and you receive an ORDER_RESIZED webhook.

Enable Dynamic Orders​

Dynamic Orders are off by default. An owner or manager turns them on in the merchant dashboard:

  1. Open Settings, Payments and expand Advanced.
  2. Turn on Resizable orders.
  3. Choose Save in the bar at the bottom of the page.

The setting is the default for new orders and does not change existing ones. Each workspace has its own setting, so turn it on in each one you use, sandbox included. From a terminal, use peer-pay-cli merchant settings --dynamic-orders-enabled true.

Create an order​

Omit dynamicOrdersEnabled when calling createCheckout, and new orders inherit the account setting:

import { createCheckout } from '@zkp2p/pay-sdk';

const checkout = await createCheckout(
{
requestedFiatAmount: '100.00',
requestedFiatCurrency: 'USD',
destinationChainId: 8453,
destinationToken: 'USDC',
},
{
apiBaseUrl: 'https://api.pay.peer.xyz',
checkoutBaseUrl: 'https://pay.peer.xyz',
apiKey: process.env.ZKPAY_API_KEY!,
},
);

The field overrides the setting for one order:

ValueBehavior
OmittedInherits the account setting.
falseTurns Dynamic Orders off for this order.
trueAllowed only when the account setting is on. Otherwise order creation returns 400 DYNAMIC_ORDERS_DISABLED.

The resolved value is saved on the order at creation; changing the account setting later does not affect it. Open-amount orders cannot use Dynamic Orders.

Customer experience​

When no fiat payment method can cover the original amount, checkout can show Pay less and Pay more options. Each option is a specific amount backed by a live quote, not a range. When the customer picks one, Peer Pay confirms the order can still change, updates its requested and remaining USDC amounts, reloads payment methods for the new amount, and sends ORDER_RESIZED.

You receive the resized amount, not the amount you sent to createCheckout.

Handle resized orders​

Treat the amounts in data.order and data.resize as authoritative:

{
"type": "ORDER_RESIZED",
"data": {
"order": {
"id": "cmf5k2x9d0001abcd1234efgh",
"requestedUsdcAmount": "95",
"remainingUsdcAmount": "95"
},
"resize": {
"previousAmountUsdc": "100.000000",
"newAmountUsdc": "95.000000"
}
}
}

Update the cart, deposit or account credit to the new amount. On a fiat-priced order, metadata keeps the original fiat price and gains requestAmountResized: true, so reconcile on the USDC amounts. The full payload is under ORDER_RESIZED. Verify the signature and stay idempotent as for any event; see webhook verification.

When suggestions do not appear​

Checkout offers nearby amounts only when the order can be resized and at least one amount passes the pricing and limit checks. There are none when:

  • Dynamic Orders were off when the order was created;
  • an exact quote for the amount is available;
  • the order has a payment attempt, open or expired, that can still settle, or is partly paid;
  • the order is an in-person order;
  • the payout goes outside Base USDC;
  • no nearby quote fits your enabled payment apps, your order size limits or your fee settings. Amounts also stay within the platform minimum and the 10,000 USDC maximum, and a bank or app payment of the amount, fees included, must fit the same per-payment limit.

On Pro, picking a larger amount that would take you past your plan's monthly fiat volume cap fails with 403 MERCHANT_MONTHLY_VOLUME_LIMIT_EXCEEDED, and checkout asks the customer to choose the original or a smaller amount. Smaller amounts are never capped. See monthly caps.

Suggestions are specific amounts backed by live quotes, so the set can change from one moment to the next.