Skip to main content
POST
/
api
/
user
/
stripe
/
subscribe
Create subscription checkout session
curl --request POST \
  --url http://localhost:3000/api/user/stripe/subscribe \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "priceId": "price_1234567890"
}
'
{
  "success": true,
  "sessionId": "<string>",
  "url": "<string>"
}

Authorizations

x-access-token
string
header
required

JWT token passed in x-access-token header

Body

application/json
priceId
string
required

Stripe price ID to subscribe to

Example:

"price_1234567890"

Response

Checkout session created successfully

success
boolean
Example:

true

sessionId
string

Stripe checkout session ID

url
string<uri>

Stripe checkout URL to redirect user to