@delopay/sdk 0.140.0 → 0.141.0
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/README.md +7 -2
- package/dist/{chunk-WW33CCSB.js → chunk-YZABVF2X.js} +5 -1
- package/dist/chunk-YZABVF2X.js.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -3
- package/dist/index.d.ts +152 -3
- package/dist/index.js +3 -1
- package/dist/internal.cjs +5 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +3 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-WW33CCSB.js.map +0 -1
package/README.md
CHANGED
|
@@ -211,9 +211,14 @@ const opts = { headers: { 'X-Profile-Id': profileId } };
|
|
|
211
211
|
**Browse plans and estimate cost** before creating anything:
|
|
212
212
|
|
|
213
213
|
```typescript
|
|
214
|
-
// List
|
|
214
|
+
// List plans (or addons) with their prices. An item the processor lists but
|
|
215
|
+
// cannot sell right now comes back with `available: false` and no prices;
|
|
216
|
+
// skip it rather than offering it.
|
|
215
217
|
const plans = await delopay.subscriptions.getItems({ item_type: 'plan' }, opts);
|
|
216
|
-
const priceId = plans
|
|
218
|
+
const priceId = plans.find((item) => item.available)?.price_id[0]?.price_id;
|
|
219
|
+
if (!priceId) {
|
|
220
|
+
throw new Error('No purchasable plan on this shop');
|
|
221
|
+
}
|
|
217
222
|
|
|
218
223
|
// Preview what the customer will be charged
|
|
219
224
|
const estimate = await delopay.subscriptions.getEstimate({ item_price_id: priceId }, opts);
|
|
@@ -3664,6 +3664,9 @@ var Verification = class {
|
|
|
3664
3664
|
};
|
|
3665
3665
|
|
|
3666
3666
|
// src/resources/webhooks.ts
|
|
3667
|
+
function isSubscriptionLifecycleWebhook(object) {
|
|
3668
|
+
return typeof object.transition_id === "string";
|
|
3669
|
+
}
|
|
3667
3670
|
function hexToBytes(hex) {
|
|
3668
3671
|
if (hex.length === 0 || hex.length % 2 !== 0) return null;
|
|
3669
3672
|
const bytes = new Uint8Array(hex.length / 2);
|
|
@@ -7949,6 +7952,7 @@ export {
|
|
|
7949
7952
|
DelopayError,
|
|
7950
7953
|
DelopayAuthenticationError,
|
|
7951
7954
|
Search,
|
|
7955
|
+
isSubscriptionLifecycleWebhook,
|
|
7952
7956
|
Webhooks,
|
|
7953
7957
|
Analytics,
|
|
7954
7958
|
AnalyticsDashboard,
|
|
@@ -8115,4 +8119,4 @@ export {
|
|
|
8115
8119
|
decodeNativePanes,
|
|
8116
8120
|
encodeNativePanes
|
|
8117
8121
|
};
|
|
8118
|
-
//# sourceMappingURL=chunk-
|
|
8122
|
+
//# sourceMappingURL=chunk-YZABVF2X.js.map
|