Skip to main content

Recurring and installment payments

Create a subscription with POST /api/v1/subscriptions. A subscription charges an active saved card for an existing customer at a location you are authorized to use. ACH subscriptions are not supported.

Create Subscription request

FieldRequirement and meaning
locationIdRequired; approved billing location
customerIdRequired; customer owning the saved card
savedPaymentMethodIdRequired at runtime; active saved card for this customer, even though the schema permits null
planNameRequired nonblank description
amountRequired positive integer in minor currency units; 5000 is USD 50.00
currencyRequired three-letter currency, such as USD
intervalRequired: DAILY, WEEKLY, MONTHLY, QUARTERLY or YEARLY
intervalCountPositive count of intervals; defaults to 1
startDateRequired date (YYYY-MM-DD); determines the billing day
endDateOptional date limiting the subscription's duration
maxCyclesOptional positive number of successful billing cycles before completion
trialPeriodDaysOptional positive trial length in days
itemsOptional list of catalog items: required priceId, positive quantity (default 1), and optional string-to-string metadata map
metadataOptional string map, no more than 50 entries
taxAmountOptional nonnegative tax amount in minor units
purchaseOrderOptional purchase-order reference, up to 64 characters
customerCodeOptional customer reference, up to 64 characters

There is no idempotency header on subscription creation. Persist the returned subscription ID; do not blindly repeat a create after a lost response. Locate the existing subscription before creating another.

USD 50 monthly donation

{
  "locationId": "loc_example",
  "customerId": "cus_example",
  "savedPaymentMethodId": "cpm_example",
  "planName": "Monthly donation",
  "amount": 5000,
  "currency": "USD",
  "interval": "MONTHLY",
  "intervalCount": 1,
  "startDate": "2027-01-15"
}

These are illustrative IDs; replace them with your location, customer and saved card. A start date of today bills immediately unless a configured trial defers charging. For monthly billing, choose the desired billing day in startDate.

USD 600 over 12 monthly payments

Use the same request with planName: "12-payment plan" and maxCycles: 12. Each successful cycle charges 5000 minor units. After 12 successful cycles, status becomes COMPLETED and Peak emits subscription.completed with reason: "MAX_CYCLES" and cyclesBilled: 12. Failures do not count as successful paid cycles. You can also set endDate for a date-bounded subscription; completion then uses reason: "END_DATE".

Cancel or replace a card

Cancel with POST /api/v1/subscriptions/{id}/cancel:

{"cancelAt":"END_OF_CYCLE","reason":"Customer requested cancellation"}

Use IMMEDIATELY instead of END_OF_CYCLE to end it now. Read the resulting status; cancellation is not a refund of previous payments.

To change the card on a subscription with an open dunning case, use its subscription-bound hosted recovery link: after successful setup, Peak updates that subscription on the server. The public API does not expose a general-purpose PATCH /api/v1/subscriptions/{id} that accepts savedPaymentMethodId. A standalone setup-intent replacement or a change to the customer's default card does not update existing subscriptions' saved-card references. See retries and card updates for the distinction and subscription webhooks for authoritative events.