Create subscription

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

Subscribe the authenticated customer to a plan. The customer is taken from the JWT; plan_id is required. How payment is collected depends on the plan and the fields you send:

  • Existing cardsource_id of a chargeable source.
  • New cardpayment_gateway + gateway_token.
  • Invoicepay_via_send_invoice: true (only on plans that allow it).
  • Free plan — no payment fields required.

On success the response is the shared customer resource with a fresh JWT. When the gateway requires 3D Secure, the response also carries a payment_intent (or setup_intent) for the front end to complete.

Example:

curl --request POST   --url 'https://www.pelcro.com/api/v1/sdk/subscription?site_id=1232'   --header 'Authorization: Bearer <JWT>'   --header 'Content-Type: application/json'   --data '{ "plan_id": 4051, "payment_gateway": "stripe", "gateway_token": "pm_card_visa" }'

Notes

  • Protected — requires the customer's JWT and an active payment gateway on the account.
  • address_id is required when the plan's product needs a shipping address.
  • Supplying gift_recipient_email creates a gift subscription (the customer is the donor).
  • Many business rules return 404 with a message — for example Invalid plan provided, This product is not available in your area, an invalid coupon, or a currency mismatch.
Query Params
int32
required
Body Params
int32
required
string
enum
Defaults to stripe
Allowed:
string
int32
int32
string
boolean
metadata
array of objects
metadata
string
string
int32
Defaults to 1
string
ip_addresses
array of strings
ip_addresses
domains
array of strings
domains
string | null
string | null
string | null
string | null
string | null
string | null
string | null
string | null
integer | null
≥ 0
boolean
Headers
string
required
Defaults to Bearer <token>
Responses

Language
Credentials
Query
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json