AApt Commerce
Sign inGet started
Show for

Payment Links

Create a durable, copyable pay-in URL. Opening /pay/:id takes an APT sandbox payment with documented test cards.

Creating a Payment Link

Amounts are cents. 0 means variable (payer-chosen later — still not collected here). Optional customer_id and invoice_id must already exist for your merchant.

const link = await apt.paymentLinks.create({
  name: 'Consulting Fee',
  amount: 5000,          // $50.00; 0 = variable
  currency: 'usd',
  // customer_id / invoice_id optional; must be real D1 ids
});

console.log(link.url);
// "/pay/pl_…" — open for APT sandbox checkout. Test cards only (see /docs/testing). Never a real card.

Options

amountFixed amount in cents, or 0 for variable. Not a capture.
customer_idOptional. Must belong to this merchant.
invoice_idOptional. Must belong to this merchant.

Managing Links

const links = await apt.paymentLinks.list({ limit: 25 });

await apt.paymentLinks.update('pl_abc123', { active: false });

Webhooks

payment_link.created and payment_link.paid are catalog-only. This release does not emit them. Completing a payment through a hosted page is not implemented — do not expect a paid event from creating or opening a link.