Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Added trial period support #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ async function redirectToCheckout({ customerId, body }) {
cancel_url: body.cancelUrl,
line_items: [{ price: body.price, quantity: 1 }],
mode: "subscription",
subscription_data: {
...body.trialPeriodDays && { trial_period_days: body.trialPeriodDays },
}
});
}
return { error: "Error" };
Expand Down
1 change: 1 addition & 0 deletions src/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface redirectToCheckoutArgs {
price: string;
successUrl?: string;
cancelUrl?: string;
trialPeriodDays?: number
}

export interface redirectToCustomerPortalArgs {
Expand Down