@funnelfox/billing 0.8.0-beta.4 → 0.8.0-ffb-395.5

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
@@ -284,7 +284,42 @@ export interface CreateClientSessionOptions {
284
284
  apiConfig?: APIConfig;
285
285
  clientMetadata?: MetadataType;
286
286
  countryCode?: string;
287
- }
287
+ integration?: 'primer' | 'stripe';
288
+ }
289
+
290
+ export type StripeClientSessionResponse = Omit<
291
+ CreateClientSessionResponse,
292
+ 'data'
293
+ > & {
294
+ data: CreateClientSessionResponse['data'] & {
295
+ stripe_public_key: string;
296
+ amount: number;
297
+ currency: string;
298
+ country: string;
299
+ is_link_enabled?: boolean;
300
+ apple_pay_recurring_payment_request?: {
301
+ paymentDescription: string;
302
+ managementURL: string;
303
+ billingAgreement?: string;
304
+ regularBilling: {
305
+ label: string;
306
+ amount: number;
307
+ recurringPaymentIntervalUnit: string;
308
+ recurringPaymentIntervalCount: number;
309
+ recurringPaymentStartDate?: string;
310
+ recurringPaymentEndDate?: string;
311
+ };
312
+ trialBilling?: {
313
+ label: string;
314
+ amount: number;
315
+ recurringPaymentIntervalUnit: string;
316
+ recurringPaymentIntervalCount: number;
317
+ recurringPaymentStartDate?: string;
318
+ recurringPaymentEndDate?: string;
319
+ };
320
+ } | null;
321
+ };
322
+ };
288
323
 
289
324
  export interface ClientSessionData {
290
325
  clientToken: string;
@@ -348,6 +383,51 @@ export declare function getAvailablePaymentMethods(params: {
348
383
  orgId: string;
349
384
  baseUrl: string;
350
385
  }): Promise<PaymentMethod[]>;
386
+
387
+ export interface StripeCardFormOptions
388
+ extends
389
+ CreateClientSessionOptions,
390
+ Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
391
+ onPaymentSuccess?: (
392
+ paymentMethod: import('@stripe/stripe-js').PaymentMethod,
393
+ orderId: string
394
+ ) => void;
395
+ appearance?: import('@stripe/stripe-js').Appearance;
396
+ showWallets?: boolean;
397
+ }
398
+
399
+ export interface StripeWalletOptions
400
+ extends
401
+ CreateClientSessionOptions,
402
+ Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
403
+ onPaymentSuccess?: (
404
+ paymentMethod: import('@stripe/stripe-js').PaymentMethod,
405
+ orderId: string
406
+ ) => void;
407
+ totalLabel?: string;
408
+ }
409
+
410
+ export interface StripeCardForm {
411
+ submit: () => Promise<void>;
412
+ }
413
+
414
+ export declare function createStripeCardForm(
415
+ element: HTMLElement,
416
+ params: StripeCardFormOptions
417
+ ): Promise<StripeCardForm>;
418
+
419
+ export declare function purchaseStripeWallet(
420
+ params: StripeWalletOptions
421
+ ): Promise<void>;
422
+
423
+ export declare function getAvailableStripeWallet(
424
+ params: CreateClientSessionOptions
425
+ ): Promise<PaymentMethod.APPLE_PAY | PaymentMethod.GOOGLE_PAY | null>;
426
+
427
+ export declare function getAvailableStripePaymentMethods(
428
+ params: CreateClientSessionOptions
429
+ ): Promise<PaymentMethod[]>;
430
+
351
431
  // Billing namespace
352
432
  export declare const Billing: {
353
433
  configure: typeof configure;
@@ -356,6 +436,12 @@ export declare const Billing: {
356
436
  initMethod: typeof initMethod;
357
437
  silentPurchase: typeof silentPurchase;
358
438
  getAvailablePaymentMethods: typeof getAvailablePaymentMethods;
439
+ stripe: {
440
+ createCardForm: typeof createStripeCardForm;
441
+ purchaseWallet: typeof purchaseStripeWallet;
442
+ getAvailableWallet: typeof getAvailableStripeWallet;
443
+ getAvailablePaymentMethods: typeof getAvailableStripePaymentMethods;
444
+ };
359
445
  };
360
446
 
361
447
  // Constants
@@ -410,6 +496,13 @@ export interface CreateClientSessionResponse {
410
496
  client_token: string;
411
497
  order_id: string;
412
498
  stripe_public_key?: string;
499
+ stripe_intent?: {
500
+ intent_client_secret: string;
501
+ customer_session_client_secret: string;
502
+ amount?: number;
503
+ currency?: string;
504
+ country?: string;
505
+ };
413
506
  collect_apple_pay_email?: boolean;
414
507
  show_email_field?: boolean;
415
508
  show_cardholder_name_field?: boolean; //true