@drawbridge/drawbridge-stripe 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -161,8 +161,20 @@ var require_billing = __commonJS({
161
161
  ;
162
162
  let stripePricingPlanSubscriptionNextBillingDate;
163
163
  if (!default_payment_method) {
164
- const { billing_cadence: billingCadenceId } = await stripe2.v2.billing.pricingPlanSubscriptions.retrieve(stripePricingPlanSubscriptionId);
165
- ({ next_billing_date: stripePricingPlanSubscriptionNextBillingDate } = await stripe2.v2.billing.cadences.retrieve(billingCadenceId));
164
+ const { data: subscription } = await axios.get(
165
+ billing + "/pricing_plan_subscriptions/" + stripePricingPlanSubscriptionId,
166
+ options
167
+ );
168
+ if (subscription == null ? void 0 : subscription.billing_cadence) {
169
+ const { data: cadence } = await axios.get(
170
+ billing + "/cadences/" + subscription.billing_cadence,
171
+ options
172
+ );
173
+ if (cadence == null ? void 0 : cadence.next_billing_date) {
174
+ stripePricingPlanSubscriptionNextBillingDate = cadence.next_billing_date;
175
+ }
176
+ }
177
+ ;
166
178
  }
167
179
  ;
168
180
  return {
@@ -431,6 +443,7 @@ var require_subscription = __commonJS({
431
443
  }
432
444
  },
433
445
  create: async ({
446
+ billingCycleAnchor,
434
447
  customer,
435
448
  discounts = [],
436
449
  metadata,
@@ -461,7 +474,10 @@ var require_subscription = __commonJS({
461
474
  price: actions.price
462
475
  }
463
476
  ],
464
- metadata
477
+ metadata,
478
+ ...billingCycleAnchor && {
479
+ billing_cycle_anchor: billingCycleAnchor
480
+ }
465
481
  });
466
482
  const { product } = await stripe2.prices.retrieve(to == null ? void 0 : to.stripePriceId);
467
483
  const plan = await stripe2.subscriptionItems.create({
package/dist/index.mjs CHANGED
@@ -167,8 +167,20 @@ var require_billing = __commonJS({
167
167
  ;
168
168
  let stripePricingPlanSubscriptionNextBillingDate;
169
169
  if (!default_payment_method) {
170
- const { billing_cadence: billingCadenceId } = await stripe.v2.billing.pricingPlanSubscriptions.retrieve(stripePricingPlanSubscriptionId);
171
- ({ next_billing_date: stripePricingPlanSubscriptionNextBillingDate } = await stripe.v2.billing.cadences.retrieve(billingCadenceId));
170
+ const { data: subscription } = await axios.get(
171
+ billing + "/pricing_plan_subscriptions/" + stripePricingPlanSubscriptionId,
172
+ options
173
+ );
174
+ if (subscription == null ? void 0 : subscription.billing_cadence) {
175
+ const { data: cadence } = await axios.get(
176
+ billing + "/cadences/" + subscription.billing_cadence,
177
+ options
178
+ );
179
+ if (cadence == null ? void 0 : cadence.next_billing_date) {
180
+ stripePricingPlanSubscriptionNextBillingDate = cadence.next_billing_date;
181
+ }
182
+ }
183
+ ;
172
184
  }
173
185
  ;
174
186
  return {
@@ -437,6 +449,7 @@ var require_subscription = __commonJS({
437
449
  }
438
450
  },
439
451
  create: async ({
452
+ billingCycleAnchor,
440
453
  customer,
441
454
  discounts = [],
442
455
  metadata,
@@ -467,7 +480,10 @@ var require_subscription = __commonJS({
467
480
  price: actions.price
468
481
  }
469
482
  ],
470
- metadata
483
+ metadata,
484
+ ...billingCycleAnchor && {
485
+ billing_cycle_anchor: billingCycleAnchor
486
+ }
471
487
  });
472
488
  const { product } = await stripe.prices.retrieve(to == null ? void 0 : to.stripePriceId);
473
489
  const plan = await stripe.subscriptionItems.create({
package/package.json CHANGED
@@ -24,5 +24,5 @@
24
24
  "build": "tsup ./index.js && npm publish"
25
25
  },
26
26
  "types": "dist/index.d.ts",
27
- "version": "0.1.5"
27
+ "version": "0.1.7"
28
28
  }