@delopay/sdk 0.87.0 → 0.88.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/dist/{chunk-DQ36QCU7.js → chunk-BWTQ34HP.js} +115 -1
- package/dist/{chunk-DQ36QCU7.js.map → chunk-BWTQ34HP.js.map} +1 -1
- package/dist/index.cjs +114 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +1 -1
- package/dist/internal.cjs +114 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -7517,6 +7517,61 @@ declare class CheckoutSession {
|
|
|
7517
7517
|
/** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
|
|
7518
7518
|
private pkHeaders;
|
|
7519
7519
|
private requireClientSecret;
|
|
7520
|
+
/**
|
|
7521
|
+
* The hosted checkout's bootstrap payload for a one-time payment —
|
|
7522
|
+
* `CheckoutDetails` while payable, a status view once settled.
|
|
7523
|
+
*
|
|
7524
|
+
* Deliberately unauthenticated: a `pay_` link bootstraps before any
|
|
7525
|
+
* credential exists, so no credential header is ever attached (caller
|
|
7526
|
+
* extras are still stripped of credentials). The response is a large
|
|
7527
|
+
* discriminated union owned by the consuming checkout, which keeps its
|
|
7528
|
+
* own types and runtime gates — hence the loose return type.
|
|
7529
|
+
*
|
|
7530
|
+
* `theme` is the route's one declared query parameter (a named checkout
|
|
7531
|
+
* variant, backend#793). `locale` travels as `Accept-Language` — the only
|
|
7532
|
+
* channel the backend's locale resolution reads; a `?locale=` query is
|
|
7533
|
+
* silently ignored by this route.
|
|
7534
|
+
*
|
|
7535
|
+
* `GET /payment-link/data/{merchantId}/{paymentId}`
|
|
7536
|
+
*/
|
|
7537
|
+
fetchCheckoutData(params?: {
|
|
7538
|
+
locale?: string;
|
|
7539
|
+
theme?: string;
|
|
7540
|
+
}, options?: RequestExtras): Promise<Record<string, unknown>>;
|
|
7541
|
+
/**
|
|
7542
|
+
* The subscription twin of {@link CheckoutSession.fetchCheckoutData}: the
|
|
7543
|
+
* bootstrap payload for a `sub_` checkout. Authenticated with the
|
|
7544
|
+
* subscription's client secret (construct the session with the `sub_…` id
|
|
7545
|
+
* in the `paymentId` slot). `locale` travels as `Accept-Language`, same
|
|
7546
|
+
* as {@link CheckoutSession.fetchCheckoutData}.
|
|
7547
|
+
*
|
|
7548
|
+
* `GET /subscriptions/data/{merchantId}/{subscriptionId}`
|
|
7549
|
+
*/
|
|
7550
|
+
fetchSubscriptionData(params?: {
|
|
7551
|
+
locale?: string;
|
|
7552
|
+
}, options?: RequestExtras): Promise<Record<string, unknown>>;
|
|
7553
|
+
/**
|
|
7554
|
+
* Report buyer/device signals for rails that never reach
|
|
7555
|
+
* `/payments/{id}/confirm` (the Stripe SAQ-A rail: raw cards, Apple Pay,
|
|
7556
|
+
* Google Pay). Same telemetry contract as
|
|
7557
|
+
* {@link CheckoutSession.recordEvent}: sent with `keepalive: true`, and
|
|
7558
|
+
* failures resolve instead of rejecting — signals must never block or
|
|
7559
|
+
* break a checkout. Unauthenticated by design.
|
|
7560
|
+
*
|
|
7561
|
+
* `POST /payment-link/client-signals/{merchantId}/{paymentId}`
|
|
7562
|
+
*/
|
|
7563
|
+
reportClientSignals(params: {
|
|
7564
|
+
browser_info?: Record<string, unknown>;
|
|
7565
|
+
signals: Record<string, unknown>;
|
|
7566
|
+
}, options?: RequestExtras): Promise<void>;
|
|
7567
|
+
/**
|
|
7568
|
+
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
7569
|
+
* attached automatically; the shop's profile id travels as the
|
|
7570
|
+
* `X-Profile-Id` header the subscription routes require.
|
|
7571
|
+
*
|
|
7572
|
+
* `POST /subscriptions/{subscriptionId}/confirm` (publishable key)
|
|
7573
|
+
*/
|
|
7574
|
+
confirmSubscription(subscriptionId: string, profileId: string, params: Omit<ConfirmSubscriptionRequest, 'client_secret'>, options?: RequestExtras): Promise<ConfirmSubscriptionResponse>;
|
|
7520
7575
|
/**
|
|
7521
7576
|
* The Paysepro rail catalog for the buyer's country.
|
|
7522
7577
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -7517,6 +7517,61 @@ declare class CheckoutSession {
|
|
|
7517
7517
|
/** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
|
|
7518
7518
|
private pkHeaders;
|
|
7519
7519
|
private requireClientSecret;
|
|
7520
|
+
/**
|
|
7521
|
+
* The hosted checkout's bootstrap payload for a one-time payment —
|
|
7522
|
+
* `CheckoutDetails` while payable, a status view once settled.
|
|
7523
|
+
*
|
|
7524
|
+
* Deliberately unauthenticated: a `pay_` link bootstraps before any
|
|
7525
|
+
* credential exists, so no credential header is ever attached (caller
|
|
7526
|
+
* extras are still stripped of credentials). The response is a large
|
|
7527
|
+
* discriminated union owned by the consuming checkout, which keeps its
|
|
7528
|
+
* own types and runtime gates — hence the loose return type.
|
|
7529
|
+
*
|
|
7530
|
+
* `theme` is the route's one declared query parameter (a named checkout
|
|
7531
|
+
* variant, backend#793). `locale` travels as `Accept-Language` — the only
|
|
7532
|
+
* channel the backend's locale resolution reads; a `?locale=` query is
|
|
7533
|
+
* silently ignored by this route.
|
|
7534
|
+
*
|
|
7535
|
+
* `GET /payment-link/data/{merchantId}/{paymentId}`
|
|
7536
|
+
*/
|
|
7537
|
+
fetchCheckoutData(params?: {
|
|
7538
|
+
locale?: string;
|
|
7539
|
+
theme?: string;
|
|
7540
|
+
}, options?: RequestExtras): Promise<Record<string, unknown>>;
|
|
7541
|
+
/**
|
|
7542
|
+
* The subscription twin of {@link CheckoutSession.fetchCheckoutData}: the
|
|
7543
|
+
* bootstrap payload for a `sub_` checkout. Authenticated with the
|
|
7544
|
+
* subscription's client secret (construct the session with the `sub_…` id
|
|
7545
|
+
* in the `paymentId` slot). `locale` travels as `Accept-Language`, same
|
|
7546
|
+
* as {@link CheckoutSession.fetchCheckoutData}.
|
|
7547
|
+
*
|
|
7548
|
+
* `GET /subscriptions/data/{merchantId}/{subscriptionId}`
|
|
7549
|
+
*/
|
|
7550
|
+
fetchSubscriptionData(params?: {
|
|
7551
|
+
locale?: string;
|
|
7552
|
+
}, options?: RequestExtras): Promise<Record<string, unknown>>;
|
|
7553
|
+
/**
|
|
7554
|
+
* Report buyer/device signals for rails that never reach
|
|
7555
|
+
* `/payments/{id}/confirm` (the Stripe SAQ-A rail: raw cards, Apple Pay,
|
|
7556
|
+
* Google Pay). Same telemetry contract as
|
|
7557
|
+
* {@link CheckoutSession.recordEvent}: sent with `keepalive: true`, and
|
|
7558
|
+
* failures resolve instead of rejecting — signals must never block or
|
|
7559
|
+
* break a checkout. Unauthenticated by design.
|
|
7560
|
+
*
|
|
7561
|
+
* `POST /payment-link/client-signals/{merchantId}/{paymentId}`
|
|
7562
|
+
*/
|
|
7563
|
+
reportClientSignals(params: {
|
|
7564
|
+
browser_info?: Record<string, unknown>;
|
|
7565
|
+
signals: Record<string, unknown>;
|
|
7566
|
+
}, options?: RequestExtras): Promise<void>;
|
|
7567
|
+
/**
|
|
7568
|
+
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
7569
|
+
* attached automatically; the shop's profile id travels as the
|
|
7570
|
+
* `X-Profile-Id` header the subscription routes require.
|
|
7571
|
+
*
|
|
7572
|
+
* `POST /subscriptions/{subscriptionId}/confirm` (publishable key)
|
|
7573
|
+
*/
|
|
7574
|
+
confirmSubscription(subscriptionId: string, profileId: string, params: Omit<ConfirmSubscriptionRequest, 'client_secret'>, options?: RequestExtras): Promise<ConfirmSubscriptionResponse>;
|
|
7520
7575
|
/**
|
|
7521
7576
|
* The Paysepro rail catalog for the buyer's country.
|
|
7522
7577
|
*
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -5390,6 +5390,14 @@ function withoutCredentialHeaders(extra) {
|
|
|
5390
5390
|
}
|
|
5391
5391
|
return out;
|
|
5392
5392
|
}
|
|
5393
|
+
function withoutHeader(headers, name) {
|
|
5394
|
+
const out = {};
|
|
5395
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
5396
|
+
if (key.toLowerCase() === name) continue;
|
|
5397
|
+
out[key] = value;
|
|
5398
|
+
}
|
|
5399
|
+
return out;
|
|
5400
|
+
}
|
|
5393
5401
|
var CheckoutSession = class {
|
|
5394
5402
|
constructor(options) {
|
|
5395
5403
|
this.merchantId = options.merchantId;
|
|
@@ -5436,6 +5444,112 @@ var CheckoutSession = class {
|
|
|
5436
5444
|
}
|
|
5437
5445
|
return this.clientSecret;
|
|
5438
5446
|
}
|
|
5447
|
+
/**
|
|
5448
|
+
* The hosted checkout's bootstrap payload for a one-time payment —
|
|
5449
|
+
* `CheckoutDetails` while payable, a status view once settled.
|
|
5450
|
+
*
|
|
5451
|
+
* Deliberately unauthenticated: a `pay_` link bootstraps before any
|
|
5452
|
+
* credential exists, so no credential header is ever attached (caller
|
|
5453
|
+
* extras are still stripped of credentials). The response is a large
|
|
5454
|
+
* discriminated union owned by the consuming checkout, which keeps its
|
|
5455
|
+
* own types and runtime gates — hence the loose return type.
|
|
5456
|
+
*
|
|
5457
|
+
* `theme` is the route's one declared query parameter (a named checkout
|
|
5458
|
+
* variant, backend#793). `locale` travels as `Accept-Language` — the only
|
|
5459
|
+
* channel the backend's locale resolution reads; a `?locale=` query is
|
|
5460
|
+
* silently ignored by this route.
|
|
5461
|
+
*
|
|
5462
|
+
* `GET /payment-link/data/{merchantId}/{paymentId}`
|
|
5463
|
+
*/
|
|
5464
|
+
async fetchCheckoutData(params, options) {
|
|
5465
|
+
return this.client.request(
|
|
5466
|
+
"GET",
|
|
5467
|
+
`/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5468
|
+
{
|
|
5469
|
+
query: { theme: params?.theme },
|
|
5470
|
+
...options,
|
|
5471
|
+
headers: {
|
|
5472
|
+
...params?.locale ? {
|
|
5473
|
+
...withoutHeader(withoutCredentialHeaders(options?.headers), "accept-language"),
|
|
5474
|
+
"Accept-Language": params.locale
|
|
5475
|
+
} : withoutCredentialHeaders(options?.headers)
|
|
5476
|
+
}
|
|
5477
|
+
}
|
|
5478
|
+
);
|
|
5479
|
+
}
|
|
5480
|
+
/**
|
|
5481
|
+
* The subscription twin of {@link CheckoutSession.fetchCheckoutData}: the
|
|
5482
|
+
* bootstrap payload for a `sub_` checkout. Authenticated with the
|
|
5483
|
+
* subscription's client secret (construct the session with the `sub_…` id
|
|
5484
|
+
* in the `paymentId` slot). `locale` travels as `Accept-Language`, same
|
|
5485
|
+
* as {@link CheckoutSession.fetchCheckoutData}.
|
|
5486
|
+
*
|
|
5487
|
+
* `GET /subscriptions/data/{merchantId}/{subscriptionId}`
|
|
5488
|
+
*/
|
|
5489
|
+
async fetchSubscriptionData(params, options) {
|
|
5490
|
+
return this.client.request(
|
|
5491
|
+
"GET",
|
|
5492
|
+
`/subscriptions/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5493
|
+
{
|
|
5494
|
+
...options,
|
|
5495
|
+
headers: {
|
|
5496
|
+
...params?.locale ? {
|
|
5497
|
+
...withoutHeader(this.bearerHeaders(options?.headers), "accept-language"),
|
|
5498
|
+
"Accept-Language": params.locale
|
|
5499
|
+
} : this.bearerHeaders(options?.headers)
|
|
5500
|
+
}
|
|
5501
|
+
}
|
|
5502
|
+
);
|
|
5503
|
+
}
|
|
5504
|
+
/**
|
|
5505
|
+
* Report buyer/device signals for rails that never reach
|
|
5506
|
+
* `/payments/{id}/confirm` (the Stripe SAQ-A rail: raw cards, Apple Pay,
|
|
5507
|
+
* Google Pay). Same telemetry contract as
|
|
5508
|
+
* {@link CheckoutSession.recordEvent}: sent with `keepalive: true`, and
|
|
5509
|
+
* failures resolve instead of rejecting — signals must never block or
|
|
5510
|
+
* break a checkout. Unauthenticated by design.
|
|
5511
|
+
*
|
|
5512
|
+
* `POST /payment-link/client-signals/{merchantId}/{paymentId}`
|
|
5513
|
+
*/
|
|
5514
|
+
async reportClientSignals(params, options) {
|
|
5515
|
+
try {
|
|
5516
|
+
await this.client.request(
|
|
5517
|
+
"POST",
|
|
5518
|
+
`/payment-link/client-signals/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
5519
|
+
{
|
|
5520
|
+
body: params,
|
|
5521
|
+
keepalive: true,
|
|
5522
|
+
...options,
|
|
5523
|
+
headers: withoutCredentialHeaders(options?.headers)
|
|
5524
|
+
}
|
|
5525
|
+
);
|
|
5526
|
+
} catch {
|
|
5527
|
+
}
|
|
5528
|
+
}
|
|
5529
|
+
/**
|
|
5530
|
+
* Confirm a subscription (PayPal approval rail). The client secret is
|
|
5531
|
+
* attached automatically; the shop's profile id travels as the
|
|
5532
|
+
* `X-Profile-Id` header the subscription routes require.
|
|
5533
|
+
*
|
|
5534
|
+
* `POST /subscriptions/{subscriptionId}/confirm` (publishable key)
|
|
5535
|
+
*/
|
|
5536
|
+
async confirmSubscription(subscriptionId, profileId, params, options) {
|
|
5537
|
+
return this.client.request(
|
|
5538
|
+
"POST",
|
|
5539
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}/confirm`,
|
|
5540
|
+
{
|
|
5541
|
+
body: { ...params, client_secret: this.requireClientSecret() },
|
|
5542
|
+
...options,
|
|
5543
|
+
// Strip any caller-supplied x-profile-id first (case-insensitively):
|
|
5544
|
+
// Fetch folds duplicate headers into `caller, pro_x`, and the
|
|
5545
|
+
// subscription routes must see exactly one profile scope.
|
|
5546
|
+
headers: {
|
|
5547
|
+
...withoutHeader(this.pkHeaders(options?.headers), "x-profile-id"),
|
|
5548
|
+
"X-Profile-Id": profileId
|
|
5549
|
+
}
|
|
5550
|
+
}
|
|
5551
|
+
);
|
|
5552
|
+
}
|
|
5439
5553
|
/**
|
|
5440
5554
|
* The Paysepro rail catalog for the buyer's country.
|
|
5441
5555
|
*
|