@delopay/sdk 0.29.0 → 0.31.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 +10 -4
- package/dist/{chunk-4Q3E7XLP.js → chunk-5C42YTV2.js} +79 -47
- package/dist/chunk-5C42YTV2.js.map +1 -0
- package/dist/index.cjs +78 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -27
- package/dist/index.d.ts +66 -27
- package/dist/index.js +1 -1
- package/dist/internal.cjs +92 -60
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +4 -4
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +15 -15
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4Q3E7XLP.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -185,6 +185,8 @@ interface PaymentCreateRequest {
|
|
|
185
185
|
allowed_payment_method_types?: PaymentMethodType[] | null;
|
|
186
186
|
/** Browser metadata for 3-D Secure fingerprinting. */
|
|
187
187
|
browser_info?: Record<string, unknown> | null;
|
|
188
|
+
/** Set to `true` to generate a hosted payment link for this payment. */
|
|
189
|
+
payment_link?: boolean | null;
|
|
188
190
|
}
|
|
189
191
|
interface PaymentUpdateRequest {
|
|
190
192
|
amount?: number | null;
|
|
@@ -217,6 +219,8 @@ interface PaymentUpdateRequest {
|
|
|
217
219
|
phone_country_code?: string | null;
|
|
218
220
|
}
|
|
219
221
|
interface PaymentConfirmRequest {
|
|
222
|
+
/** Client secret from the created payment, required for client-side confirmation with a publishable key. */
|
|
223
|
+
client_secret?: string | null;
|
|
220
224
|
payment_method?: PaymentMethod | null;
|
|
221
225
|
payment_method_type?: PaymentMethodType | null;
|
|
222
226
|
payment_method_data?: Record<string, unknown> | null;
|
|
@@ -323,6 +327,8 @@ interface PaymentResponse {
|
|
|
323
327
|
disputes?: DisputeResponse[] | null;
|
|
324
328
|
/** Instructions for completing additional customer actions (3DS redirect, etc.). */
|
|
325
329
|
next_action?: Record<string, unknown> | null;
|
|
330
|
+
/** Hosted payment link details, present when the payment was created with `payment_link: true`. */
|
|
331
|
+
payment_link?: PaymentLinkResponse | null;
|
|
326
332
|
/** Reason provided when the payment was cancelled. */
|
|
327
333
|
cancellation_reason?: string | null;
|
|
328
334
|
/** Bank statement descriptor (name portion). */
|
|
@@ -541,6 +547,8 @@ interface PaymentMethodResponse {
|
|
|
541
547
|
client_secret?: string | null;
|
|
542
548
|
status?: string | null;
|
|
543
549
|
billing?: Address | null;
|
|
550
|
+
/** Token used to charge this saved method on a later payment (pass as `payment_token` to `payments.create`). */
|
|
551
|
+
payment_token?: string | null;
|
|
544
552
|
}
|
|
545
553
|
interface PaymentMethodListParams {
|
|
546
554
|
client_secret?: string | null;
|
|
@@ -668,6 +676,8 @@ interface ShopUpdateRequest {
|
|
|
668
676
|
return_url?: string | null;
|
|
669
677
|
webhook_url?: string | null;
|
|
670
678
|
is_active?: boolean | null;
|
|
679
|
+
/** Webhook signing secret for this shop. Outgoing webhooks are HMAC-SHA512 signed with this key. */
|
|
680
|
+
payment_response_hash_key?: string | null;
|
|
671
681
|
payment_link_config?: BusinessPaymentLinkConfig | null;
|
|
672
682
|
/**
|
|
673
683
|
* Origins permitted to embed this shop's hosted checkout in an iframe.
|
|
@@ -1948,9 +1958,10 @@ declare class Authentication {
|
|
|
1948
1958
|
create(params: AuthenticationCreateRequest): Promise<AuthenticationResponse>;
|
|
1949
1959
|
checkEligibility(authId: string): Promise<AuthenticationResponse>;
|
|
1950
1960
|
authenticate(authId: string, params: Record<string, unknown>): Promise<AuthenticationResponse>;
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1961
|
+
/** Sync authentication status. `POST /authentication/{merchantId}/{authId}/sync` */
|
|
1962
|
+
sync(merchantId: string, authId: string, params?: Record<string, unknown>): Promise<AuthenticationResponse>;
|
|
1963
|
+
/** Redirect after authentication. `POST /authentication/{merchantId}/{authId}/redirect` */
|
|
1964
|
+
redirect(merchantId: string, authId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1954
1965
|
/** Enable authn methods token. `POST /authentication/{authId}/enabled-authn-methods-token` */
|
|
1955
1966
|
enabledAuthnMethodsToken(authId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1956
1967
|
/** Submit eligibility check. `POST /authentication/{authId}/eligibility-check` */
|
|
@@ -2381,7 +2392,7 @@ declare class PaymentLinks {
|
|
|
2381
2392
|
list(params?: PaymentLinkListParams): Promise<PaymentLinkListResponse>;
|
|
2382
2393
|
/** Initiate (render) a payment link page. `GET /payment-link/{merchantId}/{paymentId}` */
|
|
2383
2394
|
initiate(merchantId: string, paymentId: string): Promise<Record<string, unknown>>;
|
|
2384
|
-
/** Get payment link status. `GET /payment-
|
|
2395
|
+
/** Get payment link status. `GET /payment-link/status/{merchantId}/{paymentId}` */
|
|
2385
2396
|
status(merchantId: string, paymentId: string): Promise<Record<string, unknown>>;
|
|
2386
2397
|
}
|
|
2387
2398
|
|
|
@@ -2491,18 +2502,20 @@ declare class Payments {
|
|
|
2491
2502
|
* Create a new payment intent.
|
|
2492
2503
|
*
|
|
2493
2504
|
* @param params - Payment creation parameters including amount and currency.
|
|
2505
|
+
* @param options - Optional per-call extras: extra `headers` (e.g. an
|
|
2506
|
+
* `Idempotency-Key` to make the create safe to retry), a `timeout` override,
|
|
2507
|
+
* and an `AbortSignal`.
|
|
2494
2508
|
* @returns The created payment intent.
|
|
2495
2509
|
*
|
|
2496
2510
|
* @example
|
|
2497
2511
|
* ```typescript
|
|
2498
|
-
* const payment = await delopay.payments.create(
|
|
2499
|
-
* amount: 5000,
|
|
2500
|
-
*
|
|
2501
|
-
*
|
|
2502
|
-
* });
|
|
2512
|
+
* const payment = await delopay.payments.create(
|
|
2513
|
+
* { amount: 5000, currency: 'EUR', customer_id: 'cus_123' },
|
|
2514
|
+
* { headers: { 'Idempotency-Key': 'order_1001' } },
|
|
2515
|
+
* );
|
|
2503
2516
|
* ```
|
|
2504
2517
|
*/
|
|
2505
|
-
create(params: PaymentCreateRequest): Promise<PaymentResponse>;
|
|
2518
|
+
create(params: PaymentCreateRequest, options?: RequestExtras): Promise<PaymentResponse>;
|
|
2506
2519
|
/**
|
|
2507
2520
|
* Retrieve a payment by its ID.
|
|
2508
2521
|
*
|
|
@@ -2561,6 +2574,8 @@ declare class Payments {
|
|
|
2561
2574
|
* List payment intents, optionally filtered by customer or date range.
|
|
2562
2575
|
*
|
|
2563
2576
|
* @param params - Optional filter and pagination parameters.
|
|
2577
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
2578
|
+
* override, and an `AbortSignal` for cancellation.
|
|
2564
2579
|
* @returns Paginated list of payment intents.
|
|
2565
2580
|
*
|
|
2566
2581
|
* @example
|
|
@@ -2568,7 +2583,7 @@ declare class Payments {
|
|
|
2568
2583
|
* const { data } = await delopay.payments.list({ customer_id: 'cus_123', limit: 25 });
|
|
2569
2584
|
* ```
|
|
2570
2585
|
*/
|
|
2571
|
-
list(params?: PaymentListParams): Promise<PaymentListResponse>;
|
|
2586
|
+
list(params?: PaymentListParams, options?: RequestExtras): Promise<PaymentListResponse>;
|
|
2572
2587
|
/** Generate session tokens. `POST /payments/session-tokens` */
|
|
2573
2588
|
sessionTokens(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2574
2589
|
/** Retrieve payment with gateway credentials. `POST /payments/sync` */
|
|
@@ -2677,10 +2692,10 @@ declare class Payouts {
|
|
|
2677
2692
|
listByProfile(params?: PayoutListParams): Promise<PayoutListResponse>;
|
|
2678
2693
|
/** List payouts by filter (POST body). `POST /payouts/list` */
|
|
2679
2694
|
listByFilter(params: Record<string, unknown>): Promise<PayoutListResponse>;
|
|
2680
|
-
/** Get payout filter options. `
|
|
2681
|
-
getFilters(params?: Record<string,
|
|
2682
|
-
/** Get payout filters (profile-scoped). `
|
|
2683
|
-
getFiltersByProfile(params?: Record<string,
|
|
2695
|
+
/** Get payout filter options. `GET /payouts/filter` */
|
|
2696
|
+
getFilters(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2697
|
+
/** Get payout filters (profile-scoped). `GET /payouts/profile/filter` */
|
|
2698
|
+
getFiltersByProfile(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2684
2699
|
/** Get payout aggregates. `GET /payouts/aggregate` */
|
|
2685
2700
|
aggregate(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2686
2701
|
/** Get payout aggregates (profile-scoped). `GET /payouts/profile/aggregate` */
|
|
@@ -3030,7 +3045,7 @@ declare class Shops {
|
|
|
3030
3045
|
*
|
|
3031
3046
|
* @example
|
|
3032
3047
|
* ```typescript
|
|
3033
|
-
* const shop = await delopay.shops.create('merch_123', {
|
|
3048
|
+
* const shop = await delopay.shops.create('merch_123', { shop_name: 'EU Store' });
|
|
3034
3049
|
* ```
|
|
3035
3050
|
*/
|
|
3036
3051
|
create(merchantId: string, params: ShopCreateRequest): Promise<ShopResponse>;
|
|
@@ -3272,7 +3287,7 @@ declare class Users {
|
|
|
3272
3287
|
listUsersInLineage(params?: {
|
|
3273
3288
|
entity_type?: string;
|
|
3274
3289
|
}): Promise<Record<string, unknown>[]>;
|
|
3275
|
-
/** Resend invite. `POST /user/
|
|
3290
|
+
/** Resend invite. `POST /user/resend-invite` */
|
|
3276
3291
|
resendInvite(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3277
3292
|
/**
|
|
3278
3293
|
* Get the caller's parent permission groups + scopes.
|
|
@@ -3290,10 +3305,6 @@ declare class Users {
|
|
|
3290
3305
|
listInvitableRoles(params?: ListInvitableRolesParams): Promise<Record<string, unknown>[]>;
|
|
3291
3306
|
/** List updatable roles. `GET /user/role/list/update` */
|
|
3292
3307
|
listUpdatableRoles(): Promise<Record<string, unknown>[]>;
|
|
3293
|
-
/** Get permission info. `GET /user/permission-info` */
|
|
3294
|
-
getPermissionInfo(): Promise<Record<string, unknown>>;
|
|
3295
|
-
/** Get module list. `GET /user/module/list` */
|
|
3296
|
-
getModuleList(): Promise<Record<string, unknown>[]>;
|
|
3297
3308
|
/** Get parent list. `GET /user/parent/list` */
|
|
3298
3309
|
getParentList(): Promise<Record<string, unknown>[]>;
|
|
3299
3310
|
/** Create a role. `POST /user/role` */
|
|
@@ -3511,6 +3522,12 @@ interface RequestOptions {
|
|
|
3511
3522
|
signal?: AbortSignal;
|
|
3512
3523
|
}
|
|
3513
3524
|
type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;
|
|
3525
|
+
/**
|
|
3526
|
+
* Per-call options that resource methods accept as an optional final argument:
|
|
3527
|
+
* extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,
|
|
3528
|
+
* and an `AbortSignal` for cancellation.
|
|
3529
|
+
*/
|
|
3530
|
+
type RequestExtras = Pick<RequestOptions, 'headers' | 'timeout' | 'signal'>;
|
|
3514
3531
|
/**
|
|
3515
3532
|
* Delopay API client.
|
|
3516
3533
|
*
|
|
@@ -3520,7 +3537,7 @@ type RequestFn = <T>(method: string, path: string, options?: RequestOptions) =>
|
|
|
3520
3537
|
*
|
|
3521
3538
|
* @example
|
|
3522
3539
|
* ```typescript
|
|
3523
|
-
* const delopay = new Delopay('
|
|
3540
|
+
* const delopay = new Delopay('prd_...', { sandbox: false });
|
|
3524
3541
|
* const payment = await delopay.payments.create({ amount: 5000, currency: 'EUR' });
|
|
3525
3542
|
* ```
|
|
3526
3543
|
*/
|
|
@@ -3578,7 +3595,7 @@ declare class Delopay {
|
|
|
3578
3595
|
/**
|
|
3579
3596
|
* Create a new Delopay client.
|
|
3580
3597
|
*
|
|
3581
|
-
* @param apiKey - Your Delopay API key (e.g. `
|
|
3598
|
+
* @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).
|
|
3582
3599
|
* Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
|
|
3583
3600
|
* @param options - Optional configuration (sandbox mode, base URL override, timeout).
|
|
3584
3601
|
*/
|
|
@@ -3611,14 +3628,32 @@ declare class Delopay {
|
|
|
3611
3628
|
* Auto-paginate a list endpoint. Yields items one by one, fetching
|
|
3612
3629
|
* the next page automatically when the current one is exhausted.
|
|
3613
3630
|
*
|
|
3614
|
-
*
|
|
3631
|
+
* Delopay list endpoints use one of two pagination styles, so this helper
|
|
3632
|
+
* supports both:
|
|
3633
|
+
* - **Offset** (default) — for endpoints like `customers.list` that accept
|
|
3634
|
+
* `offset`/`limit`. Each page advances `offset` by the number of items returned.
|
|
3635
|
+
* - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page
|
|
3636
|
+
* with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor
|
|
3637
|
+
* that returns the id of an item; the next page is requested with
|
|
3638
|
+
* `starting_after` set to the last item's id.
|
|
3639
|
+
*
|
|
3640
|
+
* @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.
|
|
3615
3641
|
* @param params - Additional parameters to pass to every page request.
|
|
3616
|
-
* @param
|
|
3642
|
+
* @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.
|
|
3643
|
+
* Provide `cursor` to switch to cursor pagination.
|
|
3617
3644
|
*
|
|
3618
3645
|
* @example
|
|
3619
3646
|
* ```typescript
|
|
3647
|
+
* // Offset endpoint (customers):
|
|
3648
|
+
* for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {
|
|
3649
|
+
* console.log(c.customer_id);
|
|
3650
|
+
* }
|
|
3651
|
+
*
|
|
3652
|
+
* // Cursor endpoint (payments): extract the id used as the next cursor.
|
|
3620
3653
|
* for await (const payment of delopay.paginate(
|
|
3621
3654
|
* (p) => delopay.payments.list(p),
|
|
3655
|
+
* undefined,
|
|
3656
|
+
* { cursor: (p) => p.payment_id },
|
|
3622
3657
|
* )) {
|
|
3623
3658
|
* console.log(payment.payment_id);
|
|
3624
3659
|
* }
|
|
@@ -3626,10 +3661,14 @@ declare class Delopay {
|
|
|
3626
3661
|
*/
|
|
3627
3662
|
paginate<T, P extends Record<string, unknown>>(listFn: (params: P & {
|
|
3628
3663
|
limit: number;
|
|
3629
|
-
offset
|
|
3664
|
+
offset?: number;
|
|
3665
|
+
starting_after?: string;
|
|
3630
3666
|
}) => Promise<{
|
|
3631
3667
|
data: T[];
|
|
3632
|
-
} | T[]>, params?: P,
|
|
3668
|
+
} | T[]>, params?: P, options?: number | {
|
|
3669
|
+
pageSize?: number;
|
|
3670
|
+
cursor?: (item: T) => string | undefined;
|
|
3671
|
+
}): AsyncGenerator<T>;
|
|
3633
3672
|
}
|
|
3634
3673
|
|
|
3635
3674
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,8 @@ interface PaymentCreateRequest {
|
|
|
185
185
|
allowed_payment_method_types?: PaymentMethodType[] | null;
|
|
186
186
|
/** Browser metadata for 3-D Secure fingerprinting. */
|
|
187
187
|
browser_info?: Record<string, unknown> | null;
|
|
188
|
+
/** Set to `true` to generate a hosted payment link for this payment. */
|
|
189
|
+
payment_link?: boolean | null;
|
|
188
190
|
}
|
|
189
191
|
interface PaymentUpdateRequest {
|
|
190
192
|
amount?: number | null;
|
|
@@ -217,6 +219,8 @@ interface PaymentUpdateRequest {
|
|
|
217
219
|
phone_country_code?: string | null;
|
|
218
220
|
}
|
|
219
221
|
interface PaymentConfirmRequest {
|
|
222
|
+
/** Client secret from the created payment, required for client-side confirmation with a publishable key. */
|
|
223
|
+
client_secret?: string | null;
|
|
220
224
|
payment_method?: PaymentMethod | null;
|
|
221
225
|
payment_method_type?: PaymentMethodType | null;
|
|
222
226
|
payment_method_data?: Record<string, unknown> | null;
|
|
@@ -323,6 +327,8 @@ interface PaymentResponse {
|
|
|
323
327
|
disputes?: DisputeResponse[] | null;
|
|
324
328
|
/** Instructions for completing additional customer actions (3DS redirect, etc.). */
|
|
325
329
|
next_action?: Record<string, unknown> | null;
|
|
330
|
+
/** Hosted payment link details, present when the payment was created with `payment_link: true`. */
|
|
331
|
+
payment_link?: PaymentLinkResponse | null;
|
|
326
332
|
/** Reason provided when the payment was cancelled. */
|
|
327
333
|
cancellation_reason?: string | null;
|
|
328
334
|
/** Bank statement descriptor (name portion). */
|
|
@@ -541,6 +547,8 @@ interface PaymentMethodResponse {
|
|
|
541
547
|
client_secret?: string | null;
|
|
542
548
|
status?: string | null;
|
|
543
549
|
billing?: Address | null;
|
|
550
|
+
/** Token used to charge this saved method on a later payment (pass as `payment_token` to `payments.create`). */
|
|
551
|
+
payment_token?: string | null;
|
|
544
552
|
}
|
|
545
553
|
interface PaymentMethodListParams {
|
|
546
554
|
client_secret?: string | null;
|
|
@@ -668,6 +676,8 @@ interface ShopUpdateRequest {
|
|
|
668
676
|
return_url?: string | null;
|
|
669
677
|
webhook_url?: string | null;
|
|
670
678
|
is_active?: boolean | null;
|
|
679
|
+
/** Webhook signing secret for this shop. Outgoing webhooks are HMAC-SHA512 signed with this key. */
|
|
680
|
+
payment_response_hash_key?: string | null;
|
|
671
681
|
payment_link_config?: BusinessPaymentLinkConfig | null;
|
|
672
682
|
/**
|
|
673
683
|
* Origins permitted to embed this shop's hosted checkout in an iframe.
|
|
@@ -1948,9 +1958,10 @@ declare class Authentication {
|
|
|
1948
1958
|
create(params: AuthenticationCreateRequest): Promise<AuthenticationResponse>;
|
|
1949
1959
|
checkEligibility(authId: string): Promise<AuthenticationResponse>;
|
|
1950
1960
|
authenticate(authId: string, params: Record<string, unknown>): Promise<AuthenticationResponse>;
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1961
|
+
/** Sync authentication status. `POST /authentication/{merchantId}/{authId}/sync` */
|
|
1962
|
+
sync(merchantId: string, authId: string, params?: Record<string, unknown>): Promise<AuthenticationResponse>;
|
|
1963
|
+
/** Redirect after authentication. `POST /authentication/{merchantId}/{authId}/redirect` */
|
|
1964
|
+
redirect(merchantId: string, authId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1954
1965
|
/** Enable authn methods token. `POST /authentication/{authId}/enabled-authn-methods-token` */
|
|
1955
1966
|
enabledAuthnMethodsToken(authId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1956
1967
|
/** Submit eligibility check. `POST /authentication/{authId}/eligibility-check` */
|
|
@@ -2381,7 +2392,7 @@ declare class PaymentLinks {
|
|
|
2381
2392
|
list(params?: PaymentLinkListParams): Promise<PaymentLinkListResponse>;
|
|
2382
2393
|
/** Initiate (render) a payment link page. `GET /payment-link/{merchantId}/{paymentId}` */
|
|
2383
2394
|
initiate(merchantId: string, paymentId: string): Promise<Record<string, unknown>>;
|
|
2384
|
-
/** Get payment link status. `GET /payment-
|
|
2395
|
+
/** Get payment link status. `GET /payment-link/status/{merchantId}/{paymentId}` */
|
|
2385
2396
|
status(merchantId: string, paymentId: string): Promise<Record<string, unknown>>;
|
|
2386
2397
|
}
|
|
2387
2398
|
|
|
@@ -2491,18 +2502,20 @@ declare class Payments {
|
|
|
2491
2502
|
* Create a new payment intent.
|
|
2492
2503
|
*
|
|
2493
2504
|
* @param params - Payment creation parameters including amount and currency.
|
|
2505
|
+
* @param options - Optional per-call extras: extra `headers` (e.g. an
|
|
2506
|
+
* `Idempotency-Key` to make the create safe to retry), a `timeout` override,
|
|
2507
|
+
* and an `AbortSignal`.
|
|
2494
2508
|
* @returns The created payment intent.
|
|
2495
2509
|
*
|
|
2496
2510
|
* @example
|
|
2497
2511
|
* ```typescript
|
|
2498
|
-
* const payment = await delopay.payments.create(
|
|
2499
|
-
* amount: 5000,
|
|
2500
|
-
*
|
|
2501
|
-
*
|
|
2502
|
-
* });
|
|
2512
|
+
* const payment = await delopay.payments.create(
|
|
2513
|
+
* { amount: 5000, currency: 'EUR', customer_id: 'cus_123' },
|
|
2514
|
+
* { headers: { 'Idempotency-Key': 'order_1001' } },
|
|
2515
|
+
* );
|
|
2503
2516
|
* ```
|
|
2504
2517
|
*/
|
|
2505
|
-
create(params: PaymentCreateRequest): Promise<PaymentResponse>;
|
|
2518
|
+
create(params: PaymentCreateRequest, options?: RequestExtras): Promise<PaymentResponse>;
|
|
2506
2519
|
/**
|
|
2507
2520
|
* Retrieve a payment by its ID.
|
|
2508
2521
|
*
|
|
@@ -2561,6 +2574,8 @@ declare class Payments {
|
|
|
2561
2574
|
* List payment intents, optionally filtered by customer or date range.
|
|
2562
2575
|
*
|
|
2563
2576
|
* @param params - Optional filter and pagination parameters.
|
|
2577
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
2578
|
+
* override, and an `AbortSignal` for cancellation.
|
|
2564
2579
|
* @returns Paginated list of payment intents.
|
|
2565
2580
|
*
|
|
2566
2581
|
* @example
|
|
@@ -2568,7 +2583,7 @@ declare class Payments {
|
|
|
2568
2583
|
* const { data } = await delopay.payments.list({ customer_id: 'cus_123', limit: 25 });
|
|
2569
2584
|
* ```
|
|
2570
2585
|
*/
|
|
2571
|
-
list(params?: PaymentListParams): Promise<PaymentListResponse>;
|
|
2586
|
+
list(params?: PaymentListParams, options?: RequestExtras): Promise<PaymentListResponse>;
|
|
2572
2587
|
/** Generate session tokens. `POST /payments/session-tokens` */
|
|
2573
2588
|
sessionTokens(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2574
2589
|
/** Retrieve payment with gateway credentials. `POST /payments/sync` */
|
|
@@ -2677,10 +2692,10 @@ declare class Payouts {
|
|
|
2677
2692
|
listByProfile(params?: PayoutListParams): Promise<PayoutListResponse>;
|
|
2678
2693
|
/** List payouts by filter (POST body). `POST /payouts/list` */
|
|
2679
2694
|
listByFilter(params: Record<string, unknown>): Promise<PayoutListResponse>;
|
|
2680
|
-
/** Get payout filter options. `
|
|
2681
|
-
getFilters(params?: Record<string,
|
|
2682
|
-
/** Get payout filters (profile-scoped). `
|
|
2683
|
-
getFiltersByProfile(params?: Record<string,
|
|
2695
|
+
/** Get payout filter options. `GET /payouts/filter` */
|
|
2696
|
+
getFilters(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2697
|
+
/** Get payout filters (profile-scoped). `GET /payouts/profile/filter` */
|
|
2698
|
+
getFiltersByProfile(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2684
2699
|
/** Get payout aggregates. `GET /payouts/aggregate` */
|
|
2685
2700
|
aggregate(params?: Record<string, string | number | undefined>): Promise<Record<string, unknown>>;
|
|
2686
2701
|
/** Get payout aggregates (profile-scoped). `GET /payouts/profile/aggregate` */
|
|
@@ -3030,7 +3045,7 @@ declare class Shops {
|
|
|
3030
3045
|
*
|
|
3031
3046
|
* @example
|
|
3032
3047
|
* ```typescript
|
|
3033
|
-
* const shop = await delopay.shops.create('merch_123', {
|
|
3048
|
+
* const shop = await delopay.shops.create('merch_123', { shop_name: 'EU Store' });
|
|
3034
3049
|
* ```
|
|
3035
3050
|
*/
|
|
3036
3051
|
create(merchantId: string, params: ShopCreateRequest): Promise<ShopResponse>;
|
|
@@ -3272,7 +3287,7 @@ declare class Users {
|
|
|
3272
3287
|
listUsersInLineage(params?: {
|
|
3273
3288
|
entity_type?: string;
|
|
3274
3289
|
}): Promise<Record<string, unknown>[]>;
|
|
3275
|
-
/** Resend invite. `POST /user/
|
|
3290
|
+
/** Resend invite. `POST /user/resend-invite` */
|
|
3276
3291
|
resendInvite(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3277
3292
|
/**
|
|
3278
3293
|
* Get the caller's parent permission groups + scopes.
|
|
@@ -3290,10 +3305,6 @@ declare class Users {
|
|
|
3290
3305
|
listInvitableRoles(params?: ListInvitableRolesParams): Promise<Record<string, unknown>[]>;
|
|
3291
3306
|
/** List updatable roles. `GET /user/role/list/update` */
|
|
3292
3307
|
listUpdatableRoles(): Promise<Record<string, unknown>[]>;
|
|
3293
|
-
/** Get permission info. `GET /user/permission-info` */
|
|
3294
|
-
getPermissionInfo(): Promise<Record<string, unknown>>;
|
|
3295
|
-
/** Get module list. `GET /user/module/list` */
|
|
3296
|
-
getModuleList(): Promise<Record<string, unknown>[]>;
|
|
3297
3308
|
/** Get parent list. `GET /user/parent/list` */
|
|
3298
3309
|
getParentList(): Promise<Record<string, unknown>[]>;
|
|
3299
3310
|
/** Create a role. `POST /user/role` */
|
|
@@ -3511,6 +3522,12 @@ interface RequestOptions {
|
|
|
3511
3522
|
signal?: AbortSignal;
|
|
3512
3523
|
}
|
|
3513
3524
|
type RequestFn = <T>(method: string, path: string, options?: RequestOptions) => Promise<T>;
|
|
3525
|
+
/**
|
|
3526
|
+
* Per-call options that resource methods accept as an optional final argument:
|
|
3527
|
+
* extra HTTP headers (e.g. `Idempotency-Key`), a per-request timeout override,
|
|
3528
|
+
* and an `AbortSignal` for cancellation.
|
|
3529
|
+
*/
|
|
3530
|
+
type RequestExtras = Pick<RequestOptions, 'headers' | 'timeout' | 'signal'>;
|
|
3514
3531
|
/**
|
|
3515
3532
|
* Delopay API client.
|
|
3516
3533
|
*
|
|
@@ -3520,7 +3537,7 @@ type RequestFn = <T>(method: string, path: string, options?: RequestOptions) =>
|
|
|
3520
3537
|
*
|
|
3521
3538
|
* @example
|
|
3522
3539
|
* ```typescript
|
|
3523
|
-
* const delopay = new Delopay('
|
|
3540
|
+
* const delopay = new Delopay('prd_...', { sandbox: false });
|
|
3524
3541
|
* const payment = await delopay.payments.create({ amount: 5000, currency: 'EUR' });
|
|
3525
3542
|
* ```
|
|
3526
3543
|
*/
|
|
@@ -3578,7 +3595,7 @@ declare class Delopay {
|
|
|
3578
3595
|
/**
|
|
3579
3596
|
* Create a new Delopay client.
|
|
3580
3597
|
*
|
|
3581
|
-
* @param apiKey - Your Delopay API key (e.g. `
|
|
3598
|
+
* @param apiKey - Your Delopay API key (e.g. `prd_...` or `snd_...`).
|
|
3582
3599
|
* Pass an empty string or omit for JWT-only usage (e.g. dashboard apps).
|
|
3583
3600
|
* @param options - Optional configuration (sandbox mode, base URL override, timeout).
|
|
3584
3601
|
*/
|
|
@@ -3611,14 +3628,32 @@ declare class Delopay {
|
|
|
3611
3628
|
* Auto-paginate a list endpoint. Yields items one by one, fetching
|
|
3612
3629
|
* the next page automatically when the current one is exhausted.
|
|
3613
3630
|
*
|
|
3614
|
-
*
|
|
3631
|
+
* Delopay list endpoints use one of two pagination styles, so this helper
|
|
3632
|
+
* supports both:
|
|
3633
|
+
* - **Offset** (default) — for endpoints like `customers.list` that accept
|
|
3634
|
+
* `offset`/`limit`. Each page advances `offset` by the number of items returned.
|
|
3635
|
+
* - **Cursor** — for endpoints like `payments.list` and `payouts.list` that page
|
|
3636
|
+
* with `starting_after`/`limit` (they ignore `offset`). Pass a `cursor` extractor
|
|
3637
|
+
* that returns the id of an item; the next page is requested with
|
|
3638
|
+
* `starting_after` set to the last item's id.
|
|
3639
|
+
*
|
|
3640
|
+
* @param listFn - A function that takes the paging params and returns `{ data: T[] }` or `T[]`.
|
|
3615
3641
|
* @param params - Additional parameters to pass to every page request.
|
|
3616
|
-
* @param
|
|
3642
|
+
* @param options - Page size (number) for offset mode, or `{ pageSize?, cursor? }`.
|
|
3643
|
+
* Provide `cursor` to switch to cursor pagination.
|
|
3617
3644
|
*
|
|
3618
3645
|
* @example
|
|
3619
3646
|
* ```typescript
|
|
3647
|
+
* // Offset endpoint (customers):
|
|
3648
|
+
* for await (const c of delopay.paginate((p) => delopay.customers.list(p))) {
|
|
3649
|
+
* console.log(c.customer_id);
|
|
3650
|
+
* }
|
|
3651
|
+
*
|
|
3652
|
+
* // Cursor endpoint (payments): extract the id used as the next cursor.
|
|
3620
3653
|
* for await (const payment of delopay.paginate(
|
|
3621
3654
|
* (p) => delopay.payments.list(p),
|
|
3655
|
+
* undefined,
|
|
3656
|
+
* { cursor: (p) => p.payment_id },
|
|
3622
3657
|
* )) {
|
|
3623
3658
|
* console.log(payment.payment_id);
|
|
3624
3659
|
* }
|
|
@@ -3626,10 +3661,14 @@ declare class Delopay {
|
|
|
3626
3661
|
*/
|
|
3627
3662
|
paginate<T, P extends Record<string, unknown>>(listFn: (params: P & {
|
|
3628
3663
|
limit: number;
|
|
3629
|
-
offset
|
|
3664
|
+
offset?: number;
|
|
3665
|
+
starting_after?: string;
|
|
3630
3666
|
}) => Promise<{
|
|
3631
3667
|
data: T[];
|
|
3632
|
-
} | T[]>, params?: P,
|
|
3668
|
+
} | T[]>, params?: P, options?: number | {
|
|
3669
|
+
pageSize?: number;
|
|
3670
|
+
cursor?: (item: T) => string | undefined;
|
|
3671
|
+
}): AsyncGenerator<T>;
|
|
3633
3672
|
}
|
|
3634
3673
|
|
|
3635
3674
|
/**
|