Start checkout session with external ID and custom URLs
POST
/api/checkout/buy-planAuthorization
AuthorizationBearer token (API Key) · headerrequiredAPI Key for programmatic access (format: insy_xxxxx)
Request body
requiredapplication/jsonpricingPlanIdstring<uuid>requiredPricing plan ID
externalIdstringrequiredExternal ID to identify the user in the external system
successUrlstring<uri>requiredURL to redirect to on successful checkout
cancelUrlstring<uri>requiredURL to redirect to on cancelled checkout
emailstring<email>Optional email for the checkout user
communityIdstring<uuid>requiredCommunity ID
utmSourcestringAttribution source (e.g. utm_source) shown in purchase reporting
max length 100
Responses
200Successful response
successbooleanrequiredWhether the request was successful
errorCodestringrequiredThe error code returned by the request
Allowed:
not_foundbad_requestalready_existsunauthorizedforbiddeninternal_server_errorservice_unavailabletimeoutconflictprecondition_failedunprocessable_entitymessagestringrequiredThe message returned by the request
dataBuyPlanResponseDtoShow propertiesHide properties
checkoutUrlstringCheckout URL
401Invalid, expired, or revoked API key
403Insufficient API key permissions
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST "https://api.insy.io/api/checkout/buy-plan" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"pricingPlanId": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "user_123",
"successUrl": "https://example.com/success",
"cancelUrl": "https://example.com/cancel",
"email": "user@example.com",
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"utmSource": "landing-page"
}'const response = await fetch("https://api.insy.io/api/checkout/buy-plan", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"pricingPlanId": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "user_123",
"successUrl": "https://example.com/success",
"cancelUrl": "https://example.com/cancel",
"email": "user@example.com",
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"utmSource": "landing-page"
})
});import requests
response = requests.post(
"https://api.insy.io/api/checkout/buy-plan",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"pricingPlanId": "123e4567-e89b-12d3-a456-426614174000",
"externalId": "user_123",
"successUrl": "https://example.com/success",
"cancelUrl": "https://example.com/cancel",
"email": "user@example.com",
"communityId": "123e4567-e89b-12d3-a456-426614174000",
"utmSource": "landing-page"
},
)Response
{
"success": true,
"errorCode": "not_found",
"message": "Success",
"data": {
"checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_a1234567890"
}
}Invalid, expired, or revoked API key
Insufficient API key permissions