post
https://www.pelcro.com/api/v1/sdk/subscription
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
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 card —
source_idof a chargeable source. - New card —
payment_gateway+gateway_token. - Invoice —
pay_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_idis required when the plan's product needs a shipping address.- Supplying
gift_recipient_emailcreates a gift subscription (the customer is the donor). - Many business rules return
404with a message — for exampleInvalid plan provided,This product is not available in your area, an invalid coupon, or a currency mismatch.
