@funnelfox/billing 0.9.0 → 0.9.2

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/src/types.d.ts CHANGED
@@ -93,16 +93,20 @@ export interface CheckoutConfig extends PrimerCheckoutConfig {
93
93
  enableTax?: boolean;
94
94
  onTaxChange?: (info: TaxInfo) => void;
95
95
  onTaxError?: (error: Error) => void;
96
+ onTaxPending?: () => void;
96
97
  }
97
98
 
98
99
  export interface TaxInfo {
99
100
  /** Minor units; the total the customer pays. */
100
101
  amountTotal: number;
101
- /** Minor units; tax ADDED on top of the price — 0 for tax-inclusive pricing and non-taxed locations. */
102
+ /** Minor units; the tax to show the buyer — added on top when exclusive, already inside the price when inclusive, 0 when unknown. */
102
103
  taxAmount: number;
103
104
  currency: string;
105
+ taxBehavior?: TaxBehavior;
104
106
  }
105
107
 
108
+ export type TaxBehavior = 'inclusive' | 'exclusive';
109
+
106
110
  export interface PaymentButtonSelectors {
107
111
  paypal: string;
108
112
  googlePay: string;
@@ -375,6 +379,9 @@ export interface InitMethodCallbacks {
375
379
  onLoaderChange?: (state: boolean) => void;
376
380
  onPaymentStarted?: (method: PaymentMethod) => void;
377
381
  onMethodsAvailable?: (methods: PaymentMethod[]) => void;
382
+ onTaxChange?: (info: TaxInfo) => void;
383
+ onTaxError?: (error: Error) => void;
384
+ onTaxPending?: () => void;
378
385
  }
379
386
 
380
387
  export declare function initMethod(
@@ -400,7 +407,7 @@ export declare function getAvailablePaymentMethods(params: {
400
407
  export interface StripeCardFormOptions
401
408
  extends
402
409
  CreateClientSessionOptions,
403
- Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
410
+ Omit<InitMethodCallbacks, 'onPaymentSuccess' | 'onTaxPending'> {
404
411
  onPaymentSuccess?: (
405
412
  paymentMethod: import('@stripe/stripe-js').PaymentMethod,
406
413
  orderId: string
@@ -417,12 +424,16 @@ export interface StripeCardFormOptions
417
424
  export interface StripeWalletOptions
418
425
  extends
419
426
  CreateClientSessionOptions,
420
- Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
427
+ Omit<
428
+ InitMethodCallbacks,
429
+ 'onPaymentSuccess' | 'onTaxPending' | 'onTaxError'
430
+ > {
421
431
  onPaymentSuccess?: (
422
432
  paymentMethod: import('@stripe/stripe-js').PaymentMethod,
423
433
  orderId: string
424
434
  ) => void;
425
435
  totalLabel?: string;
436
+ onTaxChange?: (info: TaxInfo) => void;
426
437
  }
427
438
 
428
439
  export interface StripeCardForm {
@@ -536,6 +547,8 @@ export interface CreateClientSessionResponse {
536
547
  // Session tax estimate (detected-country) in minor units — for showing tax on mount and in the
537
548
  // wallet sheet, and (Stripe-direct) collecting it via the wallet.
538
549
  tax_amount?: number;
550
+ tax_inclusive_amount?: number;
551
+ tax_behavior?: TaxBehavior;
539
552
  amount_total?: number;
540
553
  currency?: string;
541
554
  tax_calculation_id?: string;
@@ -563,6 +576,8 @@ export interface TaxRecalculationData {
563
576
  tax_calculation_id: string;
564
577
  amount_total: number;
565
578
  tax_amount: number;
579
+ tax_inclusive_amount?: number;
580
+ tax_behavior?: TaxBehavior;
566
581
  currency: string;
567
582
  }
568
583