Collect a Payment Request
Finalize, share and collect a receivable without coupling browser sessions to financial state.
After finalization, send the request URL to the customer or use the email delivery endpoint. The hosted request page resolves only customer-safe terms and creates a Checkout Session for the server-calculated remaining balance.
const result = await paybytoken.paymentRequests.send(
paymentRequest.id,
{
recipient_email: 'alex@example.com',
schedule_reminder: true,
reminder_days_before_due: 3,
},
{ idempotencyKey: `payment-request:${paymentRequest.id}:initial-email` },
)
console.log(result.payment_request.url)The send response means delivery was scheduled. It does not prove inbox delivery, customer open or payment. Inspect delivery records separately from the request's financial state.
Customers can retry or resume checkout without creating parallel active allocations. A session expiry ends only that browser interaction; an open Payment Request can create another session.
When the customer opens the hosted URL, Paybytoken calculates the current remaining amount and creates an isolated Checkout Session. Never construct a replacement amount from a stale email, cached public response or your own browser state.
Observe collection state
Use three views for different questions:
| View | Answers |
|---|---|
| Payment Request | How much is still owed? |
| Payments | Which Payment Intents were processing, applied, unapplied or failed? |
| Timeline and deliveries | What happened operationally and when was communication attempted? |
const [current, payments, deliveries, timeline] = await Promise.all([
paybytoken.paymentRequests.get(paymentRequest.id),
paybytoken.paymentRequests.listPayments(paymentRequest.id),
paybytoken.paymentRequests.listDeliveries(paymentRequest.id),
paybytoken.paymentRequests.timeline(paymentRequest.id),
])Use payment_request.paid for receivable completion after signature verification. Use
payment_request.payment_applied when your application must account for a valid partial allocation
without treating the full request as paid.
Important boundaries
- Never create or finalize Payment Requests from browser code with a secret key.
- Never treat the public page, redirect, email status, or customer confirmation as payment proof.
- Request expiry stops new attempts but preserves monitoring for already-issued addresses.
- Confirmed late or excess funds are recorded as unapplied for review.
- A refund does not reopen a paid request.
The public collection endpoints are used by Paybytoken hosted UI:
GET /public/v1/payment_requests/:publicToken
POST /public/v1/payment_requests/:publicToken/checkout_sessionsMerchants normally use the returned hosted url, not these browser-facing endpoints directly.
Public responses omit customer email, merchant metadata, internal references, secrets, and unrelated
attempts.
Did this page answer your question?
Your feedback helps us improve the integration path.