Create Payment Link
Generate a payment link that customers can use to complete checkout. Payment links automatically handle HSA/FSA eligibility detection and can be used for both one-time and recurring payments.Authentication
Request Body
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount_cents | integer | Yes | Total amount in cents |
currency | string | Yes | ISO 4217 currency code (e.g., “USD”) |
description | string | Yes | Description of the payment |
customer | object | No | Pre-fill customer information |
customer.email | string | No | Customer email |
customer.first_name | string | No | Customer first name |
customer.last_name | string | No | Customer last name |
products | array | No | Product line items |
products[].merchant_product_id | string | Yes* | Your product reference ID |
products[].name | string | Yes* | Product name |
products[].quantity | integer | Yes* | Quantity |
products[].price_cents | integer | Yes* | Unit price in cents |
payment_type | enum | No | one_time or subscription (default: one_time) |
subscription | object | No | Required if payment_type is subscription |
subscription.interval | enum | Yes* | daily, weekly, monthly, yearly |
subscription.interval_count | integer | No | Number of intervals (default: 1) |
subscription.trial_period_days | integer | No | Free trial days |
success_url | string | Yes | Redirect URL after successful payment |
cancel_url | string | No | Redirect URL if customer cancels |
metadata | object | No | Custom key-value pairs |
expires_at | timestamp | No | When link expires (default: 15 days) |
Response
Examples
One-Time Payment
Subscription Payment
Pre-filled Customer Information
Multiple Products
Subscription Intervals
| Interval | interval_count | Billing Frequency |
|---|---|---|
daily | 1 | Every day |
daily | 7 | Every 7 days |
weekly | 1 | Every week |
weekly | 2 | Every 2 weeks (bi-weekly) |
monthly | 1 | Every month |
monthly | 3 | Every 3 months (quarterly) |
yearly | 1 | Every year |
Payment Link Status
| Status | Description |
|---|---|
active | Link is active and ready for payment |
expired | Link has expired (past expires_at time) |
paid | Payment completed successfully |
cancelled | Link was cancelled |
Webhooks
Payment links trigger the following webhook events:payment_link.created- Link createdpayment_link.paid- Payment completedpayment_link.expired- Link expiredorder.created- Order created from payment
Errors
| Status Code | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Missing or invalid parameters |
| 400 | invalid_amount | Amount must be positive integer in cents |
| 400 | invalid_currency | Unsupported currency code |
| 401 | unauthorized | Invalid or missing API key |
| 422 | validation_error | Field validation failed |
| 429 | rate_limit_exceeded | Too many requests |
Use Cases
Email Invoices
Membership Checkout
QR Code Checkout
Best Practices
Set Expiration
Use
expires_at to prevent stale links from being usedPre-fill Customer Data
Include customer info to speed up checkout
Use Metadata
Track links with custom metadata for analytics
Handle Webhooks
Listen for
payment_link.paid to fulfill ordersRelated Endpoints
- Get Payment Link - GET /v2/payment-links/
- List Payment Links - GET /v2/payment-links
- Cancel Payment Link - POST /v2/payment-links//cancel
