Skip to content

Commit 76839b5

Browse files
committed
Only set billing_cycle_anchor when future
1 parent e1c074b commit 76839b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/helpers/StripeHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class StripeHelper {
2222
const subscriptionData: any = {
2323
customer,
2424
metadata,
25-
billing_cycle_anchor: (billing_cycle_anchor && billing_cycle_anchor > new Date().getTime()) ? billing_cycle_anchor / 1000 : "now",
2625
items: [{
2726
price_data: {
2827
currency: 'usd',
@@ -33,6 +32,8 @@ export class StripeHelper {
3332
}],
3433
proration_behavior: 'none',
3534
};
35+
//billing_cycle_anchor: (billing_cycle_anchor && billing_cycle_anchor > new Date().getTime()) ? billing_cycle_anchor / 1000 : "now",
36+
if (billing_cycle_anchor && billing_cycle_anchor > new Date().getTime()) subscriptionData.billing_cycle_anchor = billing_cycle_anchor / 1000;
3637
if (type === 'card') subscriptionData.default_payment_method = payment_method_id;
3738
if (type === 'bank') subscriptionData.default_source = payment_method_id;
3839
return await stripe.subscriptions.create(subscriptionData);

0 commit comments

Comments
 (0)