@delopay/sdk 0.35.1 → 0.37.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.
@@ -1,5 +1,5 @@
1
- import { ProjectResponse, ShopResponse, PaymentResponse, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, BillingProfileResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.cjs';
2
- export { Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, Analytics, AnalyticsDashboard, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, Cards, ChangePasswordRequest, CheckoutBranding, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCreateRequest, ConnectorListResponse, ConnectorResponse, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DeleteAccountRequest, DelopayAuthenticationError, DelopayError, DelopayLogger, DelopayOptions, DisputeEvidenceRequest, DisputeListParams, DisputeResponse, DisputeStage, DisputeStatus, EncodedBranding, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeeOwner, FeeType, Files, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceStatus, LabelStyle, LayoutStyle, LedgerEntry, LedgerListParams, LedgerResponse, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MerchantAccountCreateRequest, MerchantAccountType, MerchantOverviewResponse, MerchantOverviewStat, MerchantRoutingAlgorithm, NonPillRadius, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentConfirmRequest, PaymentCreateRequest, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodListParams, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentUpdateRequest, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PollStatus, PollStatusResponse, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileLogoUploadResponse, ProfileUpdateRequest, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, RecoveryCodesResponse, RefundCreateRequest, RefundListParams, RefundListResponse, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCreateRequest, RegionResponse, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, ResetPasswordRequest, ResumeSubscriptionRequest, ResumeSubscriptionResponse, RoutableConnectorChoice, RoutingActivatePayload, RoutingConfigCreateRequest, RoutingConfigResponse, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, Search, SearchGroupResponse, SearchIndex, SearchStatus, ShopCreateRequest, ShopStats, ShopUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StaticRoutingAlgorithm, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionInvoice, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPeriodUnit, SubscriptionResponse, SubscriptionStatus, Subscriptions, SummaryPosition, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VerifyTotpRequest, WebhookDeliveryAttempt, WebhookEvent, Webhooks, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, logoDimensions, parseImportedBranding, radiusValue, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue } from './index.cjs';
1
+ import { ProjectResponse, ShopResponse, PaymentResponse, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, AnalyticsScopeRequest, AnalyticsScopeResponse, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, BillingProfileResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.cjs';
2
+ export { Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, Analytics, AnalyticsChild, AnalyticsConnectorDay, AnalyticsConnectorSeries, AnalyticsDashboard, AnalyticsDayBucket, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, Cards, ChangePasswordRequest, CheckoutBranding, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCreateRequest, ConnectorListResponse, ConnectorResponse, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DeleteAccountRequest, DelopayAuthenticationError, DelopayError, DelopayLogger, DelopayOptions, DisputeEvidenceRequest, DisputeListParams, DisputeResponse, DisputeStage, DisputeStatus, EncodedBranding, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EuclidComparison, EuclidComparisonType, EuclidIfStatement, EuclidValue, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeeOwner, FeeProgramBuilder, FeeRuleConditions, FeeRuleInput, FeeSpecInput, FeeType, Files, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceStatus, LabelStyle, LayoutStyle, LedgerEntry, LedgerListParams, LedgerResponse, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MerchantAccountCreateRequest, MerchantAccountType, MerchantOverviewResponse, MerchantOverviewStat, MerchantRoutingAlgorithm, NonPillRadius, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentConfirmRequest, PaymentCreateRequest, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodListParams, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentUpdateRequest, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PlatformFeeKind, PlatformFeeOutput, PlatformFeeProgram, PlatformFeeRule, PlatformFeeRuleOutput, PlatformFeeRuleRequest, PollStatus, PollStatusResponse, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileLogoUploadResponse, ProfileUpdateRequest, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, RecoveryCodesResponse, RefundCreateRequest, RefundListParams, RefundListResponse, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCreateRequest, RegionResponse, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, ResetPasswordRequest, ResumeSubscriptionRequest, ResumeSubscriptionResponse, RoutableConnectorChoice, RoutingActivatePayload, RoutingConfigCreateRequest, RoutingConfigResponse, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, Search, SearchGroupResponse, SearchIndex, SearchStatus, ShopCreateRequest, ShopStats, ShopUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StaticRoutingAlgorithm, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionInvoice, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPeriodUnit, SubscriptionResponse, SubscriptionStatus, Subscriptions, SummaryPosition, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VerifyTotpRequest, WebhookDeliveryAttempt, WebhookEvent, Webhooks, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, logoDimensions, parseImportedBranding, radiusValue, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue } from './index.cjs';
3
3
 
4
4
  /**
5
5
  * Internal-only type surface. Exposed via `'@delopay/sdk/internal'` only.
@@ -152,8 +152,6 @@ interface AdminCustomerDetail {
152
152
  customer_id: string;
153
153
  organization_id: string;
154
154
  employee_count: number;
155
- total_transactions: number;
156
- total_volume: number;
157
155
  created_at: string;
158
156
  customer_name?: string | null;
159
157
  projects: ProjectResponse[];
@@ -197,22 +195,128 @@ interface PlatformAnalyticsResponse {
197
195
  period_end: string;
198
196
  }
199
197
  interface PaymentAnalyticsRequest {
198
+ /** Rolling window in days. Ignored when start_date is provided. */
200
199
  period?: number | null;
200
+ /** Naive ISO 8601 datetime (e.g. 2026-06-01T00:00:00). Takes precedence over period. */
201
+ start_date?: string | null;
202
+ /** Naive ISO 8601 datetime. Defaults to now when only start_date is set. */
203
+ end_date?: string | null;
204
+ /** Limit stats to a single customer/merchant. Omitted = platform-wide. */
205
+ merchant_id?: string | null;
206
+ /** Limit stats to the shops of one project. Requires merchant_id. */
207
+ project_id?: string | null;
208
+ /** Limit stats to a single shop. Requires merchant_id; wins over project_id. */
209
+ shop_id?: string | null;
201
210
  currency?: string | null;
202
211
  }
203
- interface PaymentStat {
204
- label: string;
205
- value: number;
206
- change_percent: number;
212
+ /**
213
+ * The four independent payment measures for one reporting window. Derived
214
+ * figures (success rate, averages, period-over-period deltas) are computed
215
+ * by the consumer.
216
+ */
217
+ interface PaymentPeriodStats {
218
+ /** Sum of all payment intent amounts, in major units. */
219
+ total_volume: number;
220
+ /** Sum of succeeded payment intent amounts, in major units. */
221
+ successful_volume: number;
222
+ /** Count of all payment intents. */
223
+ transactions: number;
224
+ /** Count of succeeded payment intents. */
225
+ successful_transactions: number;
226
+ /** Count of successful refunds created in the window. */
227
+ refunds: number;
228
+ /** Sum of successful refund amounts created in the window, in major units. */
229
+ refund_volume: number;
207
230
  }
208
231
  interface PaymentAnalyticsResponse {
209
- total_volume: PaymentStat;
210
- success_rate: PaymentStat;
211
- transactions: PaymentStat;
212
- avg_transaction: PaymentStat;
232
+ /** Base measures for the requested window. */
233
+ current: PaymentPeriodStats;
234
+ /** Base measures for the equal-length window immediately before it. */
235
+ previous: PaymentPeriodStats;
213
236
  currency: string;
214
237
  period_days: number;
215
238
  }
239
+
240
+ /** Query for the platform ledger-analytics endpoint. */
241
+ interface AdminLedgerAnalyticsRequest {
242
+ /** Trailing days for a rolling window. Default 30, capped at 90. */
243
+ days?: number | null;
244
+ /** Naive ISO 8601 datetime for the window start (custom range; span ≤ 90 days). */
245
+ start_date?: string | null;
246
+ /** Naive ISO 8601 datetime for the inclusive last day. Defaults to now. */
247
+ end_date?: string | null;
248
+ /**
249
+ * Comma-separated selector for which response blocks the server computes, so
250
+ * a pinned card fetches only what it renders. Tokens: `summary` (total
251
+ * balance, net change, account-status counts, the `current` aggregate +
252
+ * `previous` window), `series` (the day-by-day flow) and `merchants` (the
253
+ * biggest-top-ups donut — the only block paying the per-merchant
254
+ * name-resolution cost). Omit for all blocks. Unrequested blocks come back
255
+ * empty / zero.
256
+ */
257
+ sections?: string | null;
258
+ }
259
+ /** One day of platform-wide ledger movement, in USD minor units. */
260
+ interface LedgerDayBucket {
261
+ /** Balance merchants added by paying in (topup_credit), positive. */
262
+ topup_amount: number;
263
+ topup_count: number;
264
+ /** Platform fees collected (fee_debit + merchant_fee_debit), positive. */
265
+ fee_amount: number;
266
+ fee_count: number;
267
+ /** Other credits (admin_credit + promo_credit), positive. */
268
+ credit_amount: number;
269
+ credit_count: number;
270
+ /** Other debits (admin_debit), positive. */
271
+ debit_amount: number;
272
+ debit_count: number;
273
+ /** Net of every entry that day (signed) — the day's platform balance change. */
274
+ net_amount: number;
275
+ }
276
+ /**
277
+ * Platform ledger-analytics response. All money is in USD minor units
278
+ * (`currency`). `series` is the current window day by day; `previous` is the
279
+ * equal-length prior window aggregated, for deltas.
280
+ */
281
+ interface AdminLedgerAnalyticsResponse {
282
+ currency: string;
283
+ days: number;
284
+ end_date: string;
285
+ /** Sum of every billing account's current balance (USD minor). */
286
+ total_balance: number;
287
+ /** Net balance change over the window (USD minor) = balance now − at start. */
288
+ net_change: number;
289
+ accounts_total: number;
290
+ accounts_active: number;
291
+ accounts_delinquent: number;
292
+ accounts_suspended: number;
293
+ /**
294
+ * The current window aggregated into a single bucket (the sum of `series`),
295
+ * so a totals-only card (e.g. fee revenue) reads `current.fee_amount` without
296
+ * iterating `series`. Part of the `summary` section.
297
+ */
298
+ current: LedgerDayBucket;
299
+ series: LedgerDayBucket[];
300
+ /**
301
+ * The previous period day by day, same length as `series`, for the over-time
302
+ * period-over-period overlay (e.g. "top-ups over time"). Empty unless the
303
+ * `series` section is requested.
304
+ */
305
+ previous_series: LedgerDayBucket[];
306
+ previous: LedgerDayBucket;
307
+ /** Merchants with the largest top-up totals this window (USD minor), capped. */
308
+ top_merchants: LedgerMerchant[];
309
+ /** Combined top-ups of merchants beyond the cap (USD minor). */
310
+ other_merchants_topup: number;
311
+ /** How many merchants fell into `other_merchants_topup`. */
312
+ other_merchants_count: number;
313
+ }
314
+ /** One merchant's top-up total over the window (USD minor). */
315
+ interface LedgerMerchant {
316
+ id: string;
317
+ name: string;
318
+ topup_amount: number;
319
+ }
216
320
  interface AuditLogListParams {
217
321
  user_id?: string | null;
218
322
  merchant_id?: string | null;
@@ -407,6 +511,19 @@ declare class AdminPortal {
407
511
  analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
408
512
  overviewStats(): Promise<OverviewStatsResponse>;
409
513
  paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
514
+ /**
515
+ * One drill level of the analytics dashboard: the scope's daily series +
516
+ * processor mix and its direct children's series. Range / metric / donut
517
+ * toggles apply client-side; only a drill (passing merchant_id / project_id
518
+ * / shop_id) fetches the next level.
519
+ */
520
+ analyticsScope(params?: AnalyticsScopeRequest): Promise<AnalyticsScopeResponse>;
521
+ /**
522
+ * Platform billing dashboard: total balance across all ledger accounts (+
523
+ * the net change), top-ups, fees collected, and the day-by-day ledger flow.
524
+ * All amounts are in USD minor units.
525
+ */
526
+ ledgerAnalytics(params?: AdminLedgerAnalyticsRequest): Promise<AdminLedgerAnalyticsResponse>;
410
527
  /**
411
528
  * Retrieve a merchant account via the admin portal. Unlike
412
529
  * `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
@@ -584,9 +701,15 @@ declare class PlatformBilling {
584
701
  /**
585
702
  * Platform-wide fee schedule management. Admin-only routes under
586
703
  * `/admin/fees/*`. Exposed only via `'@delopay/sdk/internal'`.
704
+ *
705
+ * `platformFees.rules` manages the platform-owned Euclid fee-rule program per
706
+ * merchant, which takes precedence over the flat platform schedules. Build the
707
+ * program with `feeProgram()`.
587
708
  */
588
709
  declare class PlatformFees {
589
710
  private readonly request;
711
+ /** Platform-owned Euclid fee-rule program (`/admin/fees/rules`). */
712
+ readonly rules: PlatformFeeRulesManager;
590
713
  constructor(request: RequestFn);
591
714
  /** Create a platform fee schedule for a specific merchant. */
592
715
  create(params: FeeScheduleCreateRequest, merchantId: string): Promise<FeeScheduleResponse>;
@@ -599,6 +722,21 @@ declare class PlatformFees {
599
722
  /** Delete a platform fee schedule. */
600
723
  delete(feeId: string): Promise<FeeScheduleResponse>;
601
724
  }
725
+ /**
726
+ * Manages a merchant's platform-owned Euclid fee-rule program (admin surface).
727
+ * Build the `algorithm` with `feeProgram()`. The SDK injects
728
+ * `fee_owner: 'platform'`.
729
+ */
730
+ declare class PlatformFeeRulesManager {
731
+ private readonly request;
732
+ constructor(request: RequestFn);
733
+ /** Create or replace the platform fee-rule program for a merchant. */
734
+ upsert(params: PlatformFeeRuleInput, merchantId: string): Promise<PlatformFeeRuleRecord>;
735
+ /** Retrieve the active platform fee-rule program for a merchant, or `null`. */
736
+ retrieve(merchantId: string): Promise<PlatformFeeRuleRecord | null>;
737
+ /** Deactivate the platform fee-rule program for a merchant. Idempotent. */
738
+ delete(merchantId: string): Promise<void>;
739
+ }
602
740
 
603
741
  /**
604
742
  * Internal-only Delopay client for DeloPay staff tooling (the admin
@@ -634,4 +772,4 @@ declare class DelopayInternal extends Delopay {
634
772
  constructor(...args: ConstructorParameters<typeof Delopay>);
635
773
  }
636
774
 
637
- export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, AdminPortal, type AdminSetTrustedRequest, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, Configs, type ConnectorRestrictionResponse, ConnectorRestrictions, type ConnectorVisibility, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentResponse, type PaymentStat, type PlatformAnalyticsResponse, PlatformBilling, PlatformFees, ProfileResponse, ProjectResponse, RequestFn, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, type UpsertConnectorRestrictionRequest };
775
+ export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminSetTrustedRequest, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, Configs, type ConnectorRestrictionResponse, ConnectorRestrictions, type ConnectorVisibility, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LedgerDayBucket, type LedgerMerchant, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentPeriodStats, PaymentResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, RequestFn, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, type UpsertConnectorRestrictionRequest };
@@ -1,5 +1,5 @@
1
- import { ProjectResponse, ShopResponse, PaymentResponse, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, BillingProfileResponse, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.js';
2
- export { Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, Analytics, AnalyticsDashboard, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, Cards, ChangePasswordRequest, CheckoutBranding, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCreateRequest, ConnectorListResponse, ConnectorResponse, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DeleteAccountRequest, DelopayAuthenticationError, DelopayError, DelopayLogger, DelopayOptions, DisputeEvidenceRequest, DisputeListParams, DisputeResponse, DisputeStage, DisputeStatus, EncodedBranding, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeeOwner, FeeType, Files, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceStatus, LabelStyle, LayoutStyle, LedgerEntry, LedgerListParams, LedgerResponse, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MerchantAccountCreateRequest, MerchantAccountType, MerchantOverviewResponse, MerchantOverviewStat, MerchantRoutingAlgorithm, NonPillRadius, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentConfirmRequest, PaymentCreateRequest, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodListParams, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentUpdateRequest, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PollStatus, PollStatusResponse, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileLogoUploadResponse, ProfileUpdateRequest, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, RecoveryCodesResponse, RefundCreateRequest, RefundListParams, RefundListResponse, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCreateRequest, RegionResponse, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, ResetPasswordRequest, ResumeSubscriptionRequest, ResumeSubscriptionResponse, RoutableConnectorChoice, RoutingActivatePayload, RoutingConfigCreateRequest, RoutingConfigResponse, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, Search, SearchGroupResponse, SearchIndex, SearchStatus, ShopCreateRequest, ShopStats, ShopUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StaticRoutingAlgorithm, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionInvoice, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPeriodUnit, SubscriptionResponse, SubscriptionStatus, Subscriptions, SummaryPosition, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VerifyTotpRequest, WebhookDeliveryAttempt, WebhookEvent, Webhooks, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, logoDimensions, parseImportedBranding, radiusValue, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue } from './index.js';
1
+ import { ProjectResponse, ShopResponse, PaymentResponse, RequestFn, AuthResponse, SignUpWithMerchantIdRequest, AnalyticsScopeRequest, AnalyticsScopeResponse, MerchantAccountResponse, MerchantAccountUpdateRequest, ProfileResponse, BillingProfileResponse, PlatformFeeRuleInput, PlatformFeeRuleRecord, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Delopay } from './index.js';
2
+ export { Address, AddressDetails, AllocationListResponse, AllocationResponse, AllocationTransferRequest, AllocationTransferResponse, Analytics, AnalyticsChild, AnalyticsConnectorDay, AnalyticsConnectorSeries, AnalyticsDashboard, AnalyticsDayBucket, ApiKeyCreateRequest, ApiKeyCreateResponse, ApiKeyExpiration, ApiKeyResponse, ApiKeyRevokeResponse, ApiKeyUpdateRequest, ApplePayVerificationRequest, ApplePayVerificationResponse, ApplePayVerifiedDomainsResponse, AuthenticationCreateRequest, AuthenticationResponse, AuthenticationStatus, AuthenticationType, AutoRechargeConfig, AutoRechargeUpdateRequest, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, BillingCompleteSetupRequest, BillingSetupRequest, BillingSetupResponse, BlocklistAddRequest, BlocklistDataKind, BlocklistResponse, BrandingExport, BrandingSource, BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CancelSubscriptionRequest, CancelSubscriptionResponse, CaptureMethod, CardDetail, CardDetailFromLocker, Cards, ChangePasswordRequest, CheckoutBranding, ConfirmSubscriptionPaymentDetails, ConfirmSubscriptionRequest, ConfirmSubscriptionResponse, Connector, ConnectorCreateRequest, ConnectorListResponse, ConnectorResponse, ConnectorType, ConnectorUpdateRequest, ConnectorVolumeSplit, ConnectorWebhookEntry, ConnectorWebhookEventType, ConnectorWebhookListResponse, ConnectorWebhookRegisterRequest, ConnectorWebhookRegisterResponse, CornerRadius, CreateAndConfirmSubscriptionRequest, CreateSubscriptionPaymentDetails, CreateSubscriptionRequest, Currency, CustomerCreateRequest, CustomerListParams, CustomerPaymentMethodsListParams, CustomerPaymentMethodsListResponse, CustomerResponse, CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, DeleteAccountRequest, DelopayAuthenticationError, DelopayError, DelopayLogger, DelopayOptions, DisputeEvidenceRequest, DisputeListParams, DisputeResponse, DisputeStage, DisputeStatus, EncodedBranding, EphemeralKeyCreateRequest, EphemeralKeyCreateResponse, EuclidComparison, EuclidComparisonType, EuclidIfStatement, EuclidValue, EventClass, EventDeliveryAttemptResponse, EventDetailResponse, EventListParams, EventListResponse, EventResponse, EventType, Export, FeatureMatrix, FeeOwner, FeeProgramBuilder, FeeRuleConditions, FeeRuleInput, FeeSpecInput, FeeType, Files, FontFamily, FontWeight, Forex, ForgotPasswordRequest, FromEmailRequest, FutureUsage, GatewayConnectRequest, GatewayResponse, GetSubscriptionItemsParams, GetSubscriptionItemsResponse, GlobalSearchRequest, IntentStatus, InviteUsersRequest, InviteUsersResponse, InvoiceStatus, LabelStyle, LayoutStyle, LedgerEntry, LedgerListParams, LedgerResponse, LinkedRoutingConfigRetrieveResponse, ListInvitableRolesParams, LoginHistoryEntry, LoginHistoryParams, LoginHistoryResponse, LogoShape, LogoSize, MandateListParams, MandateResponse, MandateRevokedResponse, MandateStatus, MandateType, MerchantAccountCreateRequest, MerchantAccountType, MerchantOverviewResponse, MerchantOverviewStat, MerchantRoutingAlgorithm, NonPillRadius, ParentGroup, ParentGroupInfo, PauseSubscriptionRequest, PauseSubscriptionResponse, PaymentCancelRequest, PaymentCaptureRequest, PaymentConfirmRequest, PaymentCreateRequest, PaymentLayout, PaymentLinkBackgroundImageConfig, PaymentLinkConfigRequest, PaymentLinkListParams, PaymentLinkListResponse, PaymentLinkResponse, PaymentLinkTransactionDetails, PaymentListParams, PaymentListResponse, PaymentMethod, PaymentMethodCreateRequest, PaymentMethodDeleteResponse, PaymentMethodListParams, PaymentMethodResponse, PaymentMethodType, PaymentMethodUpdateRequest, PaymentRetrieveOptions, PaymentUpdateRequest, PayoutCreateRequest, PayoutListParams, PayoutListResponse, PayoutResponse, PayoutStatus, PayoutType, PayoutUpdateRequest, PermissionScope, PhoneDetails, PhoneOtpRequest, PhoneOtpResponse, PhoneOtpVerifyRequest, PhoneOtpVerifyResponse, PlatformFeeKind, PlatformFeeOutput, PlatformFeeProgram, PlatformFeeRule, PlatformFeeRuleOutput, PlatformFeeRuleRequest, PollStatus, PollStatusResponse, ProfileAcquirerCreateRequest, ProfileAcquirerResponse, ProfileAcquirerUpdateRequest, ProfileCreateRequest, ProfileDefaultRoutingConfig, ProfileLogoUploadResponse, ProfileUpdateRequest, ProjectCreateRequest, ProjectStats, ProjectStatsResponse, ProjectUpdateRequest, RecoveryCodesResponse, RefundCreateRequest, RefundListParams, RefundListResponse, RefundResponse, RefundStatus, RefundType, RefundUpdateRequest, RegionCreateRequest, RegionResponse, RegionUpdateRequest, Regions, RelayRequest, RelayResponse, RelayStatus, RelayType, RequestExtras, RequestOptions, ResetPasswordRequest, ResumeSubscriptionRequest, ResumeSubscriptionResponse, RoutableConnectorChoice, RoutingActivatePayload, RoutingConfigCreateRequest, RoutingConfigResponse, RoutingDeactivateRequest, RoutingDictionary, RoutingDictionaryRecord, Search, SearchGroupResponse, SearchIndex, SearchStatus, ShopCreateRequest, ShopStats, ShopUpdateRequest, SignInRequest, SignUpRequest, SignUpWithMerchantRequest, SizeScale, SpacingScale, StaticRoutingAlgorithm, StripeConnectAccountRequest, StripeConnectAccountResponse, StripeConnectLinkRequest, StripeConnectLinkResponse, SubscriptionEstimateParams, SubscriptionEstimateResponse, SubscriptionInvoice, SubscriptionItem, SubscriptionItemPrice, SubscriptionItemType, SubscriptionLineItem, SubscriptionListParams, SubscriptionPaymentData, SubscriptionPaymentDetails, SubscriptionPeriodUnit, SubscriptionResponse, SubscriptionStatus, Subscriptions, SummaryPosition, SurfaceStyle, SwitchMerchantRequest, SwitchProfileRequest, Terminate2faQueryParams, ThreeDSDecision, ThreeDsRuleExecuteRequest, ThreeDsRuleResponse, TierSummary, TokenPurpose, TokenResponse, TopupRequest, TopupResponse, TotpResponse, TransactionType, TrustBadge, UpdateSubscriptionRequest, UpdateUserDetailsRequest, UserResponse, UserSessionEntry, UserSessionListResponse, UserSessionRevokeResponse, VerifyTotpRequest, WebhookDeliveryAttempt, WebhookEvent, Webhooks, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, logoDimensions, parseImportedBranding, radiusValue, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue } from './index.js';
3
3
 
4
4
  /**
5
5
  * Internal-only type surface. Exposed via `'@delopay/sdk/internal'` only.
@@ -152,8 +152,6 @@ interface AdminCustomerDetail {
152
152
  customer_id: string;
153
153
  organization_id: string;
154
154
  employee_count: number;
155
- total_transactions: number;
156
- total_volume: number;
157
155
  created_at: string;
158
156
  customer_name?: string | null;
159
157
  projects: ProjectResponse[];
@@ -197,22 +195,128 @@ interface PlatformAnalyticsResponse {
197
195
  period_end: string;
198
196
  }
199
197
  interface PaymentAnalyticsRequest {
198
+ /** Rolling window in days. Ignored when start_date is provided. */
200
199
  period?: number | null;
200
+ /** Naive ISO 8601 datetime (e.g. 2026-06-01T00:00:00). Takes precedence over period. */
201
+ start_date?: string | null;
202
+ /** Naive ISO 8601 datetime. Defaults to now when only start_date is set. */
203
+ end_date?: string | null;
204
+ /** Limit stats to a single customer/merchant. Omitted = platform-wide. */
205
+ merchant_id?: string | null;
206
+ /** Limit stats to the shops of one project. Requires merchant_id. */
207
+ project_id?: string | null;
208
+ /** Limit stats to a single shop. Requires merchant_id; wins over project_id. */
209
+ shop_id?: string | null;
201
210
  currency?: string | null;
202
211
  }
203
- interface PaymentStat {
204
- label: string;
205
- value: number;
206
- change_percent: number;
212
+ /**
213
+ * The four independent payment measures for one reporting window. Derived
214
+ * figures (success rate, averages, period-over-period deltas) are computed
215
+ * by the consumer.
216
+ */
217
+ interface PaymentPeriodStats {
218
+ /** Sum of all payment intent amounts, in major units. */
219
+ total_volume: number;
220
+ /** Sum of succeeded payment intent amounts, in major units. */
221
+ successful_volume: number;
222
+ /** Count of all payment intents. */
223
+ transactions: number;
224
+ /** Count of succeeded payment intents. */
225
+ successful_transactions: number;
226
+ /** Count of successful refunds created in the window. */
227
+ refunds: number;
228
+ /** Sum of successful refund amounts created in the window, in major units. */
229
+ refund_volume: number;
207
230
  }
208
231
  interface PaymentAnalyticsResponse {
209
- total_volume: PaymentStat;
210
- success_rate: PaymentStat;
211
- transactions: PaymentStat;
212
- avg_transaction: PaymentStat;
232
+ /** Base measures for the requested window. */
233
+ current: PaymentPeriodStats;
234
+ /** Base measures for the equal-length window immediately before it. */
235
+ previous: PaymentPeriodStats;
213
236
  currency: string;
214
237
  period_days: number;
215
238
  }
239
+
240
+ /** Query for the platform ledger-analytics endpoint. */
241
+ interface AdminLedgerAnalyticsRequest {
242
+ /** Trailing days for a rolling window. Default 30, capped at 90. */
243
+ days?: number | null;
244
+ /** Naive ISO 8601 datetime for the window start (custom range; span ≤ 90 days). */
245
+ start_date?: string | null;
246
+ /** Naive ISO 8601 datetime for the inclusive last day. Defaults to now. */
247
+ end_date?: string | null;
248
+ /**
249
+ * Comma-separated selector for which response blocks the server computes, so
250
+ * a pinned card fetches only what it renders. Tokens: `summary` (total
251
+ * balance, net change, account-status counts, the `current` aggregate +
252
+ * `previous` window), `series` (the day-by-day flow) and `merchants` (the
253
+ * biggest-top-ups donut — the only block paying the per-merchant
254
+ * name-resolution cost). Omit for all blocks. Unrequested blocks come back
255
+ * empty / zero.
256
+ */
257
+ sections?: string | null;
258
+ }
259
+ /** One day of platform-wide ledger movement, in USD minor units. */
260
+ interface LedgerDayBucket {
261
+ /** Balance merchants added by paying in (topup_credit), positive. */
262
+ topup_amount: number;
263
+ topup_count: number;
264
+ /** Platform fees collected (fee_debit + merchant_fee_debit), positive. */
265
+ fee_amount: number;
266
+ fee_count: number;
267
+ /** Other credits (admin_credit + promo_credit), positive. */
268
+ credit_amount: number;
269
+ credit_count: number;
270
+ /** Other debits (admin_debit), positive. */
271
+ debit_amount: number;
272
+ debit_count: number;
273
+ /** Net of every entry that day (signed) — the day's platform balance change. */
274
+ net_amount: number;
275
+ }
276
+ /**
277
+ * Platform ledger-analytics response. All money is in USD minor units
278
+ * (`currency`). `series` is the current window day by day; `previous` is the
279
+ * equal-length prior window aggregated, for deltas.
280
+ */
281
+ interface AdminLedgerAnalyticsResponse {
282
+ currency: string;
283
+ days: number;
284
+ end_date: string;
285
+ /** Sum of every billing account's current balance (USD minor). */
286
+ total_balance: number;
287
+ /** Net balance change over the window (USD minor) = balance now − at start. */
288
+ net_change: number;
289
+ accounts_total: number;
290
+ accounts_active: number;
291
+ accounts_delinquent: number;
292
+ accounts_suspended: number;
293
+ /**
294
+ * The current window aggregated into a single bucket (the sum of `series`),
295
+ * so a totals-only card (e.g. fee revenue) reads `current.fee_amount` without
296
+ * iterating `series`. Part of the `summary` section.
297
+ */
298
+ current: LedgerDayBucket;
299
+ series: LedgerDayBucket[];
300
+ /**
301
+ * The previous period day by day, same length as `series`, for the over-time
302
+ * period-over-period overlay (e.g. "top-ups over time"). Empty unless the
303
+ * `series` section is requested.
304
+ */
305
+ previous_series: LedgerDayBucket[];
306
+ previous: LedgerDayBucket;
307
+ /** Merchants with the largest top-up totals this window (USD minor), capped. */
308
+ top_merchants: LedgerMerchant[];
309
+ /** Combined top-ups of merchants beyond the cap (USD minor). */
310
+ other_merchants_topup: number;
311
+ /** How many merchants fell into `other_merchants_topup`. */
312
+ other_merchants_count: number;
313
+ }
314
+ /** One merchant's top-up total over the window (USD minor). */
315
+ interface LedgerMerchant {
316
+ id: string;
317
+ name: string;
318
+ topup_amount: number;
319
+ }
216
320
  interface AuditLogListParams {
217
321
  user_id?: string | null;
218
322
  merchant_id?: string | null;
@@ -407,6 +511,19 @@ declare class AdminPortal {
407
511
  analytics(params: AdminAnalyticsRequest): Promise<PlatformAnalyticsResponse>;
408
512
  overviewStats(): Promise<OverviewStatsResponse>;
409
513
  paymentAnalytics(params: PaymentAnalyticsRequest): Promise<PaymentAnalyticsResponse>;
514
+ /**
515
+ * One drill level of the analytics dashboard: the scope's daily series +
516
+ * processor mix and its direct children's series. Range / metric / donut
517
+ * toggles apply client-side; only a drill (passing merchant_id / project_id
518
+ * / shop_id) fetches the next level.
519
+ */
520
+ analyticsScope(params?: AnalyticsScopeRequest): Promise<AnalyticsScopeResponse>;
521
+ /**
522
+ * Platform billing dashboard: total balance across all ledger accounts (+
523
+ * the net change), top-ups, fees collected, and the day-by-day ledger flow.
524
+ * All amounts are in USD minor units.
525
+ */
526
+ ledgerAnalytics(params?: AdminLedgerAnalyticsRequest): Promise<AdminLedgerAnalyticsResponse>;
410
527
  /**
411
528
  * Retrieve a merchant account via the admin portal. Unlike
412
529
  * `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
@@ -584,9 +701,15 @@ declare class PlatformBilling {
584
701
  /**
585
702
  * Platform-wide fee schedule management. Admin-only routes under
586
703
  * `/admin/fees/*`. Exposed only via `'@delopay/sdk/internal'`.
704
+ *
705
+ * `platformFees.rules` manages the platform-owned Euclid fee-rule program per
706
+ * merchant, which takes precedence over the flat platform schedules. Build the
707
+ * program with `feeProgram()`.
587
708
  */
588
709
  declare class PlatformFees {
589
710
  private readonly request;
711
+ /** Platform-owned Euclid fee-rule program (`/admin/fees/rules`). */
712
+ readonly rules: PlatformFeeRulesManager;
590
713
  constructor(request: RequestFn);
591
714
  /** Create a platform fee schedule for a specific merchant. */
592
715
  create(params: FeeScheduleCreateRequest, merchantId: string): Promise<FeeScheduleResponse>;
@@ -599,6 +722,21 @@ declare class PlatformFees {
599
722
  /** Delete a platform fee schedule. */
600
723
  delete(feeId: string): Promise<FeeScheduleResponse>;
601
724
  }
725
+ /**
726
+ * Manages a merchant's platform-owned Euclid fee-rule program (admin surface).
727
+ * Build the `algorithm` with `feeProgram()`. The SDK injects
728
+ * `fee_owner: 'platform'`.
729
+ */
730
+ declare class PlatformFeeRulesManager {
731
+ private readonly request;
732
+ constructor(request: RequestFn);
733
+ /** Create or replace the platform fee-rule program for a merchant. */
734
+ upsert(params: PlatformFeeRuleInput, merchantId: string): Promise<PlatformFeeRuleRecord>;
735
+ /** Retrieve the active platform fee-rule program for a merchant, or `null`. */
736
+ retrieve(merchantId: string): Promise<PlatformFeeRuleRecord | null>;
737
+ /** Deactivate the platform fee-rule program for a merchant. Idempotent. */
738
+ delete(merchantId: string): Promise<void>;
739
+ }
602
740
 
603
741
  /**
604
742
  * Internal-only Delopay client for DeloPay staff tooling (the admin
@@ -634,4 +772,4 @@ declare class DelopayInternal extends Delopay {
634
772
  constructor(...args: ConstructorParameters<typeof Delopay>);
635
773
  }
636
774
 
637
- export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, AdminPortal, type AdminSetTrustedRequest, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, Configs, type ConnectorRestrictionResponse, ConnectorRestrictions, type ConnectorVisibility, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, PaymentResponse, type PaymentStat, type PlatformAnalyticsResponse, PlatformBilling, PlatformFees, ProfileResponse, ProjectResponse, RequestFn, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, type UpsertConnectorRestrictionRequest };
775
+ export { Admin, type AdminAdjustmentRequest, type AdminAdjustmentResponse, type AdminAnalyticsRequest, type AdminCreateUserForMerchantRequest, type AdminCustomerDetail, type AdminCustomerListParams, type AdminCustomerListResponse, type AdminLedgerAnalyticsRequest, type AdminLedgerAnalyticsResponse, AdminPortal, type AdminSetTrustedRequest, type AdminSignInRequest, type AdminSuspendRequest, type AdminTransactionListParams, type AdminTransactionListResponse, type AdminUnsuspendRequest, type AdminUpdateUserRequest, type AdminUserResponse, AnalyticsScopeRequest, AnalyticsScopeResponse, type AuditLogListParams, type AuditLogListResponse, type AuditLogResponse, AuditLogs, AuthResponse, type AuthorizeResponse, BillingProfileResponse, Cache, type CardIssuerCreateRequest, type CardIssuerListResponse, type CardIssuerResponse, type CardIssuerUpdateRequest, CardIssuers, Configs, type ConnectorRestrictionResponse, ConnectorRestrictions, type ConnectorVisibility, type CreateInternalUserRequest, type CreateTenantUserRequest, type CustomerSummary, type CustomerUser, Delopay, DelopayInternal, FeeScheduleCreateRequest, FeeScheduleResponse, FeeScheduleUpdateRequest, Gsm, type GsmDecision, type GsmRuleCreateRequest, type GsmRuleResponse, type GsmRuleUpdateRequest, type LedgerDayBucket, type LedgerMerchant, MerchantAccountResponse, MerchantAccountUpdateRequest, type OnboardMerchantRequest, type OnboardMerchantResponse, type OverviewStat, type OverviewStatsResponse, type PaymentAnalyticsRequest, type PaymentAnalyticsResponse, type PaymentPeriodStats, PaymentResponse, type PlatformAnalyticsResponse, PlatformBilling, PlatformFeeRuleInput, PlatformFeeRuleRecord, PlatformFees, ProfileResponse, ProjectResponse, RequestFn, ShopResponse, SignUpWithMerchantIdRequest, type SignupToggleRequest, type SignupToggleResponse, type UpsertConnectorRestrictionRequest };
package/dist/internal.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  DelopayError,
15
15
  Export,
16
16
  FeatureMatrix,
17
+ FeeProgramBuilder,
17
18
  Files,
18
19
  Forex,
19
20
  Regions,
@@ -29,6 +30,7 @@ import {
29
30
  defaultBranding,
30
31
  encodeBadges,
31
32
  encodeBranding,
33
+ feeProgram,
32
34
  fontStack,
33
35
  fontWeightValue,
34
36
  inputPadValue,
@@ -41,7 +43,7 @@ import {
41
43
  shadowFor,
42
44
  surfacePadValue,
43
45
  verticalGapValue
44
- } from "./chunk-45OPT3EW.js";
46
+ } from "./chunk-IQKFNKHU.js";
45
47
 
46
48
  // src/internal/resources/admin.ts
47
49
  var Admin = class {
@@ -114,6 +116,27 @@ var AdminPortal = class {
114
116
  query: params
115
117
  });
116
118
  }
119
+ /**
120
+ * One drill level of the analytics dashboard: the scope's daily series +
121
+ * processor mix and its direct children's series. Range / metric / donut
122
+ * toggles apply client-side; only a drill (passing merchant_id / project_id
123
+ * / shop_id) fetches the next level.
124
+ */
125
+ async analyticsScope(params) {
126
+ return this.request("GET", "/admin-portal/analytics/scope", {
127
+ query: params
128
+ });
129
+ }
130
+ /**
131
+ * Platform billing dashboard: total balance across all ledger accounts (+
132
+ * the net change), top-ups, fees collected, and the day-by-day ledger flow.
133
+ * All amounts are in USD minor units.
134
+ */
135
+ async ledgerAnalytics(params) {
136
+ return this.request("GET", "/admin-portal/ledger-analytics", {
137
+ query: params
138
+ });
139
+ }
117
140
  /**
118
141
  * Retrieve a merchant account via the admin portal. Unlike
119
142
  * `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
@@ -375,6 +398,7 @@ var PlatformBilling = class {
375
398
  var PlatformFees = class {
376
399
  constructor(request) {
377
400
  this.request = request;
401
+ this.rules = new PlatformFeeRulesManager(request);
378
402
  }
379
403
  /** Create a platform fee schedule for a specific merchant. */
380
404
  async create(params, merchantId) {
@@ -402,6 +426,31 @@ var PlatformFees = class {
402
426
  return this.request("DELETE", `/admin/fees/${encodeURIComponent(feeId)}`);
403
427
  }
404
428
  };
429
+ var PlatformFeeRulesManager = class {
430
+ constructor(request) {
431
+ this.request = request;
432
+ }
433
+ /** Create or replace the platform fee-rule program for a merchant. */
434
+ async upsert(params, merchantId) {
435
+ const body = { ...params, fee_owner: "platform" };
436
+ return this.request("PUT", "/admin/fees/rules", {
437
+ body,
438
+ query: { merchant_id: merchantId }
439
+ });
440
+ }
441
+ /** Retrieve the active platform fee-rule program for a merchant, or `null`. */
442
+ async retrieve(merchantId) {
443
+ return this.request("GET", "/admin/fees/rules", {
444
+ query: { merchant_id: merchantId }
445
+ });
446
+ }
447
+ /** Deactivate the platform fee-rule program for a merchant. Idempotent. */
448
+ async delete(merchantId) {
449
+ await this.request("DELETE", "/admin/fees/rules", {
450
+ query: { merchant_id: merchantId }
451
+ });
452
+ }
453
+ };
405
454
 
406
455
  // src/internal/client.ts
407
456
  var DelopayInternal = class extends Delopay {
@@ -444,6 +493,7 @@ export {
444
493
  DelopayInternal,
445
494
  Export,
446
495
  FeatureMatrix,
496
+ FeeProgramBuilder,
447
497
  Files,
448
498
  Forex,
449
499
  Gsm,
@@ -462,6 +512,7 @@ export {
462
512
  defaultBranding,
463
513
  encodeBadges,
464
514
  encodeBranding,
515
+ feeProgram,
465
516
  fontStack,
466
517
  fontWeightValue,
467
518
  inputPadValue,