@drawbridge/drawbridge-stripe 0.1.10 → 0.1.11

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
@@ -276,9 +276,18 @@ var require_billing = __commonJS({
276
276
  // lib/subscription.js
277
277
  var require_subscription = __commonJS({
278
278
  "lib/subscription.js"(exports2, module2) {
279
+ var axios = require("axios");
280
+ var subscriptions = "https://api.stripe.com/v1/subscriptions";
279
281
  module2.exports = ({
280
282
  stripe: stripe2
281
283
  }) => {
284
+ const options = {
285
+ headers: {
286
+ "Authorization": "Bearer " + process.env.STRIPE_API_KEY,
287
+ "Content-Type": "application/json",
288
+ "Stripe-Version": "2026-01-28.preview"
289
+ }
290
+ };
282
291
  const createMeter = async ({
283
292
  metadata,
284
293
  name
@@ -578,6 +587,48 @@ var require_subscription = __commonJS({
578
587
  throw error;
579
588
  }
580
589
  },
590
+ pause: async ({
591
+ stripeSubscriptionId
592
+ }) => {
593
+ try {
594
+ const { data } = await axios.post(
595
+ subscriptions + "/" + stripeSubscriptionId + "/pause",
596
+ {
597
+ type: "subscription",
598
+ bill_for: {
599
+ unused_time_from: {
600
+ type: "now"
601
+ },
602
+ outstanding_usage_through: {
603
+ type: "now"
604
+ }
605
+ },
606
+ invoicing_behavior: "pending_invoice_item"
607
+ },
608
+ options
609
+ );
610
+ return data;
611
+ } catch (error) {
612
+ throw error;
613
+ }
614
+ },
615
+ resume: async ({
616
+ stripeSubscriptionId
617
+ }) => {
618
+ try {
619
+ const { data } = await axios.post(
620
+ subscriptions + "/" + stripeSubscriptionId + "/resume",
621
+ {
622
+ billing_cycle_anchor: "unchanged",
623
+ proration_behavior: "create_prorations"
624
+ },
625
+ options
626
+ );
627
+ return data;
628
+ } catch (error) {
629
+ throw error;
630
+ }
631
+ },
581
632
  update: async ({
582
633
  current,
583
634
  direction,
package/dist/index.mjs CHANGED
@@ -282,9 +282,18 @@ var require_billing = __commonJS({
282
282
  // lib/subscription.js
283
283
  var require_subscription = __commonJS({
284
284
  "lib/subscription.js"(exports, module) {
285
+ var axios = __require("axios");
286
+ var subscriptions = "https://api.stripe.com/v1/subscriptions";
285
287
  module.exports = ({
286
288
  stripe
287
289
  }) => {
290
+ const options = {
291
+ headers: {
292
+ "Authorization": "Bearer " + process.env.STRIPE_API_KEY,
293
+ "Content-Type": "application/json",
294
+ "Stripe-Version": "2026-01-28.preview"
295
+ }
296
+ };
288
297
  const createMeter = async ({
289
298
  metadata,
290
299
  name
@@ -584,6 +593,48 @@ var require_subscription = __commonJS({
584
593
  throw error;
585
594
  }
586
595
  },
596
+ pause: async ({
597
+ stripeSubscriptionId
598
+ }) => {
599
+ try {
600
+ const { data } = await axios.post(
601
+ subscriptions + "/" + stripeSubscriptionId + "/pause",
602
+ {
603
+ type: "subscription",
604
+ bill_for: {
605
+ unused_time_from: {
606
+ type: "now"
607
+ },
608
+ outstanding_usage_through: {
609
+ type: "now"
610
+ }
611
+ },
612
+ invoicing_behavior: "pending_invoice_item"
613
+ },
614
+ options
615
+ );
616
+ return data;
617
+ } catch (error) {
618
+ throw error;
619
+ }
620
+ },
621
+ resume: async ({
622
+ stripeSubscriptionId
623
+ }) => {
624
+ try {
625
+ const { data } = await axios.post(
626
+ subscriptions + "/" + stripeSubscriptionId + "/resume",
627
+ {
628
+ billing_cycle_anchor: "unchanged",
629
+ proration_behavior: "create_prorations"
630
+ },
631
+ options
632
+ );
633
+ return data;
634
+ } catch (error) {
635
+ throw error;
636
+ }
637
+ },
587
638
  update: async ({
588
639
  current,
589
640
  direction,
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.10"
27
+ "version": "0.1.11"
28
28
  }