diff --git a/src/plans/v3/plan-v3.test.ts b/src/plans/v3/plan-v3.test.ts index 8d797b7..983aaee 100644 --- a/src/plans/v3/plan-v3.test.ts +++ b/src/plans/v3/plan-v3.test.ts @@ -17,6 +17,7 @@ describe('Plans V3 Tests', () => { const apiKey = testUuids.devApiKeyV3; const salable = initSalable(apiKey, 'v3'); const planUuid = testUuids.paidPlanUuid; + const stripeEnvs = JSON.parse(process.env.stripEnvs || ''); describe('getAll for organisation', () => { const organisation = randomUUID(); @@ -238,7 +239,7 @@ describe('Plans V3 Tests', () => { successUrl: 'https://www.salable.app', cancelUrl: 'https://www.salable.app', granteeId: 'granteeid@example.com', - owner: 'member-id', + owner: 'owner-id', allowPromoCode: true, customerEmail: 'customer@email.com', currency: 'GBP', @@ -249,6 +250,20 @@ describe('Plans V3 Tests', () => { expect(data).toEqual(PlanCheckoutLinkSchema); }); + + it('getCheckoutLink (w / customerId and cardPreFillBehaviour): should successfully fetch checkout link for plan', async () => { + const data = await salable.plans.getCheckoutLink(planUuid, { + successUrl: 'https://www.salable.app', + cancelUrl: 'https://www.salable.app', + granteeId: 'granteeid@example.com', + owner: 'owner-id', + customerId: stripeEnvs.customerId, + currency: 'GBP', + cardPreFillBehaviour: 'none' + }); + + expect(data).toEqual(PlanCheckoutLinkSchema); + }); }); async function generateTestData(organisation: string) { diff --git a/src/types.ts b/src/types.ts index 2d6804a..722e4ec 100644 --- a/src/types.ts +++ b/src/types.ts @@ -505,6 +505,7 @@ export type GetPlanCheckoutOptionsV3 = { quantity?: string; changeQuantity?: string; requirePaymentMethod?: boolean; + cardPreFillBehaviour?: 'none' | 'choice' | 'always'; }; export type PlanFeature = {