@usebillow/sdk 0.11.0 → 0.13.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/CHANGELOG.md +26 -0
- package/dist/{billing-Bs10EcjR.d.ts → billing-BEbVLGe9.d.ts} +6 -3
- package/dist/{billing-8ug1Gw05.d.cts → billing-CDEO8Jqv.d.cts} +6 -3
- package/dist/{chunk-XUFQG6EA.js → chunk-XRZZUXOR.js} +36 -6
- package/dist/chunk-XRZZUXOR.js.map +1 -0
- package/dist/config.d.cts +3 -3
- package/dist/config.d.ts +3 -3
- package/dist/{hosted-domains-zWm2srOk.d.cts → hosted-domains-Cuk3j04R.d.cts} +3 -3
- package/dist/{hosted-domains-BrnwkHqq.d.ts → hosted-domains-DMgokjiv.d.ts} +3 -3
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-DSEYhV2c.d.ts → index.d-D5v2ETKF.d.cts} +21 -1
- package/dist/{index.d-DSEYhV2c.d.cts → index.d-D5v2ETKF.d.ts} +21 -1
- package/dist/index.d.cts +155 -20
- package/dist/index.d.ts +155 -20
- package/dist/index.js +1 -1
- package/dist/ingestion.d.cts +3 -3
- package/dist/ingestion.d.ts +3 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/webhooks.cjs +1 -0
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +23 -4
- package/dist/webhooks.d.ts +23 -4
- package/dist/webhooks.js +1 -0
- package/dist/webhooks.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-XUFQG6EA.js.map +0 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Billow } from './index.js';
|
|
2
|
-
import { F as FeatureKind, M as MeterConfig, C as CreateProductInput, a as CreateCouponInput } from './billing-
|
|
3
|
-
import './index.d-
|
|
2
|
+
import { F as FeatureKind, M as MeterConfig, C as CreateProductInput, a as CreateCouponInput } from './billing-BEbVLGe9.js';
|
|
3
|
+
import './index.d-D5v2ETKF.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './billing-status-DZkB0VPK.js';
|
|
6
6
|
import './status.js';
|
|
7
|
-
import './hosted-domains-
|
|
7
|
+
import './hosted-domains-DMgokjiv.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Code-as-config sync (ARCHITECTURE §12 "code-as-config sync"). Keep your catalog
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HostedDomainResponse } from './index.d-
|
|
1
|
+
import { H as HostedDomainResponse } from './index.d-D5v2ETKF.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Public SDK types for prepaid credits. Re-exported by ../types.ts.
|
|
@@ -168,8 +168,8 @@ interface CreditLedgerEntry {
|
|
|
168
168
|
type: CreditTransactionType;
|
|
169
169
|
/**
|
|
170
170
|
* Why Billow posted it, as a system code (`api_grant`, `grant_expired`, `subscription_period`,
|
|
171
|
-
* `subscription_upgrade`, `subscription_canceled`, `subscription_charged_back`,
|
|
172
|
-
* text.
|
|
171
|
+
* `subscription_upgrade`, `subscription_canceled`, `subscription_charged_back`, `sandbox_seed`,
|
|
172
|
+
* ...); never free text.
|
|
173
173
|
*/
|
|
174
174
|
reason: string | null;
|
|
175
175
|
/** How it moved the account's unheld credits (signed). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HostedDomainResponse } from './index.d-
|
|
1
|
+
import { H as HostedDomainResponse } from './index.d-D5v2ETKF.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Public SDK types for prepaid credits. Re-exported by ../types.ts.
|
|
@@ -168,8 +168,8 @@ interface CreditLedgerEntry {
|
|
|
168
168
|
type: CreditTransactionType;
|
|
169
169
|
/**
|
|
170
170
|
* Why Billow posted it, as a system code (`api_grant`, `grant_expired`, `subscription_period`,
|
|
171
|
-
* `subscription_upgrade`, `subscription_canceled`, `subscription_charged_back`,
|
|
172
|
-
* text.
|
|
171
|
+
* `subscription_upgrade`, `subscription_canceled`, `subscription_charged_back`, `sandbox_seed`,
|
|
172
|
+
* ...); never free text.
|
|
173
173
|
*/
|
|
174
174
|
reason: string | null;
|
|
175
175
|
/** How it moved the account's unheld credits (signed). */
|
package/dist/index.cjs
CHANGED
|
@@ -249,7 +249,9 @@ var BILLOW_ERROR_CODES = [
|
|
|
249
249
|
"account_closed",
|
|
250
250
|
"idempotency_conflict",
|
|
251
251
|
"commit_exceeds_hold",
|
|
252
|
-
"reversal_exceeds_consumption"
|
|
252
|
+
"reversal_exceeds_consumption",
|
|
253
|
+
// Merchant custom domains (ADR-0039): a portal session asked for a host that cannot serve it.
|
|
254
|
+
"hosted_domain_unavailable"
|
|
253
255
|
];
|
|
254
256
|
|
|
255
257
|
// src/money.ts
|
|
@@ -433,6 +435,16 @@ function createChargesResource(ctx) {
|
|
|
433
435
|
`/v1/charges/${encodeURIComponent(chargeId)}/refunds/${encodeURIComponent(refundId)}/credit-note.pdf`,
|
|
434
436
|
options
|
|
435
437
|
),
|
|
438
|
+
/**
|
|
439
|
+
* Download a credit note voided on a refund (one of its `voidedCreditNotes`), exactly as it was
|
|
440
|
+
* issued and badged VOID.
|
|
441
|
+
*/
|
|
442
|
+
voidedCreditNote: (chargeId, refundId, creditNoteNumber, options) => apiRequestBinary(
|
|
443
|
+
ctx,
|
|
444
|
+
"GET",
|
|
445
|
+
`/v1/charges/${encodeURIComponent(chargeId)}/refunds/${encodeURIComponent(refundId)}/credit-note.pdf?number=${encodeURIComponent(creditNoteNumber)}`,
|
|
446
|
+
options
|
|
447
|
+
),
|
|
436
448
|
/**
|
|
437
449
|
* Refund a succeeded charge: `{ amount }` (minor units) for a partial, `{}` for its whole
|
|
438
450
|
* remaining balance. The `idempotencyKey` is required and must identify this one refund
|
|
@@ -476,7 +488,10 @@ function createChargesResource(ctx) {
|
|
|
476
488
|
/**
|
|
477
489
|
* Record the outcome you verified in the provider dashboard for a refund awaiting review
|
|
478
490
|
* (`needsReview`): `succeeded` settles it with a credit note, `failed` releases its amount.
|
|
479
|
-
* A refund with a provider conflict (`providerConflictStatus`) resolves only
|
|
491
|
+
* A refund with a provider conflict (`providerConflictStatus`) recorded `failed` resolves only
|
|
492
|
+
* as `succeeded`; one recorded `succeeded` that the provider later reported failed (a reversal:
|
|
493
|
+
* the customer's bank returned the money) resolves either way, `failed` making its amount
|
|
494
|
+
* refundable again.
|
|
480
495
|
*/
|
|
481
496
|
resolveRefund: (chargeId, refundId, input, options) => apiRequest(ctx, "POST", `${refundPath(chargeId, refundId)}/resolve`, input, options)
|
|
482
497
|
};
|
|
@@ -753,7 +768,8 @@ function createCreditsResource(ctx) {
|
|
|
753
768
|
/**
|
|
754
769
|
* Publish a new Rate Card version: what each Credit Action costs, as
|
|
755
770
|
* `ceil(units * unitPrice / perUnits)` microcredits a line. Versions are immutable - a price
|
|
756
|
-
* change is a new version - and take effect in order, at `effectiveAt` (now when omitted)
|
|
771
|
+
* change is a new version - and take effect in order, at `effectiveAt` (now when omitted),
|
|
772
|
+
* unless retracted before then.
|
|
757
773
|
*/
|
|
758
774
|
publish: (input, options) => apiRequest(ctx, "POST", "/v1/credits/rate-cards", input, options),
|
|
759
775
|
/** The version in effect now (`not_found` before the first takes effect). */
|
|
@@ -772,6 +788,20 @@ function createCreditsResource(ctx) {
|
|
|
772
788
|
void 0,
|
|
773
789
|
options
|
|
774
790
|
),
|
|
791
|
+
/**
|
|
792
|
+
* Retract a version before it takes effect: it never does (`retractedAt` is set), and
|
|
793
|
+
* versions published after it take effect in order after the last one not retracted - so a
|
|
794
|
+
* scheduled price change no longer holds back an earlier correction. Safe to retry: a
|
|
795
|
+
* retracted version answers as retracted. A version already in effect, current or
|
|
796
|
+
* superseded, throws `conflict` (409, `details.reason: "already_effective"`).
|
|
797
|
+
*/
|
|
798
|
+
retract: (version, options) => apiRequest(
|
|
799
|
+
ctx,
|
|
800
|
+
"POST",
|
|
801
|
+
`/v1/credits/rate-cards/${encodeURIComponent(String(version))}/retract`,
|
|
802
|
+
void 0,
|
|
803
|
+
options
|
|
804
|
+
),
|
|
775
805
|
/**
|
|
776
806
|
* The published versions, newest first. Auto-paginating by cursor: `await` the first page,
|
|
777
807
|
* `for await (…)` every version, or `.listAll()` to collect them.
|
|
@@ -1890,7 +1920,7 @@ var BillowPortal = class {
|
|
|
1890
1920
|
/** The plan being confirmed (product + base price). */
|
|
1891
1921
|
get: (options) => apiRequest(this.#ctx, "GET", "/portal/checkout", void 0, options),
|
|
1892
1922
|
/** Subscribe to the plan → returns the hosted Paymob checkout URL to redirect to. */
|
|
1893
|
-
start: () => apiRequest(this.#ctx, "POST", "/portal/checkout")
|
|
1923
|
+
start: (input = {}) => apiRequest(this.#ctx, "POST", "/portal/checkout", input)
|
|
1894
1924
|
};
|
|
1895
1925
|
};
|
|
1896
1926
|
|