Ana içeriğe geç

subscribe

Create a new subscription and get a payment session for it. 🔐 This method requires authorization.

Description

This method creates a new paid subscription for the current user and returns the payment session that must be paid to activate it. It returns a Promise that resolves to an ICreatedSubscription object.

Subscriptions.subscribe(

body*, body.marker*

);

Parameters schema

Schema

body(required): ISubscribe
Subscription body. Example: { marker: "premium" }

body.marker(required): string
Subscription marker
example: "premium"

Examples

Minimal example

const response = await Subscriptions.subscribe({ marker: 'premium' });

Example response

{
"id": 1,
"amount": 100,
"paymentUrl": "https://checkout.stripe.com/c/pay/cs_test_...",
"status": "waiting"
}

Response schema

Schema: ICreatedSubscription

id: number
Payment session identifier.
example: 1

amount: number
Amount to be paid.
example: 100

paymentUrl: string
Payment page URL.
example: "https://checkout.stripe.com/c/pay/..."

status: string
Payment session status.
example: "waiting"