@delopay/sdk 0.86.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/index.d.cts CHANGED
@@ -149,6 +149,13 @@ interface PaymentCreateRequest {
149
149
  description?: string | null;
150
150
  /** URL to redirect the customer to after payment (required for redirect-based methods). */
151
151
  return_url?: string | null;
152
+ /**
153
+ * How long the client secret / hosted checkout link stays usable, in
154
+ * seconds from creation. Omit to inherit the shop's default
155
+ * (`business_profile.session_expiry`, itself defaulting to 15 minutes).
156
+ * The backend rejects values outside its accepted window with a 400.
157
+ */
158
+ session_expiry?: number | null;
152
159
  /** Descriptor shown on the customer's bank statement (name portion). */
153
160
  statement_descriptor_name?: string | null;
154
161
  /** Descriptor shown on the customer's bank statement (suffix portion). */
@@ -211,6 +218,8 @@ interface PaymentCreateRequest {
211
218
  interface PaymentUpdateRequest {
212
219
  amount?: number | null;
213
220
  currency?: Currency | null;
221
+ /** See {@link PaymentCreateRequest.session_expiry}. */
222
+ session_expiry?: number | null;
214
223
  order_tax_amount?: number | null;
215
224
  amount_to_capture?: number | null;
216
225
  shipping_cost?: number | null;
@@ -346,6 +355,14 @@ interface PaymentResponse {
346
355
  client_secret?: string | null;
347
356
  /** ISO 8601 timestamp when the payment was created. */
348
357
  created?: string | null;
358
+ /**
359
+ * ISO 8601 timestamp when the payment (its client secret / hosted
360
+ * checkout link) expires — the backend's resolved `session_expiry`, which
361
+ * may differ from the requested one if it was omitted or clamped.
362
+ * Backends predating the field omit the key entirely (`undefined` here);
363
+ * backends that expose it may still send `null` when no expiry applies.
364
+ */
365
+ expires_on?: string | null;
349
366
  /** ISO 8601 timestamp of the last status update. */
350
367
  last_updated?: string | null;
351
368
  /** Whether the payment method is saved for future use. */
@@ -3856,11 +3873,15 @@ interface OperationLimitRule {
3856
3873
  merchant_id: string;
3857
3874
  operation: LimitedOperation;
3858
3875
  scope: OperationLimitScope;
3859
- scope_id?: string | null;
3860
- max_amount_per_operation?: number | null;
3861
- max_total_amount_per_window?: number | null;
3862
- max_count_per_window?: number | null;
3863
- max_payment_age_days?: number | null;
3876
+ /**
3877
+ * Always present on the wire (nullable, never omitted) — as are the four
3878
+ * limit fields below: the backend serializes every `Option` key.
3879
+ */
3880
+ scope_id: string | null;
3881
+ max_amount_per_operation: number | null;
3882
+ max_total_amount_per_window: number | null;
3883
+ max_count_per_window: number | null;
3884
+ max_payment_age_days: number | null;
3864
3885
  window_hours: number;
3865
3886
  /** ISO currency code of the amount fields. */
3866
3887
  currency: string;
@@ -7496,6 +7517,61 @@ declare class CheckoutSession {
7496
7517
  /** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
7497
7518
  private pkHeaders;
7498
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>;
7499
7575
  /**
7500
7576
  * The Paysepro rail catalog for the buyer's country.
7501
7577
  *
package/dist/index.d.ts CHANGED
@@ -149,6 +149,13 @@ interface PaymentCreateRequest {
149
149
  description?: string | null;
150
150
  /** URL to redirect the customer to after payment (required for redirect-based methods). */
151
151
  return_url?: string | null;
152
+ /**
153
+ * How long the client secret / hosted checkout link stays usable, in
154
+ * seconds from creation. Omit to inherit the shop's default
155
+ * (`business_profile.session_expiry`, itself defaulting to 15 minutes).
156
+ * The backend rejects values outside its accepted window with a 400.
157
+ */
158
+ session_expiry?: number | null;
152
159
  /** Descriptor shown on the customer's bank statement (name portion). */
153
160
  statement_descriptor_name?: string | null;
154
161
  /** Descriptor shown on the customer's bank statement (suffix portion). */
@@ -211,6 +218,8 @@ interface PaymentCreateRequest {
211
218
  interface PaymentUpdateRequest {
212
219
  amount?: number | null;
213
220
  currency?: Currency | null;
221
+ /** See {@link PaymentCreateRequest.session_expiry}. */
222
+ session_expiry?: number | null;
214
223
  order_tax_amount?: number | null;
215
224
  amount_to_capture?: number | null;
216
225
  shipping_cost?: number | null;
@@ -346,6 +355,14 @@ interface PaymentResponse {
346
355
  client_secret?: string | null;
347
356
  /** ISO 8601 timestamp when the payment was created. */
348
357
  created?: string | null;
358
+ /**
359
+ * ISO 8601 timestamp when the payment (its client secret / hosted
360
+ * checkout link) expires — the backend's resolved `session_expiry`, which
361
+ * may differ from the requested one if it was omitted or clamped.
362
+ * Backends predating the field omit the key entirely (`undefined` here);
363
+ * backends that expose it may still send `null` when no expiry applies.
364
+ */
365
+ expires_on?: string | null;
349
366
  /** ISO 8601 timestamp of the last status update. */
350
367
  last_updated?: string | null;
351
368
  /** Whether the payment method is saved for future use. */
@@ -3856,11 +3873,15 @@ interface OperationLimitRule {
3856
3873
  merchant_id: string;
3857
3874
  operation: LimitedOperation;
3858
3875
  scope: OperationLimitScope;
3859
- scope_id?: string | null;
3860
- max_amount_per_operation?: number | null;
3861
- max_total_amount_per_window?: number | null;
3862
- max_count_per_window?: number | null;
3863
- max_payment_age_days?: number | null;
3876
+ /**
3877
+ * Always present on the wire (nullable, never omitted) — as are the four
3878
+ * limit fields below: the backend serializes every `Option` key.
3879
+ */
3880
+ scope_id: string | null;
3881
+ max_amount_per_operation: number | null;
3882
+ max_total_amount_per_window: number | null;
3883
+ max_count_per_window: number | null;
3884
+ max_payment_age_days: number | null;
3864
3885
  window_hours: number;
3865
3886
  /** ISO currency code of the amount fields. */
3866
3887
  currency: string;
@@ -7496,6 +7517,61 @@ declare class CheckoutSession {
7496
7517
  /** Headers for the publishable-key routes (`/payments/*`, `/payment-methods`). */
7497
7518
  private pkHeaders;
7498
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>;
7499
7575
  /**
7500
7576
  * The Paysepro rail catalog for the buyer's country.
7501
7577
  *
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ import {
88
88
  surfacePadValue,
89
89
  verticalGapValue,
90
90
  visibleCustomFields
91
- } from "./chunk-DQ36QCU7.js";
91
+ } from "./chunk-BWTQ34HP.js";
92
92
  export {
93
93
  ALL_CUSTOM_FIELD_CONDITION_SOURCES,
94
94
  ALL_CUSTOM_FIELD_OPERATORS,
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
  *