@paykit-sdk/stripe 1.1.5 → 1.1.6

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
@@ -86,7 +86,8 @@ var toPaykitInvoice = (invoice) => {
86
86
  amount: invoice.amount_paid,
87
87
  currency: invoice.currency,
88
88
  metadata: (0, import_core.stringifyObjectValues)(invoice.metadata ?? {}),
89
- customer_id: invoice.customer?.toString() ?? ""
89
+ customer_id: invoice.customer?.toString() ?? "",
90
+ billing_mode: invoice.billingMode
90
91
  };
91
92
  };
92
93
 
@@ -171,14 +172,22 @@ var StripeProvider = class {
171
172
  amount: data.amount_total ?? 0,
172
173
  currency: data.currency ?? "",
173
174
  metadata: (0, import_core2.stringifyObjectValues)({ ...data.metadata ?? {}, $mode: data.mode }),
174
- customer_id: data.customer?.toString() ?? ""
175
+ customer_id: data.customer?.toString() ?? "",
176
+ billing_mode: "one_time"
175
177
  }
176
178
  });
177
179
  },
178
180
  "invoice.paid": (event2) => {
179
181
  const data = event2.data.object;
180
- if (data.status !== "paid") return null;
181
- return (0, import_core2.toPaykitEvent)({ type: "$invoicePaid", created: event2.created, id: event2.id, data: toPaykitInvoice(data) });
182
+ if (data.status !== "paid" && !["subscription_create", "subscription_cycle"].includes(data.billing_reason)) {
183
+ return null;
184
+ }
185
+ return (0, import_core2.toPaykitEvent)({
186
+ type: "$invoicePaid",
187
+ created: event2.created,
188
+ id: event2.id,
189
+ data: toPaykitInvoice({ ...data, billingMode: "recurring" })
190
+ });
182
191
  },
183
192
  /**
184
193
  * Customer
package/dist/index.mjs CHANGED
@@ -55,7 +55,8 @@ var toPaykitInvoice = (invoice) => {
55
55
  amount: invoice.amount_paid,
56
56
  currency: invoice.currency,
57
57
  metadata: stringifyObjectValues(invoice.metadata ?? {}),
58
- customer_id: invoice.customer?.toString() ?? ""
58
+ customer_id: invoice.customer?.toString() ?? "",
59
+ billing_mode: invoice.billingMode
59
60
  };
60
61
  };
61
62
 
@@ -140,14 +141,22 @@ var StripeProvider = class {
140
141
  amount: data.amount_total ?? 0,
141
142
  currency: data.currency ?? "",
142
143
  metadata: stringifyObjectValues2({ ...data.metadata ?? {}, $mode: data.mode }),
143
- customer_id: data.customer?.toString() ?? ""
144
+ customer_id: data.customer?.toString() ?? "",
145
+ billing_mode: "one_time"
144
146
  }
145
147
  });
146
148
  },
147
149
  "invoice.paid": (event2) => {
148
150
  const data = event2.data.object;
149
- if (data.status !== "paid") return null;
150
- return toPaykitEvent({ type: "$invoicePaid", created: event2.created, id: event2.id, data: toPaykitInvoice(data) });
151
+ if (data.status !== "paid" && !["subscription_create", "subscription_cycle"].includes(data.billing_reason)) {
152
+ return null;
153
+ }
154
+ return toPaykitEvent({
155
+ type: "$invoicePaid",
156
+ created: event2.created,
157
+ id: event2.id,
158
+ data: toPaykitInvoice({ ...data, billingMode: "recurring" })
159
+ });
151
160
  },
152
161
  /**
153
162
  * Customer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paykit-sdk/stripe",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Stripe provider for PayKit",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -24,7 +24,7 @@
24
24
  "stripe": "^18.2.1"
25
25
  },
26
26
  "peerDependencies": {
27
- "@paykit-sdk/core": "^1.1.6"
27
+ "@paykit-sdk/core": "^1.1.7"
28
28
  },
29
29
  "devDependencies": {
30
30
  "tsup": "^8.0.0",