API Docs
Subscriptions
API ReferenceSubscriptionsCreate And Confirm

Create and Confirm Subscription

Creates and confirms a subscription in a single request. Use this endpoint when you have all payment details available upfront and want to skip the separate confirm step.

POST /subscriptions

Headers

HeaderTypeRequiredDescription
api-keystringYesYour secret API key.
X-Profile-IdstringYesProfile ID for authentication.

Body Parameters

ParameterTypeRequiredDescription
customer_idstringYesThe unique identifier for the customer.
item_price_idstringYesIdentifier for the item price to subscribe to (e.g. standard-plan-USD-Monthly).
payment_detailsobjectYesPayment method and configuration. See Payment Details.
merchant_reference_idstringNoYour own unique identifier for this subscription.
plan_idstringNoIdentifier for the subscription plan.
coupon_codestringNoCoupon code to apply to the subscription.
billingobjectNoBilling address. See Address.
shippingobjectNoShipping address. See Address.

Payment Details

ParameterTypeRequiredDescription
payment_methodstringNoThe payment method type: card, wallet, bank_redirect, bank_transfer, bank_debit, pay_later, crypto, upi, voucher, gift_card, open_banking, mobile_payment, network_token.
payment_method_dataobjectNoPayment method data. Structure depends on payment_method. See Payment Method Data.
payment_method_idstringNoID of a previously saved payment method (e.g. pm_01926c58bc6e77c09e809964e72af8c8).
payment_method_typestringNoSub-type of the payment method (e.g. credit, debit, google_pay, apple_pay).
authentication_typestringNothree_ds or no_three_ds. Defaults to connector behaviour if omitted.
capture_methodstringNoautomatic, manual, manual_multiple, scheduled, or sequential_automatic. Defaults to automatic.
setup_future_usagestringNooff_session (charge later without customer present) or on_session. Defaults to on_session.
payment_typestringNonormal, new_mandate, setup_mandate, or recurring_mandate. Use setup_mandate for zero-auth flows.
return_urlstringNoURL to redirect the user to after payment completion.
customer_acceptanceobjectNoMandate acceptance details. See Customer Acceptance.

Payment Method Data

Pass the appropriate object key matching your payment_method value.

Card

ParameterTypeRequiredDescription
card.card_numberstringYesThe full card number (e.g. 4242424242424242).
card.card_exp_monthstringYesCard expiry month (e.g. 03).
card.card_exp_yearstringYesCard expiry year (e.g. 2030).
card.card_holder_namestringYesName on the card.
card.card_cvcstringYesCard verification code.
card.card_networkstringNoCard network: Visa, Mastercard, AmericanExpress, JCB, etc.
card.nick_namestringNoFriendly name for the card.

Customer Acceptance

ParameterTypeRequiredDescription
acceptance_typestringYesHow the mandate was accepted: online or offline.
accepted_atstringNoISO 8601 timestamp of when acceptance was given (e.g. 2024-01-01T10:00:00Z).
online.ip_addressstringYes (if online)Customer's IP address at time of acceptance.
online.user_agentstringYes (if online)Customer's browser user agent string.

Address

ParameterTypeRequiredDescription
address.line1stringNoFirst line of the street address.
address.line2stringNoSecond line (apartment, suite, unit, etc.).
address.line3stringNoThird line, if applicable.
address.citystringNoCity, district, suburb, town, or village.
address.statestringNoState or region.
address.zipstringNoPostal or ZIP code.
address.countrystringNoTwo-letter ISO 3166-1 country code (e.g. US, GB).
address.first_namestringNoFirst name on the address.
address.last_namestringNoLast name on the address.
phone.numberstringNoContact phone number.
phone.country_codestringNoPhone country code (e.g. +1).
emailstringNoEmail address.

Request Example

curl -X POST 'https://api.sandbox.paychtec.com/subscriptions' \  -H "Content-Type: application/json" \  -H "api-key: snd_YOUR_API_KEY" \  -H "X-Profile-Id: prof_12345" \  -d '{"customer_id": "cust_123456789","item_price_id": "standard-plan-USD-Monthly","merchant_reference_id": "mer_ref_123456789","payment_details": {  "payment_method": "card",  "payment_method_type": "credit",  "payment_method_data": {    "card": {      "card_number": "4000000000000002",      "card_exp_month": "03",      "card_exp_year": "2030",      "card_holder_name": "John Doe",      "card_cvc": "737"    }  },  "authentication_type": "no_three_ds",  "capture_method": "automatic",  "setup_future_usage": "off_session",  "payment_type": "setup_mandate",  "return_url": "https://yourapp.com/return",  "customer_acceptance": {    "acceptance_type": "online",    "accepted_at": "2024-01-01T10:00:00Z",    "online": {      "ip_address": "127.0.0.1",      "user_agent": "Mozilla/5.0"    }  }},"billing": {  "address": {    "line1": "1467",    "line2": "Harrison Street",    "city": "San Francisco",    "state": "California",    "zip": "94122",    "country": "US",    "first_name": "John",    "last_name": "Doe"  },  "phone": {    "number": "123456789",    "country_code": "+1"  }}}'

Response

{
  "id": "sub_abc123",
  "status": "active",
  "profile_id": "prof_12345",
  "merchant_id": "mer_abc123",
  "customer_id": "cust_123456789",
  "item_price_id": "standard-plan-USD-Monthly",
  "merchant_reference_id": "mer_ref_123456789",
  "payment": {
    "payment_id": "pay_xyz789",
    "status": "succeeded",
    "amount": 2900,
    "currency": "USD",
    "payment_method_type": "credit"
  },
  "invoice": {
    "id": "inv_abc123",
    "subscription_id": "sub_abc123",
    "amount": 2900,
    "currency": "USD",
    "status": "invoice_paid"
  }
}

Subscription Statuses

StatusDescription
activeSubscription created, confirmed, and billing normally.
pendingAwaiting final activation.
trialIn a free trial period.
unpaidPayment was not collected successfully.
failedSubscription setup failed.
cancelledSubscription has been cancelled.
in_activeSubscription is inactive.
onetimeOne-time payment subscription.

Error Responses

Status CodeDescription
400Invalid subscription data — check required fields and payment details.
404Customer or plan not found — verify customer_id and item_price_id.