@funnelfox/billing 0.8.0 → 0.9.0-beta.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/src/types.d.ts CHANGED
@@ -284,7 +284,24 @@ 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
+ stripe_intent: {
297
+ intent_client_secret: string;
298
+ customer_session_client_secret: string;
299
+ amount: number;
300
+ currency: string;
301
+ country: string;
302
+ };
303
+ };
304
+ };
288
305
 
289
306
  export interface ClientSessionData {
290
307
  clientToken: string;
@@ -348,6 +365,51 @@ export declare function getAvailablePaymentMethods(params: {
348
365
  orgId: string;
349
366
  baseUrl: string;
350
367
  }): Promise<PaymentMethod[]>;
368
+
369
+ export interface StripeCardFormOptions
370
+ extends
371
+ CreateClientSessionOptions,
372
+ Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
373
+ onPaymentSuccess?: (
374
+ paymentMethod: import('@stripe/stripe-js').PaymentMethod,
375
+ orderId: string
376
+ ) => void;
377
+ appearance?: import('@stripe/stripe-js').Appearance;
378
+ showWallets?: boolean;
379
+ }
380
+
381
+ export interface StripeWalletOptions
382
+ extends
383
+ CreateClientSessionOptions,
384
+ Omit<InitMethodCallbacks, 'onPaymentSuccess'> {
385
+ onPaymentSuccess?: (
386
+ paymentMethod: import('@stripe/stripe-js').PaymentMethod,
387
+ orderId: string
388
+ ) => void;
389
+ totalLabel?: string;
390
+ }
391
+
392
+ export interface StripeCardForm {
393
+ submit: () => Promise<void>;
394
+ }
395
+
396
+ export declare function createStripeCardForm(
397
+ element: HTMLElement,
398
+ params: StripeCardFormOptions
399
+ ): Promise<StripeCardForm>;
400
+
401
+ export declare function purchaseStripeWallet(
402
+ params: StripeWalletOptions
403
+ ): Promise<void>;
404
+
405
+ export declare function getAvailableStripeWallet(
406
+ params: CreateClientSessionOptions
407
+ ): Promise<PaymentMethod.APPLE_PAY | PaymentMethod.GOOGLE_PAY | null>;
408
+
409
+ export declare function getAvailableStripePaymentMethods(
410
+ params: CreateClientSessionOptions
411
+ ): Promise<PaymentMethod[]>;
412
+
351
413
  // Billing namespace
352
414
  export declare const Billing: {
353
415
  configure: typeof configure;
@@ -356,6 +418,12 @@ export declare const Billing: {
356
418
  initMethod: typeof initMethod;
357
419
  silentPurchase: typeof silentPurchase;
358
420
  getAvailablePaymentMethods: typeof getAvailablePaymentMethods;
421
+ stripe: {
422
+ createCardForm: typeof createStripeCardForm;
423
+ purchaseWallet: typeof purchaseStripeWallet;
424
+ getAvailableWallet: typeof getAvailableStripeWallet;
425
+ getAvailablePaymentMethods: typeof getAvailableStripePaymentMethods;
426
+ };
359
427
  };
360
428
 
361
429
  // Constants
@@ -410,6 +478,13 @@ export interface CreateClientSessionResponse {
410
478
  client_token: string;
411
479
  order_id: string;
412
480
  stripe_public_key?: string;
481
+ stripe_intent?: {
482
+ intent_client_secret: string;
483
+ customer_session_client_secret: string;
484
+ amount?: number;
485
+ currency?: string;
486
+ country?: string;
487
+ };
413
488
  collect_apple_pay_email?: boolean;
414
489
  show_email_field?: boolean;
415
490
  show_cardholder_name_field?: boolean; //true