Skip to main content

TypeScript Types

The examples below use the published 9.1.0 declarations. Import CreateCheckoutResult, PayApiError, PayoutClientOptions, CreatePayoutOptions and ListPayoutsParams from @zkp2p/pay-sdk. The examples use CheckoutOrderBase to show fields shared by both order variants and PaymentPayout as a local name for CheckoutPayment['payout']. @zkp2p/pay-sdk re-exports the order, payment, merchant, webhook payload, dispute and payout types. Its payout re-exports are:

  • PayoutView, CreatePayoutRequest, CreatePayoutResponse, ListPayoutsResponse
  • PayoutStatusType, PayoutFundingStatusType, PayoutAttemptStatusType, PayoutCancelSourceType
  • PayoutWebhookPayload, PayoutWebhookEventTypeValue, PayoutPartialPayment, PayoutPartialFillView, PayoutSettlementBreakdown
  • PayoutCurrencyType, PayoutFiatValue
  • The values PayoutCurrency, PayoutStatus, PayoutFundingStatus, PayoutAttemptStatus, PayoutCancelSource, PAYOUT_WEBHOOK_VERSION and isPayoutWebhook

Rail, payout-provider and payout-kind types, tier and chargeback types, PAYOUT_WEBHOOK_EVENT_TYPES and OrderWebhookEventTypeValue come only from @zkp2p/pay-shared.

import { PayApiError, PayoutStatus, isPayoutWebhook } from '@zkp2p/pay-sdk';
import type {
CreateOrderRequest,
CreateOrderResponse,
CheckoutOrder,
OpenAmountInput,
CheckoutPayment,
MerchantProfile,
ReferralSplitConfig,
PayoutView,
CreatePayoutRequest,
CreatePayoutResponse,
ListPayoutsResponse,
PayoutWebhookPayload,
PayoutClientOptions,
CreatePayoutOptions,
ListPayoutsParams,
WebhookPayload,
} from '@zkp2p/pay-sdk';
import type {
PayoutRailType,
PayoutProviderType,
PayoutKindType,
MerchantTierName,
PaymentChargebackFact,
} from '@zkp2p/pay-shared';

Create Order Request​

type CreateOrderRequest = (
| {
requestedUsdcAmount: string;
openAmount?: never;
requestedFiatAmount?: never;
requestedFiatCurrency?: never;
}
| {
requestedUsdcAmount?: never;
requestedFiatAmount: string;
requestedFiatCurrency: string;
openAmount?: never;
}
| {
requestedUsdcAmount?: never;
requestedFiatAmount?: never;
requestedFiatCurrency?: never;
// The customer types the amount in checkout. See /sdk/open-amount.
openAmount: OpenAmountInput;
}
) & {
idempotencyKey?: string;
destinationAddress?: string;
destinationToken?: string;
destinationChainId?: number;
feePayer?: FeePayerType;
// SPLIT only: the customer's share of total fees, 0–10000 bps in steps of 1000.
buyerFeeShareBps?: number;
// false turns dynamic orders off for this order; omitted uses your default;
// true while your default is off fails with 400 DYNAMIC_ORDERS_DISABLED.
dynamicOrdersEnabled?: boolean;
enabledRails?: string[];
// Whole minutes the checkout stays open, 30–10080 (7 days); omitted, the order never expires.
// See /sdk/create-session#checkout-expiry.
expiresInMinutes?: number;
successUrl?: string | null;
cancelUrl?: string | null;
notes?: Record<string, unknown> | null;
};
type OpenAmountInput = {
currency: string; // ISO currency of minAmount, maxAmount and presets
minAmount?: string; // at most 2 decimals, in currency
maxAmount?: string;
presets?: string[]; // 1 to 6 suggested amounts
};

idempotencyKey is 8–128 letters, digits, underscores or hyphens. See idempotent order creation.

Create Order Response​

type CreateOrderResponse = {
order: CheckoutOrder;
} & (
| { orderToken: string; idempotentReplay?: never }
| { orderToken: null; idempotentReplay: true }
);

Checkout Result (SDK helper)​

type CreateCheckoutResult = CreateOrderResponse & {
checkoutUrl: string | null;
};

Checkout Order​

CheckoutOrder is a union on amountMode. Narrow it before reading the amounts:

type CheckoutOrder = FixedAmountCheckoutOrder | OpenAmountCheckoutOrder;

type FixedAmountCheckoutOrder = CheckoutOrderBase & {
amountMode: 'FIXED';
requestedUsdcAmount: string;
remainingUsdcAmount: string;
};

type OpenAmountCheckoutOrder = CheckoutOrderBase & {
amountMode: 'OPEN';
// null until the customer starts a payment, which saves the amount
requestedUsdcAmount: string | null;
remainingUsdcAmount: string | null;
openAmount: OpenAmountConfig;
// 0 until the first save; goes up by one per save
amountVersion: number;
};

// Normalized: upper-case currency, 2-decimal amounts, presets ascending.
type OpenAmountConfig = {
currency: string;
minAmount: string | null;
maxAmount: string | null;
presets: string[];
};

type CheckoutOrderBase = {
id: string;
merchantId: string;
// The checkout grant this order was made from; null unless the buyer started it
// from a grant link and set the destination themselves.
checkoutGrantId: string | null;
status: CheckoutOrderStatusType;
// Recorded after settlement; never change `status`.
chargebackStatus: OrderChargebackStatusType;
chargebacks: PaymentChargebackFact[];
refundStatus: CheckoutOrderRefundStatusType;
refundAmountUsdc: string | null;
refundDepositId: string | null;
refundTransactionHash: string | null;
refundMetadata: unknown | null;
inPersonCheckout: boolean;
// Hosted read only: Apple Pay charge for the remaining balance, fees included.
// null when Apple Pay is off or the charge can't be priced.
applePayChargeUsdcAmount?: string | null;
// Hosted read only: banks available to this order. An empty list disables Zelle.
zellePaymentMethodIds?: string[];
destinationAddress: string;
destinationToken: string;
destinationChainId: string;
feePayer: FeePayerType;
buyerFeeShareBps: number;
enabledRails: string[];
successUrl: string | null;
cancelUrl: string | null;
notes: unknown | null;
metadata: unknown | null;
// Hosted read only: your fiat price, on a fiat-priced order not resized or partly paid.
requestedFiat?: { amount: string; currency: string } | null;
bridgeInfo?: OrderBridgeInfo | null;
referralSplitConfig: ReferralSplitConfig | null;
// From the create request's expiresInMinutes; null when the order never expires.
expiresAt?: string | null;
cancelledAt: string | null;
completedAt: string | null;
createdAt: string;
updatedAt: string | null;
};

On the hosted read (GET /api/v1/orders/{orderId}), an open-amount order's openAmount also carries effectiveMin and effectiveMax (the allowed range in its currency; null while the amount is locked, once the order is FULFILLED or CANCELLED, or while no exchange rate is available) and savedInput ({ amount, currency } the customer saved, or null). The order also carries amountLock: null while the amount can change, otherwise PAYMENT_IN_PROGRESS, PAYMENT_MAY_SETTLE or PAID.

Every order the API returns, from reads and webhooks, also carries cryptoReferralSplitConfig: ReferralSplitConfig | null, the referral split for crypto payments. The shared type doesn't declare it.

Payment​

type CheckoutPayment = {
id: string;
orderId: string;
status: CheckoutPaymentStatusType;
payout: PaymentPayout; // see Deferred payment payout below
// Recorded after settlement; never change `status`.
chargebackStatus: PaymentChargebackStatusType;
chargeback: PaymentChargebackFact | null;
penalties: PaymentPenalty[];
rail: string;
// Zelle only: the customer's bank ('zelle-chase' | 'zelle-bofa' | 'zelle-citi' |
// 'zelle-capitalone'). Display only; `rail` stays 'zelle'. null on other rails.
paymentMethodId: string | null;
proofMode: 'buyerTee';
attestation: { serviceUrl: string };
currency: string;
payTo: string;
// Payment partner rating from 1.0 to 5.0, one decimal.
recipientRating: number;
quote: CheckoutPaymentQuote;
quoteExpiresAt: string;
memoPolicy: 'NONE' | 'REQUIRED' | 'EMPTY';
suggestedMemo: string | null;
paymentAmount: string;
currencyPerUsdRate: string;
netSettledUsdcAmount: string | null;
totalUsdcFeeAmount: string;
referralFees: { recipient: string; feeUsdc: string }[] | null;
railIdentifier: string | null;
fulfillTransaction: string | null;
errorCode?: string | null;
errorMessage?: string | null;
completedAt: string | null;
createdAt: string;
updatedAt: string | null;
};

The hosted API also returns buyerCancelBlock and buyerMayHavePaid. To read them with the 9.1.0 declarations, narrow the response with 'buyerCancelBlock' in payment and check for 'MARKED_PAID' or 'EXTENDED', and with 'buyerMayHavePaid' in payment for the boolean.

Chargeback Fact​

Carried on CheckoutOrder.chargebacks, CheckoutPayment.chargeback, and the data.trigger of chargeback webhooks. See chargeback status.

type PaymentChargebackFact = {
paymentId: string;
intentHash: string;
disputeId: string;
status: 'CHARGEBACKED';
compensatedUsdcAmount: string;
disputedAt: string;
disputeTxHash: string;
refundOverlap:
| 'NONE'
| 'PENDING_HALTED'
| 'SUBMITTING_OR_UNKNOWN'
| 'ALREADY_SUBMITTED'
| 'ALREADY_REFUNDED';
bridgeOrSweepOverlap: null | {
paymentBridgeId: string;
status: 'PENDING' | 'SUBMITTED' | 'COMPLETED' | 'FAILED';
};
};

Payment Penalty​

const PaymentPenaltyKind = {
PURCHASE_PROTECTION: 'PURCHASE_PROTECTION',
CROSS_CURRENCY: 'CROSS_CURRENCY',
} as const;
type PaymentPenaltyKindType = (typeof PaymentPenaltyKind)[keyof typeof PaymentPenaltyKind];

type PaymentPenalty = {
kind: PaymentPenaltyKindType;
penaltyBps: number;
originalAmount: string;
attestedAmount: string;
};

CheckoutPayment.penalties lists the reductions applied to the credited amount, in REST responses and on every webhook that carries a payment. It is always present and empty when none apply.

  • penaltyBps is the rate actually applied. Rates can change, so read it instead of assuming a rate per platform.
  • originalAmount and attestedAmount are the amounts before and after the penalty, as 2-decimal strings in payment.currency.
  • Entries are in the order applied: CROSS_CURRENCY first, then PURCHASE_PROTECTION, so a second entry's originalAmount equals the first entry's attestedAmount. For a cross-currency entry, originalAmount is already converted to the payment currency.

paymentAmount depends on who pays fees. When you pay them, it is the amount the customer sent (the first entry's originalAmount): the order still fulfils in full and you absorb the penalty. When the customer pays them, it is the reduced amount credited (the last entry's attestedAmount), so the order shows the shortfall.

Merchant Types​

// 'BASE' is a closed plan: only accounts already on it report it, and none can select it.
type MerchantTierName = 'BASE' | 'PRO' | 'CONCIERGE';

type MerchantProfile = {
id: string;
name: string;
logoUrl: string | null;
industryType: string | null;
industryOtherText: string | null;
integrationPath: MerchantIntegrationPathValue | null;
onboardingCompletedAt: string | null;
onboardingSkippedAt: string | null;
ownerIdentityVerifiedAt: string | null;
// When the live plan was activated; live order creation needs it, a tier alone
// is not enough. Read from the live merchant in a Sandbox workspace.
planActivatedAt: string | null;
apiKey: string;
// CIDR entries allowed to use the API key; empty means the allowlist is off.
// See /api#ip-allowlist.
apiKeyIpAllowlist: string[];
environment: MerchantEnvironmentType;
sandboxMerchantId: string | null;
inPersonCheckoutEnabled: boolean;
evmWalletAddress: string | null;
solanaWalletAddress: string | null;
v1EvmWalletAddress: string | null;
v1SolanaWalletAddress: string | null;
// New accounts start on PRO, not yet activated: check planActivatedAt.
tier: MerchantTierName | null;
// The Master Merchant Account that created this sub merchant; null otherwise.
masterMerchantId: string | null;
createdAt: string;
updatedAt: string | null;
merchantConfig: MerchantConfig | null;
merchantUsers: MerchantUser[];
};

Webhook Types​

The payload types (OrderWebhookPayload, PayoutWebhookPayload, DisputeWebhookPayload and their union WebhookPayload) are under payload structure. The event-type groups and payout parts they use:

type WebhookEventTypeValue = (typeof WebhookEventType)[keyof typeof WebhookEventType];

/** Payout events carry a PayoutView, not the order envelope. */
const PAYOUT_WEBHOOK_EVENT_TYPES = [
WebhookEventType.PAYOUT_ORDER_CREATED,
WebhookEventType.PAYOUT_ORDER_CANCELLED,
WebhookEventType.PAYOUT_ORDER_PARTIALLY_FUNDED,
WebhookEventType.PAYOUT_ORDER_FUNDED,
WebhookEventType.PAYOUT_ORDER_MATCHED,
WebhookEventType.PAYOUT_ORDER_PARTIALLY_PAID,
WebhookEventType.PAYOUT_ORDER_SETTLED,
WebhookEventType.PAYOUT_ORDER_EXPIRED,
] as const;
type PayoutWebhookEventTypeValue = (typeof PAYOUT_WEBHOOK_EVENT_TYPES)[number];

const DISPUTE_WEBHOOK_EVENT_TYPES = [
WebhookEventType.DISPUTE_OPENED,
WebhookEventType.DISPUTE_PAID,
WebhookEventType.DISPUTE_ESCALATED,
] as const;
type DisputeWebhookEventTypeValue = (typeof DISPUTE_WEBHOOK_EVENT_TYPES)[number];

type OrderWebhookEventTypeValue = Exclude<WebhookEventTypeValue, PayoutWebhookEventTypeValue | DisputeWebhookEventTypeValue>;

const PAYOUT_WEBHOOK_VERSION = 2; // bumped only on a breaking payout payload change

type PayoutPartialFillView = {
fiat: PayoutFiatValue | null; // at that payment's rate; null when unknown
amount: string; // USDC this buyer paid
txHash: string;
paidAt: string;
};

// Where a SETTLED payout's USDC went; USDC, "0.00" for a part that didn't happen.
type PayoutSettlementBreakdown = {
buyerPaidAmount: string; // paid by buyers across every listing
buyerPaidFiat: PayoutFiatValue[] | null; // first-paid order; null if any unknown, [] if no buyer paid
sentAmount: string; // sent as crypto, a whole payout or a remainder
sentTo: string | null; // the customer's crypto address; EVM lower-case
returnedAmount: string; // left in, or returned to, the customer's Peer wallet
dustAmount: string; // swept by the escrow when it closed the listing
refundFeeAmount: string; // lost on bridge refunds
};

// One buyer payment that paid part of a listing; PAYOUT_ORDER_PARTIALLY_PAID only.
type PayoutPartialPayment = {
expectedAmount: string; // the payout's depositAmount
paidAmount: string; // paid so far, this payment included
remainingAmount: string; // expectedAmount − paidAmount
fill: { amount: string; txHash: string; fiat: PayoutFiatValue | null };
};

function isPayoutWebhook(payload: WebhookPayload): payload is PayoutWebhookPayload;
function isDisputeWebhook(payload: WebhookPayload): payload is DisputeWebhookPayload;

isPayoutWebhook(payload) narrows to a PayoutWebhookPayload, whose data is a PayoutView; isDisputeWebhook(payload) narrows to a DisputeWebhookPayload. Anything else is an OrderWebhookPayload.

Seller dispute types​

The SDK re-exports DisputeWebhookPayload, DisputeWebhookEventTypeValue, DisputeWebhookData, DisputeView, DisputeStatusType, DisputeStatus, DISPUTE_WEBHOOK_VERSION and isDisputeWebhook.

const DisputeStatus = { OPEN: 'OPEN', PAID: 'PAID', ESCALATED: 'ESCALATED' } as const;
type DisputeStatusType = (typeof DisputeStatus)[keyof typeof DisputeStatus];
const DISPUTE_WEBHOOK_VERSION = 1;

type DisputeWebhookData = {
disputeId: string;
orderId: string;
paymentId: string;
intentHash: string;
amountUsdc: string; // raw 6-decimal units, "12500000" = 12.5 USDC
caseAmount: string; // 2-decimal fiat amount, "12.40"
caseCurrency: string;
sellerAddress: string;
status: DisputeStatusType;
dueAt: string; // ISO 8601
paidTxHash: string | null;
};

DisputeView is the dispute record the merchant dashboard shows. See dispute events.

Payout types​

These come from @zkp2p/pay-shared and are re-exported by @zkp2p/pay-sdk. See Payouts for the client calls and the PayoutView fields for what each field means.

/** Never includes the Peer fee, the customer's email, wallet or payee handle. */
interface PayoutView {
payoutCurrency: PayoutCurrencyType | null; // null for crypto or no method
payoutId: string;
merchantReference: string | null;
/** The checkout grant this payout was made from; null unless the customer started and funds it. */
checkoutGrantId: string | null;
status: PayoutStatusType;
fundingStatus: PayoutFundingStatusType;
payout: { amount: string; chainId: number; tokenAddress: string; decimals: number };
merchantFee: { bps: number; amount: string };
/** A sub merchant's Master Merchant Account payout fee; bps 0 and amount "0.00" when none applies. */
masterMerchantPayoutFee: { bps: number; amount: string };
funding: {
chainId: number;
tokenAddress: string;
decimals: number;
amount: string; // to send, in the funding token
sentAmount: string; // sent before the deadline, in the funding token
missingAmount: string; // amount − sentAmount, never below zero
expectedAmount: string; // USDC the quote delivers: payout plus buffer
receivedAmount: string; // USDC that reached the customer's wallet on Base
depositAddress: string | null; // null once the payout can no longer be funded
quoteExpiresAt: string; // funding deadline
};
depositAmount: string | null;
paidAmount: string; // paid by buyers across every listing
partialFills: PayoutPartialFillView[];
settlement: PayoutSettlementBreakdown | null; // only when SETTLED
attempt: { kind: PayoutKindType; rail: string | null; status: PayoutAttemptStatusType } | null;
/** Only when settled with crypto sent, including a remainder sent to an address. */
payoutTransfer: {
chainId: number;
tokenAddress: string;
decimals: number;
address: string; // the customer's address; EVM checksummed
amount: string; // delivered, in the destination token
txHash: string; // the delivering transaction on chainId
usdcTxHash: string; // the USDC transfer on Base; equals txHash when provider is null
provider: PayoutProviderType | null; // RELAY or NEAR_INTENTS; null for direct Base USDC
} | null;
cancelSource: PayoutCancelSourceType | null;
returnUrl: string | null;
expiresAt: string;
fundedAt: string | null;
settledAt: string | null;
cancelledAt: string | null;
createdAt: string;
}

/** A replay with the same key and body returns a current checkout link, marked `idempotentReplay: true`. */
type CreatePayoutResponse = PayoutView & { checkoutUrl: string; idempotentReplay: boolean };

interface ListPayoutsResponse {
items: PayoutView[];
page: number;
limit: number;
total: number;
}

interface CreatePayoutRequest {
merchantReference?: string;
customerEmail: string;
payout: { amount: string; chainId: number; tokenAddress: string };
funding: { chainId: number; tokenAddress: string; refundAddress?: string };
returnUrl?: string;
rails?: PayoutRailType[]; // non-empty, unique; narrows the offered rails, never widens
}

PayoutStatus, PayoutFundingStatus, PayoutCancelSource and PayoutAttemptStatus are values exported by both packages, with their Type aliases. PayoutKind and PayoutKindType come only from @zkp2p/pay-shared.

const PayoutStatus = {
AWAITING_FUNDING: 'AWAITING_FUNDING',
FUNDED: 'FUNDED',
READY: 'READY',
LISTING: 'LISTING',
PAYING: 'PAYING',
SETTLED: 'SETTLED',
CANCELLED: 'CANCELLED',
EXPIRED: 'EXPIRED',
} as const;

const PayoutFundingStatus = {
AWAITING_FUNDING: 'AWAITING_FUNDING',
PARTIALLY_FUNDED: 'PARTIALLY_FUNDED',
FUNDED: 'FUNDED',
FUNDING_EXPIRED: 'FUNDING_EXPIRED',
} as const;

const PayoutCancelSource = {
MERCHANT: 'MERCHANT',
PEER_APP: 'PEER_APP',
} as const;

const PayoutKind = { ESCROW: 'ESCROW', CRYPTO: 'CRYPTO' } as const;

const PayoutAttemptStatus = {
ACTIVE: 'ACTIVE',
CLOSED: 'CLOSED',
SETTLED: 'SETTLED',
FAILED: 'FAILED',
} as const;

These client types are SDK-only:

/** Server-side only: every call sends your secret API key. */
type PayoutClientOptions = {
apiBaseUrl: string;
apiKey: string;
fetcher?: typeof fetch;
signal?: AbortSignal;
};

type CreatePayoutOptions = {
/** Stable per payout (e.g. your withdrawal id); a retry with the same key and body returns the same payout. */
idempotencyKey: string;
};

type ListPayoutsParams = {
customerEmail?: string;
status?: PayoutStatusType;
merchantReference?: string;
page?: number;
limit?: number;
};

Payout currency types​

Customers can receive catalog currencies on PayPal and Revolut; you still fund and see USD, and all payout accounting stays in USDC. Fiat amounts are information only.

const PayoutCurrency = {
USD: 'USD', EUR: 'EUR', GBP: 'GBP', AUD: 'AUD', CAD: 'CAD', CHF: 'CHF',
CNY: 'CNY', MXN: 'MXN', NZD: 'NZD', SGD: 'SGD', TRY: 'TRY', ZAR: 'ZAR',
} as const;
type PayoutCurrencyType = (typeof PayoutCurrency)[keyof typeof PayoutCurrency];

interface PayoutFiatValue {
currency: PayoutCurrencyType;
amount: string; // exactly two decimals
}

@zkp2p/pay-shared also exports the catalog and helpers: PAYOUT_CURRENCY_INFO (name, display prefix and minor units per currency), PAYOUT_RAIL_CURRENCIES (each payout app's currencies, USD first), PAYOUT_ORACLE_CURRENCIES (every currency but USD), PAYOUT_CURRENCY_NAMES, isPayoutCurrency, payoutRailPaysCurrency and isPayoutMultiCurrencyRail (true for a payout app with more than one currency).

Payout rail types​

PayoutRail lists the six fiat payout apps, then the thirteen crypto networks. The customer sees the crypto networks as one Crypto option. The retired crypto value is rejected. See the per-network coin list.

const PayoutFiatRail = {
VENMO: 'venmo',
CASHAPP: 'cashapp',
PAYPAL: 'paypal',
WISE: 'wise',
ZELLE: 'zelle',
REVOLUT: 'revolut',
CHIME: 'chime',
} as const;
type PayoutFiatRailType = (typeof PayoutFiatRail)[keyof typeof PayoutFiatRail];

const PayoutCryptoRail = {
RELAY_1: 'relay_1',
RELAY_10: 'relay_10',
RELAY_56: 'relay_56',
RELAY_137: 'relay_137',
RELAY_480: 'relay_480',
RELAY_999: 'relay_999',
RELAY_5042: 'relay_5042',
RELAY_8453: 'relay_8453',
RELAY_42161: 'relay_42161',
RELAY_8253038: 'relay_8253038',
RELAY_728126428: 'relay_728126428',
RELAY_792703809: 'relay_792703809',
NEAR_INTENTS_133701: 'near_intents_133701',
} as const;
type PayoutCryptoRailType = (typeof PayoutCryptoRail)[keyof typeof PayoutCryptoRail];

const PayoutRail = { ...PayoutFiatRail, ...PayoutCryptoRail } as const;
type PayoutRailType = PayoutFiatRailType | PayoutCryptoRailType;

const PayoutProvider = { RELAY: 'RELAY', NEAR_INTENTS: 'NEAR_INTENTS' } as const;
type PayoutProviderType = (typeof PayoutProvider)[keyof typeof PayoutProvider];

SDK Errors​

Thrown by every SDK call when the API answers with a non-2xx status or a success: false envelope. See error handling.

class PayApiError extends Error {
readonly statusCode: number;
readonly errorCode?: string;
readonly responseObject?: unknown;
readonly fieldErrors?: Readonly<Record<string, readonly string[]>>;
readonly formErrors?: readonly string[];
}

Constants​

The order, payment, chargeback, refund and webhook delivery status constants are on order status.

const FeePayer = {
MERCHANT: 'MERCHANT',
PAYEE: 'PAYEE',
SPLIT: 'SPLIT',
} as const;

const WebhookEventType = {
ORDER_CREATED: 'ORDER_CREATED',
ORDER_FULFILLED: 'ORDER_FULFILLED',
ORDER_CANCELLED: 'ORDER_CANCELLED',
ORDER_RESIZED: 'ORDER_RESIZED',
ORDER_AMOUNT_SET: 'ORDER_AMOUNT_SET',
PAYMENT_CREATED: 'PAYMENT_CREATED',
PAYMENT_SETTLED: 'PAYMENT_SETTLED',
PAYMENT_PAYOUT_RELEASED: 'PAYMENT_PAYOUT_RELEASED',
PAYMENT_CANCELLED: 'PAYMENT_CANCELLED',
PAYMENT_EXPIRED: 'PAYMENT_EXPIRED',
PAYMENT_FAILED: 'PAYMENT_FAILED',
REFUND_PENDING: 'REFUND_PENDING',
REFUND_COMPLETED: 'REFUND_COMPLETED',
PAYMENT_BRIDGE_PENDING: 'PAYMENT_BRIDGE_PENDING',
PAYMENT_BRIDGE_SUBMITTED: 'PAYMENT_BRIDGE_SUBMITTED',
PAYMENT_BRIDGE_COMPLETED: 'PAYMENT_BRIDGE_COMPLETED',
PAYMENT_BRIDGE_FAILED: 'PAYMENT_BRIDGE_FAILED',
PAYMENT_CHARGEBACKED: 'PAYMENT_CHARGEBACKED',
ORDER_PARTIALLY_CHARGEBACKED: 'ORDER_PARTIALLY_CHARGEBACKED',
ORDER_CHARGEBACKED: 'ORDER_CHARGEBACKED',
PAYOUT_ORDER_CREATED: 'PAYOUT_ORDER_CREATED',
PAYOUT_ORDER_CANCELLED: 'PAYOUT_ORDER_CANCELLED',
PAYOUT_ORDER_PARTIALLY_FUNDED: 'PAYOUT_ORDER_PARTIALLY_FUNDED',
PAYOUT_ORDER_FUNDED: 'PAYOUT_ORDER_FUNDED',
PAYOUT_ORDER_MATCHED: 'PAYOUT_ORDER_MATCHED',
PAYOUT_ORDER_PARTIALLY_PAID: 'PAYOUT_ORDER_PARTIALLY_PAID',
PAYOUT_ORDER_SETTLED: 'PAYOUT_ORDER_SETTLED',
PAYOUT_ORDER_EXPIRED: 'PAYOUT_ORDER_EXPIRED',
DISPUTE_OPENED: 'DISPUTE_OPENED',
DISPUTE_PAID: 'DISPUTE_PAID',
DISPUTE_ESCALATED: 'DISPUTE_ESCALATED',
} as const;

const OrderAmountMode = {
FIXED: 'FIXED',
OPEN: 'OPEN',
} as const;

// Why the customer can no longer change an open order's amount.
const AmountLockReason = {
PAYMENT_IN_PROGRESS: 'PAYMENT_IN_PROGRESS', // a payment is open; cancelling it unlocks the amount
PAYMENT_MAY_SETTLE: 'PAYMENT_MAY_SETTLE', // a payment can still settle late
PAID: 'PAID', // a payment settled
} as const;

const OpenAmountErrorCode = {
OPEN_AMOUNT_INVALID: 'OPEN_AMOUNT_INVALID',
OPEN_AMOUNT_DISABLED: 'OPEN_AMOUNT_DISABLED',
AMOUNT_REQUIRED: 'AMOUNT_REQUIRED',
AMOUNT_NOT_ALLOWED: 'AMOUNT_NOT_ALLOWED',
AMOUNT_OUT_OF_RANGE: 'AMOUNT_OUT_OF_RANGE',
AMOUNT_LOCKED: 'AMOUNT_LOCKED',
AMOUNT_CONFLICT: 'AMOUNT_CONFLICT',
RESIZE_NOT_SUPPORTED: 'RESIZE_NOT_SUPPORTED',
} as const;

Deferred payment payout​

CheckoutPayment.payout describes a checkout payment's USDC under deferred payouts. It is unrelated to customer payouts.

type PaymentPayout = {
status: 'PAID' | 'HELD' | 'RELEASED' | 'DISPUTED' | null;
releaseEligibleAt: string | null; // ISO 8601
releasedAt: string | null; // ISO 8601
};

All three are null before settlement. A held payout doesn't undo SETTLED or the order's fulfillment.