Skip to content

Commit a42601d

Browse files
fix: add more details to create subscription to work correctly
1 parent bb8e7e9 commit a42601d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/infra/adapters/payment-gateway/stripe-adapter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export class StripeAdapter implements IPaymentGateway {
1717
}
1818

1919
async createCustomer(user: User): Promise<string> {
20-
const costumer = await this.stripe.customers.create({
20+
const customer = await this.stripe.customers.create({
2121
name: user.getName,
2222
email: user.getEmail.getValue,
2323
metadata: { userId: user.getId },
2424
});
25-
return costumer.id;
25+
return customer.id;
2626
}
2727

2828
async charge(
@@ -66,6 +66,8 @@ export class StripeAdapter implements IPaymentGateway {
6666
save_default_payment_method: "on_subscription",
6767
},
6868
expand: ["latest_invoice.confirmation_secret"],
69+
collection_method: "charge_automatically",
70+
payment_behavior: "default_incomplete",
6971
trial_period_days: input.trialPeriodDays,
7072
});
7173
const invoice = subscription.latest_invoice as Stripe.Invoice;

0 commit comments

Comments
 (0)