Skip to main content
POST
https://api.usegately.com
/
api
/
v1
/
plans
/
{id}
/
subscribe
curl -X POST "https://api.usegately.com/api/v1/plans/plan_123/subscribe" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "success_url": "https://mysite.com/success",
    "cancel_url": "https://mysite.com/pricing",
    "customer_email": "[email protected]",
    "user_id": "user_123"
  }'
{
  "success": true,
  "checkoutUrl": "https://checkout.stripe.com/c/pay/xxx",
  "sessionId": "cs_xxx"
}
Subscribe a user to a specific plan. This creates a Stripe checkout session.

Path Parameters

id
string
required
The plan ID to subscribe to

Request Body

success_url
string
required
URL to redirect after successful payment
cancel_url
string
required
URL to redirect if payment is cancelled
customer_email
string
Customer email for the checkout
user_id
string
User ID to associate with the subscription

Response

success
boolean
Whether the checkout session was created
checkoutUrl
string
Stripe checkout URL to redirect the user
sessionId
string
Stripe session ID
curl -X POST "https://api.usegately.com/api/v1/plans/plan_123/subscribe" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "success_url": "https://mysite.com/success",
    "cancel_url": "https://mysite.com/pricing",
    "customer_email": "[email protected]",
    "user_id": "user_123"
  }'
{
  "success": true,
  "checkoutUrl": "https://checkout.stripe.com/c/pay/xxx",
  "sessionId": "cs_xxx"
}