Skip to content

Commit 73a3444

Browse files
committed
feat(payments-next): Add free trial support to checkout flow
Because: * Users eligible for free trials should receive trial subscriptions when checking out via Stripe or PayPal * Subscription management flows need to handle 'trialing' status for cancel and resubscribe actions This commit: * Integrates getFreeTrialEligibility with existing payWithStripe and payWithPaypal methods * Records a free trial record with firestore * fixes bug with strapi country-code checks * updates subscription management page to allow for cancellations of 'trialing' subscriptions * Adds tests for new and existing cases Closes #PAY-3543
1 parent 9e880f4 commit 73a3444

5 files changed

Lines changed: 1123 additions & 110 deletions

File tree

libs/payments/cart/src/lib/checkout.error.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,17 @@ export class IntentInsufficientFundsError extends IntentFailedHandledError {
253253
this.name = 'IntentInsufficientFundsError';
254254
}
255255
}
256+
257+
export class UnexpectedSubscriptionStatusForTrialError extends CheckoutError {
258+
constructor(cartId: string, subscriptionId: string, actualStatus: string) {
259+
super(
260+
'Expected subscription status to be trialing for free trial checkout',
261+
{
262+
cartId,
263+
subscriptionId,
264+
actualStatus,
265+
}
266+
);
267+
this.name = 'UnexpectedSubscriptionStatusForTrialError';
268+
}
269+
}

0 commit comments

Comments
 (0)