Skip to content

Expiry

Every Cash App order has an expiresAt timestamp (ms since epoch). When it elapses, the SDK emits cashApp:orderExpired and clears the active order.

When to use

Show a countdown on the checkout screen and handle expired UI (create a new order or go back).

Methods & helpers

APIPurpose
client.cashApp.getActiveOrderExpiresAt()Active order’s expiresAt, or null
getCashAppOrderTimeLeftMs(expiresAt)Milliseconds remaining, or null when there is no expiry
getCashAppOrderTimeLeft(timeLeftMs){ hours, minutes, seconds } from remaining ms
isCashAppOrderExpired(expiresAt)Whether time is up

Import helpers from @swapped/connect-sdk.

Example

ts
import {
  getCashAppOrderTimeLeft,
  getCashAppOrderTimeLeftMs,
  isCashAppOrderExpired,
} from '@swapped/connect-sdk';

const expiresAt = client.cashApp.getActiveOrderExpiresAt();

if (expiresAt !== null) {
  const timeLeftMs = getCashAppOrderTimeLeftMs(expiresAt) ?? 0;
  const { hours, minutes, seconds } = getCashAppOrderTimeLeft(timeLeftMs);
  console.log(`Time left: ${hours}:${minutes}:${seconds}`);
  console.log('expired?', isCashAppOrderExpired(expiresAt));
}

client.cashApp.onOrderExpired(({ order }) => {
  // Show “order expired”; offer create again
  console.log('expired', order.id);
});

For a live ticking UI in vanilla JS, poll getCashAppOrderTimeLeftMs on an interval, or subscribe to onOrderExpired for the end state. In React, prefer useCashAppOrderCountdown.

Notes

  • Expiry is per order, not a Coinbase-style submission cooldown.
  • After expiry, create a new order — do not reuse the old checkout links.

Errors

Expiry helpers do not throw. Order creation errors are covered in Orders and Errors.