airwallex-payment-elements 1.62.0 → 1.89.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/.gitlab-ci.yml +12 -2
- package/README.md +1 -1
- package/lib/bin/airwallex.cjs.js +2 -2
- package/lib/bin/airwallex.cjs.js.map +1 -1
- package/lib/bin/airwallex.es.js +2 -2
- package/lib/bin/airwallex.es.js.map +1 -1
- package/lib/bin/airwallex.iife.js +2 -2
- package/lib/bin/airwallex.iife.js.map +1 -1
- package/package.json +6 -5
- package/typedoc.config.js +22 -11
- package/types/airwallex.d.ts +250 -100
- package/types/cardNumber.d.ts +10 -5
- package/types/dropInElement.d.ts +45 -35
- package/types/element.d.ts +343 -242
- package/types/index.d.ts +2 -0
- package/types/qrcodeElement.d.ts +13 -5
- package/types/redirectElement.d.ts +12 -4
package/types/element.d.ts
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { Intent, PaymentMethodBasicInfo } from './cardNumber';
|
|
2
|
-
import { Properties } from 'csstype';
|
|
3
2
|
import { PaymentMethodWithQrcode, QrcodeElementOptions } from './qrcodeElement';
|
|
4
|
-
import { AuthorizationType, Consent, RecurringOptions } from './airwallex';
|
|
5
3
|
import { DropInElementOptions } from './dropInElement';
|
|
6
4
|
import { RedirectElementOptions } from './redirectElement';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import {
|
|
6
|
+
Mode,
|
|
7
|
+
InitOptions,
|
|
8
|
+
PaymentMethodRequestData,
|
|
9
|
+
PaymentConsentResponse,
|
|
10
|
+
AuthorizationType,
|
|
11
|
+
Consent,
|
|
12
|
+
RecurringOptions,
|
|
13
|
+
VerifyConsentRequest,
|
|
14
|
+
PaymentConsentRequestData,
|
|
15
|
+
} from './airwallex';
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
|
-
* All the flows supported by Local Payment Methods
|
|
18
|
+
* All the flows supported by Local Payment Methods.
|
|
14
19
|
*/
|
|
15
20
|
export type LPMFlows = 'webqr' | 'mweb' | 'jsapi' | 'inapp';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
|
-
* `address` will include `country_code`, `postcode`, `state`, `city` and `street`
|
|
19
|
-
* so provide either `country_code` or `address`
|
|
23
|
+
* `address` will include `country_code`, `postcode`, `state`, `city` and `street`, so provide either `country_code` or `address`.
|
|
20
24
|
*/
|
|
21
25
|
export type ContactField = 'name' | 'email' | 'country_code' | 'address' | 'phone';
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
|
-
* Supported integration element types
|
|
25
|
-
* Airwallex recommends`dropIn` element as it lets you accept multiple payment methods with a single integration.
|
|
26
|
-
|
|
28
|
+
* Supported integration element types.
|
|
29
|
+
* Airwallex recommends `dropIn` element as it lets you accept multiple payment methods with a single integration.
|
|
30
|
+
* `applePayButton`, `googlePayButton`, `wechat`, `qrcode`, `redirect` and `fullFeaturedCard` elements are not recommended.
|
|
27
31
|
*/
|
|
28
32
|
export type ElementType =
|
|
29
33
|
| 'applePayButton'
|
|
@@ -262,6 +266,7 @@ export interface EventDetail {
|
|
|
262
266
|
*/
|
|
263
267
|
type: ElementType | 'threeDsFrictionless' | 'threeDsChallenge';
|
|
264
268
|
/**
|
|
269
|
+
|
|
265
270
|
* Whether the element input is in a valid format or not.
|
|
266
271
|
*/
|
|
267
272
|
complete?: boolean;
|
|
@@ -366,72 +371,56 @@ export type SelectorAllowed =
|
|
|
366
371
|
| '.ApplePayButton:hover'
|
|
367
372
|
| '.Input:hover'
|
|
368
373
|
| '.Input:active';
|
|
369
|
-
export interface Appearance {
|
|
370
|
-
rules?: Record<SelectorAllowed, Properties>;
|
|
371
|
-
}
|
|
372
374
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
export interface
|
|
377
|
-
|
|
378
|
-
* * Element container css style camelcase option, default style by Chrome browser.
|
|
379
|
-
*/
|
|
380
|
-
style?: PopUpStyle & Properties;
|
|
381
|
-
/**
|
|
382
|
-
* The checkout website origin url, i.e.,'window.location.origin' field of the merchant's checkout page.
|
|
383
|
-
*/
|
|
384
|
-
origin?: string;
|
|
385
|
-
/**
|
|
386
|
-
* Customize the payment Element to match the design of your site.
|
|
387
|
-
* The layout of each Element stays consistent, but you can modify colors, fonts, borders, padding, and more.
|
|
388
|
-
*/
|
|
389
|
-
appearance?: Appearance;
|
|
375
|
+
export interface CSSProperties {
|
|
376
|
+
[CSSPropertyName: string]: string | number | undefined;
|
|
377
|
+
}
|
|
378
|
+
export interface Appearance {
|
|
379
|
+
rules?: Partial<Record<SelectorAllowed, CSSProperties>>;
|
|
390
380
|
}
|
|
391
381
|
|
|
392
382
|
/**
|
|
393
383
|
* Supported customized pseudo css style for `cardNumber` | `expiry` | `cvc` Elements
|
|
394
384
|
* https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
|
|
395
385
|
*/
|
|
396
|
-
type PseudoClasses = ':hover' | ':focus' | '::placeholder' | '::selection' | ':disabled';
|
|
386
|
+
type PseudoClasses = ':hover' | ':focus' | ':autofill' | '::placeholder' | '::selection' | ':disabled';
|
|
397
387
|
|
|
398
388
|
/**
|
|
399
389
|
* Pseudo-classes object
|
|
400
390
|
*/
|
|
401
|
-
type PseudoClassStyle = { [K in PseudoClasses]?:
|
|
391
|
+
type PseudoClassStyle = { [K in PseudoClasses]?: CSSProperties };
|
|
402
392
|
|
|
403
393
|
/**
|
|
404
|
-
* Customize the input element using CSS
|
|
394
|
+
* Customize the input element using CSS Properties.
|
|
405
395
|
*
|
|
406
396
|
*/
|
|
407
397
|
export interface InputStyle extends PopUpStyle {
|
|
408
398
|
/**
|
|
409
399
|
* Base styling applied to the input iframe. All styling extends from this style.
|
|
410
400
|
*/
|
|
411
|
-
base?: PseudoClassStyle &
|
|
401
|
+
base?: PseudoClassStyle & CSSProperties;
|
|
412
402
|
/**
|
|
413
403
|
* Styling applied to the input element when a field passes validation.
|
|
414
404
|
*/
|
|
415
|
-
valid?:
|
|
405
|
+
valid?: CSSProperties;
|
|
416
406
|
/**
|
|
417
407
|
* Styling applied to the input element when a field fails validation.
|
|
418
408
|
*/
|
|
419
|
-
invalid?:
|
|
409
|
+
invalid?: CSSProperties;
|
|
420
410
|
}
|
|
421
411
|
|
|
422
412
|
/**
|
|
423
|
-
* Customize `dropIn`, `fullFeaturedCard`, and hosted payment page integration layout by using CSS
|
|
424
|
-
*
|
|
413
|
+
* Customize `dropIn`, `fullFeaturedCard`, and hosted payment page integration layout by using CSS CSSProperties.
|
|
425
414
|
*/
|
|
426
415
|
export interface BoxStyle extends PopUpStyle {
|
|
427
416
|
/**
|
|
428
417
|
* Base styling applied to the integral iframe. All styling extends from this style.
|
|
429
418
|
*/
|
|
430
|
-
base?:
|
|
419
|
+
base?: CSSProperties;
|
|
431
420
|
/**
|
|
432
421
|
* Styling applied to the input element
|
|
433
422
|
*/
|
|
434
|
-
input?:
|
|
423
|
+
input?: CSSProperties & PseudoClassStyle;
|
|
435
424
|
/**
|
|
436
425
|
* Input variation
|
|
437
426
|
*/
|
|
@@ -441,18 +430,23 @@ export interface BoxStyle extends PopUpStyle {
|
|
|
441
430
|
/**
|
|
442
431
|
* Applies to `card` element type integration, the interface used when `createElement()` is called with type `card`.
|
|
443
432
|
*/
|
|
444
|
-
export interface CardElementOptions
|
|
433
|
+
export interface CardElementOptions {
|
|
445
434
|
/**
|
|
446
|
-
* Whether the Element input is disabled or not.
|
|
435
|
+
* Whether the Element input is disabled or not.
|
|
436
|
+
* @defaultValue `false`
|
|
447
437
|
*/
|
|
448
438
|
disabled?: boolean;
|
|
449
439
|
/**
|
|
450
|
-
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
440
|
+
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
441
|
+
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
442
|
+
* @defaultValue `true`
|
|
451
443
|
*/
|
|
452
444
|
autoCapture?: boolean;
|
|
453
445
|
/**
|
|
454
|
-
* The authorization type for the card payment.
|
|
455
|
-
* Set it to `pre_auth` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
446
|
+
* The authorization type for the card payment.
|
|
447
|
+
* Set it to `'pre_auth'` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
448
|
+
* `autoCapture` will be automatically set to `false` if you enable `'pre_auth'`.
|
|
449
|
+
* @defaultValue `'final_auth'`
|
|
456
450
|
*/
|
|
457
451
|
authorizationType?: AuthorizationType;
|
|
458
452
|
/**
|
|
@@ -472,25 +466,29 @@ export interface CardElementOptions extends ElementOptions {
|
|
|
472
466
|
/**
|
|
473
467
|
* Applies to split card element type integration, the interface used when `createElement()` called with type `cardNumber`
|
|
474
468
|
*/
|
|
475
|
-
export interface CardNumberElementOptions
|
|
469
|
+
export interface CardNumberElementOptions {
|
|
476
470
|
/**
|
|
477
|
-
* Whether the `cardNumber` Element input is disabled or not.
|
|
471
|
+
* Whether the `cardNumber` Element input is disabled or not.
|
|
472
|
+
* @defaultValue `false`
|
|
478
473
|
*/
|
|
479
474
|
disabled?: boolean;
|
|
480
475
|
/**
|
|
481
476
|
* The Payment Intent you would like to checkout.
|
|
482
|
-
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/
|
|
477
|
+
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
|
|
483
478
|
*
|
|
484
479
|
*/
|
|
485
480
|
intent?: Intent;
|
|
486
481
|
/**
|
|
487
|
-
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
482
|
+
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
483
|
+
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
484
|
+
* @defaultValue `true`
|
|
488
485
|
*/
|
|
489
486
|
autoCapture?: boolean;
|
|
490
487
|
/**
|
|
491
|
-
* The authorization type for the card payment.
|
|
492
|
-
* Set it to `pre_auth` if you want to place a hold on your customer's card for more than 7 days, i.e., extend the authorization time window.
|
|
493
|
-
* Currently it's only available when the card brand is Visa or Mastercard.
|
|
488
|
+
* The authorization type for the card payment.
|
|
489
|
+
* Set it to `'pre_auth'` if you want to place a hold on your customer's card for more than 7 days, i.e., extend the authorization time window.
|
|
490
|
+
* Currently it's only available when the card brand is Visa or Mastercard. `autoCapture` will be automatically set to `false` if you enable `'pre_auth'`.
|
|
491
|
+
* @defaultValue `'final_auth'`
|
|
494
492
|
*/
|
|
495
493
|
authorizationType?: AuthorizationType;
|
|
496
494
|
/**
|
|
@@ -514,9 +512,10 @@ export interface CardNumberElementOptions extends ElementOptions {
|
|
|
514
512
|
/**
|
|
515
513
|
* Applies to split card element type integration, the interface used when `createElement()` with type `expiry`.
|
|
516
514
|
*/
|
|
517
|
-
export interface ExpiryDateElementOptions
|
|
515
|
+
export interface ExpiryDateElementOptions {
|
|
518
516
|
/**
|
|
519
|
-
* Whether the `expiry` Element input is disabled or not.
|
|
517
|
+
* Whether the `expiry` Element input is disabled or not.
|
|
518
|
+
* @defaultValue `false`
|
|
520
519
|
*/
|
|
521
520
|
disabled?: boolean;
|
|
522
521
|
/**
|
|
@@ -532,9 +531,10 @@ export interface ExpiryDateElementOptions extends ElementOptions {
|
|
|
532
531
|
/**
|
|
533
532
|
* Applies to split card element type integration, the interface used when `createElement()` called with type `cvc`.
|
|
534
533
|
*/
|
|
535
|
-
export interface CvcElementOptions
|
|
534
|
+
export interface CvcElementOptions {
|
|
536
535
|
/**
|
|
537
|
-
*
|
|
536
|
+
* Whether the `cvc` Element input is disabled or not.
|
|
537
|
+
* @defaultValue `false`
|
|
538
538
|
*/
|
|
539
539
|
disabled?: boolean;
|
|
540
540
|
/**
|
|
@@ -554,7 +554,7 @@ export interface CvcElementOptions extends ElementOptions {
|
|
|
554
554
|
*/
|
|
555
555
|
authFormContainer?: string;
|
|
556
556
|
/**
|
|
557
|
-
* Whether cvc
|
|
557
|
+
* Whether cvc Element works alone or not.
|
|
558
558
|
* If you want to use the CVC Element for a saved Payment Consent, you could set it `true` to improve the checkout experience.
|
|
559
559
|
*/
|
|
560
560
|
isStandalone?: boolean;
|
|
@@ -563,7 +563,11 @@ export interface CvcElementOptions extends ElementOptions {
|
|
|
563
563
|
/**
|
|
564
564
|
* Applies to full featured card element type integration, the interface used when `createElement()` called with type `fullFeaturedCard`.
|
|
565
565
|
*/
|
|
566
|
-
export interface FullFeaturedCardElementOptions
|
|
566
|
+
export interface FullFeaturedCardElementOptions {
|
|
567
|
+
/**
|
|
568
|
+
* The layout of each element stays consistent, but you can modify confirm button, inputs, and more.
|
|
569
|
+
*/
|
|
570
|
+
appearance?: Appearance;
|
|
567
571
|
/**
|
|
568
572
|
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
569
573
|
*/
|
|
@@ -573,22 +577,26 @@ export interface FullFeaturedCardElementOptions extends ElementOptions {
|
|
|
573
577
|
*/
|
|
574
578
|
mode?: 'payment' | 'recurring';
|
|
575
579
|
/**
|
|
576
|
-
* The ID of the Payment Intent you would like to checkout. Required when `mode` is `payment`.
|
|
580
|
+
* The ID of the Payment Intent you would like to checkout. Required when `mode` is `'payment'`.
|
|
577
581
|
*/
|
|
578
582
|
intent_id?: string;
|
|
579
583
|
/**
|
|
580
584
|
* The Payment Intent you would like to checkout.
|
|
581
|
-
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/
|
|
582
|
-
* @deprecated Please use client_secret and intent_id directly
|
|
585
|
+
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
|
|
586
|
+
* @deprecated Please use {@link client_secret} and {@link intent_id} directly
|
|
583
587
|
*/
|
|
584
588
|
intent?: Intent;
|
|
585
589
|
/**
|
|
586
|
-
*
|
|
590
|
+
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
591
|
+
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
592
|
+
* @defaultValue `true`
|
|
587
593
|
*/
|
|
588
594
|
autoCapture?: boolean;
|
|
589
595
|
/**
|
|
590
|
-
* The authorization type for the card payment.
|
|
591
|
-
* Set it to `pre_auth` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
596
|
+
* The authorization type for the card payment.
|
|
597
|
+
* Set it to `'pre_auth'` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
598
|
+
* `autoCapture` will be automatically set to `false` if you enable `'pre_auth'`.
|
|
599
|
+
* @defaultValue `'final_auth'`
|
|
592
600
|
*/
|
|
593
601
|
authorizationType?: AuthorizationType;
|
|
594
602
|
/**
|
|
@@ -597,6 +605,7 @@ export interface FullFeaturedCardElementOptions extends ElementOptions {
|
|
|
597
605
|
cvcRequired?: boolean;
|
|
598
606
|
/**
|
|
599
607
|
* Used to increase the likelihood of 3DS frictionless checkout. Set this to `true` if you want the payment form to collect billing information from the shopper. Only applies to card payment method.
|
|
608
|
+
* @deprecated please use {@link requiredBillingContactFields} instead
|
|
600
609
|
*/
|
|
601
610
|
withBilling?: boolean;
|
|
602
611
|
/**
|
|
@@ -604,7 +613,7 @@ export interface FullFeaturedCardElementOptions extends ElementOptions {
|
|
|
604
613
|
*/
|
|
605
614
|
requiredBillingContactFields?: ContactField[];
|
|
606
615
|
/**
|
|
607
|
-
*
|
|
616
|
+
* Box style for the fullFeaturedCard Element.
|
|
608
617
|
*/
|
|
609
618
|
style?: BoxStyle;
|
|
610
619
|
/**
|
|
@@ -613,11 +622,11 @@ export interface FullFeaturedCardElementOptions extends ElementOptions {
|
|
|
613
622
|
authFormContainer?: string;
|
|
614
623
|
/**
|
|
615
624
|
* The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
616
|
-
* This field is required when `mode` is `recurring`.
|
|
625
|
+
* This field is required when `mode` is `'recurring'`.
|
|
617
626
|
*/
|
|
618
627
|
customer_id?: string;
|
|
619
628
|
/**
|
|
620
|
-
* The options for the recurring flow. Required when `mode` is `recurring`.
|
|
629
|
+
* The options for the recurring flow. Required when `mode` is `'recurring'`.
|
|
621
630
|
*/
|
|
622
631
|
recurringOptions?: RecurringOptions;
|
|
623
632
|
}
|
|
@@ -628,22 +637,19 @@ export interface FullFeaturedCardElementOptions extends ElementOptions {
|
|
|
628
637
|
export interface PaymentShippingOption {
|
|
629
638
|
id: string;
|
|
630
639
|
label: string;
|
|
631
|
-
amount:
|
|
632
|
-
currency: string;
|
|
633
|
-
value: string;
|
|
634
|
-
};
|
|
640
|
+
amount: Amount;
|
|
635
641
|
selected: boolean;
|
|
636
642
|
}
|
|
637
643
|
|
|
638
644
|
export type ApplePayHppOrDropInRequestOptions = ApplePayRequestOptions;
|
|
639
645
|
|
|
640
|
-
export
|
|
646
|
+
export interface ApplePayRecurringLineItem {
|
|
641
647
|
paymentTiming: 'recurring' | 'deferred';
|
|
642
648
|
recurringPaymentStartDate: Date;
|
|
643
649
|
recurringPaymentIntervalUnit: 'year' | 'month' | 'day' | 'hour' | 'minute';
|
|
644
650
|
recurringPaymentIntervalCount: number;
|
|
645
651
|
recurringPaymentEndDate: Date;
|
|
646
|
-
}
|
|
652
|
+
}
|
|
647
653
|
|
|
648
654
|
export interface ApplePayRequestOriginalOptions {
|
|
649
655
|
/**
|
|
@@ -654,7 +660,7 @@ export interface ApplePayRequestOriginalOptions {
|
|
|
654
660
|
/**
|
|
655
661
|
* A set of line items that explain recurring payments and/or additional charges.
|
|
656
662
|
*/
|
|
657
|
-
lineItems?:
|
|
663
|
+
lineItems?: ApplePayJS.ApplePayLineItem[];
|
|
658
664
|
|
|
659
665
|
/**
|
|
660
666
|
* Billing contact information for the shopper.
|
|
@@ -714,7 +720,7 @@ export interface GooglePayHppRequestOptions extends Omit<GooglePayRequestOptions
|
|
|
714
720
|
|
|
715
721
|
export type CardNetwork = 'visa' | 'mastercard' | 'maestro' | 'unionpay' | 'amex' | 'jcb' | 'diners' | 'discover';
|
|
716
722
|
|
|
717
|
-
export type GoogleSupportedCardNetWork = 'MASTERCARD' | 'MAESTRO' | 'VISA';
|
|
723
|
+
export type GoogleSupportedCardNetWork = 'MASTERCARD' | 'MAESTRO' | 'VISA' | 'AMEX' | 'DISCOVER' | 'JCB';
|
|
718
724
|
export interface GooglePayRequestOptions {
|
|
719
725
|
/**
|
|
720
726
|
* The two-letter ISO-3166 country code.
|
|
@@ -733,26 +739,25 @@ export interface GooglePayRequestOptions {
|
|
|
733
739
|
/**
|
|
734
740
|
* Whether the shopper must provide their email.
|
|
735
741
|
*
|
|
736
|
-
* @
|
|
742
|
+
* @defaultValue `false`
|
|
737
743
|
*/
|
|
738
744
|
emailRequired?: boolean;
|
|
739
745
|
/**
|
|
740
746
|
* Specifies the text to be displayed within the Google Pay button.
|
|
741
747
|
*
|
|
742
|
-
* @default "buy"
|
|
743
748
|
*/
|
|
744
749
|
buttonType?: google.payments.api.ButtonType;
|
|
745
750
|
/**
|
|
746
751
|
* Specifies the button color of the Google Pay button.
|
|
747
752
|
*
|
|
748
|
-
* @
|
|
753
|
+
* @defaultValue `'default'`
|
|
749
754
|
*/
|
|
750
755
|
buttonColor?: google.payments.api.ButtonColor;
|
|
751
756
|
/**
|
|
752
757
|
* Determines how the button's size should change relative to the
|
|
753
758
|
* button's parent element.
|
|
754
759
|
*
|
|
755
|
-
* @
|
|
760
|
+
* @defaultValue `'static'`
|
|
756
761
|
*/
|
|
757
762
|
buttonSizeMode?: google.payments.api.ButtonSizeMode;
|
|
758
763
|
/**
|
|
@@ -783,7 +788,7 @@ export interface GooglePayRequestOptions {
|
|
|
783
788
|
* - `FINAL`:
|
|
784
789
|
* The total price is the final total price of the transaction, and will
|
|
785
790
|
* not change based on selections made by the shopper.
|
|
786
|
-
* * @
|
|
791
|
+
* * @defaultValue `'FINAL'`
|
|
787
792
|
*/
|
|
788
793
|
totalPriceStatus?: 'NOT_CURRENTLY_KNOWN' | 'ESTIMATED' | 'FINAL';
|
|
789
794
|
/**
|
|
@@ -804,54 +809,39 @@ export interface GooglePayRequestOptions {
|
|
|
804
809
|
/**
|
|
805
810
|
* Defines callback methods for handling changed payment data and payment
|
|
806
811
|
* authorized events.
|
|
807
|
-
*
|
|
808
|
-
* If you set up Dynamic Price Updates in your integration, make sure you add
|
|
809
|
-
* the following [[PaymentDataChangedHandler|`onPaymentDataChanged`]] and
|
|
810
|
-
* [[PaymentAuthorizedHandler|`onPaymentAuthorized`]] callbacks.
|
|
811
|
-
*
|
|
812
|
-
* Example:
|
|
813
|
-
*
|
|
814
|
-
* The following example configuration uses the callbacks needed to set up
|
|
815
|
-
* Dynamic Price Updates:
|
|
816
|
-
*
|
|
817
|
-
* ```js
|
|
818
|
-
* {
|
|
819
|
-
* onPaymentDataChanged: onPaymentDataChanged,
|
|
820
|
-
* onPaymentAuthorized: onPaymentAuthorized
|
|
821
|
-
* }
|
|
822
|
-
* ```
|
|
823
812
|
*/
|
|
824
813
|
paymentDataCallbacks?: google.payments.api.PaymentDataCallbacks;
|
|
825
814
|
/**
|
|
826
|
-
* Allowed authentication methods.
|
|
815
|
+
* Allowed authentication methods.
|
|
816
|
+
* @defaultValue `['PAN_ONLY', 'CRYPTOGRAM_3DS']`
|
|
827
817
|
*/
|
|
828
818
|
allowedAuthMethods?: google.payments.api.CardAuthMethod[];
|
|
829
819
|
/**
|
|
830
|
-
* One or more card networks that you support.
|
|
820
|
+
* One or more card networks that you support.
|
|
831
821
|
*/
|
|
832
822
|
allowedCardNetworks?: GoogleSupportedCardNetWork[];
|
|
833
823
|
/**
|
|
834
824
|
* Whether a prepaid card may be used for this transaction.
|
|
835
825
|
*
|
|
836
|
-
* @
|
|
826
|
+
* @defaultValue `true`
|
|
837
827
|
*/
|
|
838
828
|
allowPrepaidCards?: boolean;
|
|
839
829
|
/**
|
|
840
830
|
* Whether a credit card may be used for this transaction.
|
|
841
831
|
*
|
|
842
|
-
* @
|
|
832
|
+
* @defaultValue `true`
|
|
843
833
|
*/
|
|
844
834
|
allowCreditCards?: boolean;
|
|
845
835
|
/**
|
|
846
836
|
* Set to `true` if you need information about the validation performed on the returned payment data.
|
|
847
837
|
*
|
|
848
|
-
* @
|
|
838
|
+
* @defaultValue `false`
|
|
849
839
|
*/
|
|
850
840
|
assuranceDetailsRequired?: boolean;
|
|
851
841
|
/**
|
|
852
842
|
* Whether a billing address is required from the shopper.
|
|
853
843
|
*
|
|
854
|
-
* @
|
|
844
|
+
* @defaultValue `false`
|
|
855
845
|
*/
|
|
856
846
|
billingAddressRequired?: boolean;
|
|
857
847
|
|
|
@@ -862,16 +852,12 @@ export interface GooglePayRequestOptions {
|
|
|
862
852
|
/**
|
|
863
853
|
* Whether a shipping address is required from the shopper.
|
|
864
854
|
*
|
|
865
|
-
* @
|
|
855
|
+
* @defaultValue `false`
|
|
866
856
|
*/
|
|
867
857
|
shippingAddressRequired?: false | true | undefined;
|
|
868
858
|
|
|
869
859
|
/**
|
|
870
|
-
* Optional shipping address parameters.
|
|
871
|
-
*
|
|
872
|
-
* If omitted, the default values specified in
|
|
873
|
-
* [[ShippingAddressParameters|`ShippingAddressParameters`]] will be
|
|
874
|
-
* used.
|
|
860
|
+
* Optional shipping address parameters for the returned shipping address.
|
|
875
861
|
*/
|
|
876
862
|
shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
|
|
877
863
|
/**
|
|
@@ -885,7 +871,7 @@ export interface GooglePayRequestOptions {
|
|
|
885
871
|
*
|
|
886
872
|
* Note: This field is currently for web only.
|
|
887
873
|
*
|
|
888
|
-
* @
|
|
874
|
+
* @defaultValue `false`
|
|
889
875
|
*/
|
|
890
876
|
shippingOptionRequired?: boolean;
|
|
891
877
|
|
|
@@ -907,55 +893,60 @@ export interface GooglePayRequestOptions {
|
|
|
907
893
|
* option is selected, the developer could update the `transactionInfo`
|
|
908
894
|
* with new `totalPrice` and `diplayItems`).
|
|
909
895
|
*
|
|
910
|
-
* Note: This functionality is only available for web.
|
|
911
896
|
*/
|
|
912
897
|
callbackIntents?: google.payments.api.CallbackIntent[];
|
|
913
898
|
}
|
|
914
899
|
|
|
915
|
-
|
|
900
|
+
/**
|
|
901
|
+
* Applies to `googlePayButton` element type integration, the interface used when `createElement()` is called with type `googlePayButton`.
|
|
902
|
+
*/
|
|
903
|
+
export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
904
|
+
/**
|
|
905
|
+
* The layout of each element stays consistent, but you can modify width, height, and more.
|
|
906
|
+
*/
|
|
907
|
+
appearance?: Appearance;
|
|
908
|
+
/**
|
|
909
|
+
* Box style and 3ds popUp style for the GooglePayButton Element.
|
|
910
|
+
*/
|
|
911
|
+
style?: CSSProperties & PopUpStyle;
|
|
916
912
|
/**
|
|
917
913
|
* The ID of the Payment Intent you would like to checkout.
|
|
918
|
-
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/
|
|
914
|
+
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
|
|
919
915
|
*
|
|
920
916
|
*/
|
|
921
917
|
intent_id?: string;
|
|
922
918
|
/**
|
|
923
919
|
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
924
|
-
* Leave it empty if intent_id and customer_id are not provided.
|
|
920
|
+
* Leave it empty if `intent_id` and `customer_id` are not provided.
|
|
925
921
|
*/
|
|
926
922
|
client_secret?: string;
|
|
927
923
|
/**
|
|
928
924
|
* The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
929
|
-
* This field is required when `mode` is `recurring`.
|
|
925
|
+
* This field is required when `mode` is `'recurring'`.
|
|
930
926
|
*/
|
|
931
927
|
customer_id?: string;
|
|
932
928
|
/**
|
|
933
929
|
* The checkout mode for the shopper.
|
|
934
|
-
* @defaultValue "payment"
|
|
935
930
|
*/
|
|
936
931
|
mode?: Mode;
|
|
937
932
|
/**
|
|
938
933
|
* Indicate the amount and currency of the Payment Intent.
|
|
939
|
-
*
|
|
940
|
-
* If the mode is set to `recurring` and intent_id omitted, amount should be {value: 0, currency: 'Replace with payment currency'}.
|
|
934
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: 0, currency: 'Replace with payment currency'}`.
|
|
941
935
|
*/
|
|
942
|
-
amount:
|
|
943
|
-
value: number;
|
|
944
|
-
currency: string;
|
|
945
|
-
};
|
|
936
|
+
amount: Amount;
|
|
946
937
|
|
|
947
938
|
/**
|
|
948
939
|
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
949
|
-
* Defaults to `true` if authorization type is `final_auth` and `false` for `pre_auth`.
|
|
950
940
|
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
951
|
-
* @defaultValue `true`
|
|
941
|
+
* @defaultValue `true`
|
|
952
942
|
*/
|
|
953
943
|
autoCapture?: boolean;
|
|
954
944
|
/**
|
|
955
|
-
* The authorization type for the card payment. Options include: `pre_auth`, `final_auth`.
|
|
956
|
-
* Set it to `pre_auth` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
945
|
+
* The authorization type for the card payment. Options include: `"pre_auth"`, `"final_auth"`.
|
|
946
|
+
* Set it to `"pre_auth"` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window. Currently it's only available when the card brand is Visa or Mastercard.
|
|
947
|
+
* `autoCapture` will be automatically set to `false` if you enable `pre_auth`.
|
|
957
948
|
*
|
|
958
|
-
* @defaultValue
|
|
949
|
+
* @defaultValue `'final_auth'`
|
|
959
950
|
*/
|
|
960
951
|
authorizationType?: AuthorizationType;
|
|
961
952
|
/**
|
|
@@ -974,19 +965,94 @@ type GooglePayNextActionOptions = Pick<
|
|
|
974
965
|
GooglePayButtonOptions,
|
|
975
966
|
'client_secret' | 'intent_id' | 'customer_id' | 'autoCapture' | 'authorizationType' | 'authFormContainer'
|
|
976
967
|
>;
|
|
968
|
+
/**
|
|
969
|
+
* Supported methods for presenting the Apple Pay button.
|
|
970
|
+
* Options:
|
|
971
|
+
*
|
|
972
|
+
* - `'add-money'`:
|
|
973
|
+
* Useful for adding money to a card, account, or payment system.
|
|
974
|
+
*
|
|
975
|
+
* - `'book'`:
|
|
976
|
+
* Useful for booking trips, flights, or other experiences.
|
|
977
|
+
*
|
|
978
|
+
* - `'buy'`:
|
|
979
|
+
* Useful for product purchases.
|
|
980
|
+
*
|
|
981
|
+
* - `'check-out'`:
|
|
982
|
+
* Useful for purchase experiences that include other payment buttons that start with "Check out".
|
|
983
|
+
*
|
|
984
|
+
* - `'continue'`:
|
|
985
|
+
* Useful for general purchases.
|
|
986
|
+
*
|
|
987
|
+
* - `'contribute'`:
|
|
988
|
+
* Useful to help people contribute money to projects, causes, organizations, and other entities.
|
|
989
|
+
*
|
|
990
|
+
* - `'donate'`:
|
|
991
|
+
* Used by approved nonprofit organization that lets people make donations.
|
|
992
|
+
*
|
|
993
|
+
* - `'order'`:
|
|
994
|
+
* Useful for placing orders for items such as meals or flowers.
|
|
995
|
+
*
|
|
996
|
+
* - `'pay'`:
|
|
997
|
+
* Useful for paying bills or invoices.
|
|
998
|
+
*
|
|
999
|
+
* - `'plain'`:
|
|
1000
|
+
* Shows Apple Pay logo only, useful when an additional call to action isn't needed.
|
|
1001
|
+
*
|
|
1002
|
+
* - `'reload'`:
|
|
1003
|
+
* Useful for adding money to a card, account, or payment system.
|
|
1004
|
+
*
|
|
1005
|
+
* - `'rent'`:
|
|
1006
|
+
* Useful for renting items such as cars or scooters.
|
|
1007
|
+
*
|
|
1008
|
+
* - `'set-up'`:
|
|
1009
|
+
* Useful for prompting the user to set up a card.
|
|
1010
|
+
*
|
|
1011
|
+
* - `'subscribe'`:
|
|
1012
|
+
* Useful for purchasing a subscription such as a gym membership or meal-kit delivery service.
|
|
1013
|
+
*
|
|
1014
|
+
* - `'support'`:
|
|
1015
|
+
* Useful for helping people give money to projects, causes, organizations, and other entities.
|
|
1016
|
+
*
|
|
1017
|
+
* - `'tip'`:
|
|
1018
|
+
* Useful for letting people tip for goods or services.
|
|
1019
|
+
*
|
|
1020
|
+
* - `'top-up'`:
|
|
1021
|
+
* Useful for adding money to a card, account, or payment system.
|
|
1022
|
+
*/
|
|
1023
|
+
export type ApplePayButtonType =
|
|
1024
|
+
| 'add-money'
|
|
1025
|
+
| 'book'
|
|
1026
|
+
| 'buy'
|
|
1027
|
+
| 'check-out'
|
|
1028
|
+
| 'continue'
|
|
1029
|
+
| 'contribute'
|
|
1030
|
+
| 'donate'
|
|
1031
|
+
| 'order'
|
|
1032
|
+
| 'pay'
|
|
1033
|
+
| 'plain'
|
|
1034
|
+
| 'reload'
|
|
1035
|
+
| 'rent'
|
|
1036
|
+
| 'set-up'
|
|
1037
|
+
| 'subscribe'
|
|
1038
|
+
| 'support'
|
|
1039
|
+
| 'tip'
|
|
1040
|
+
| 'top-up';
|
|
1041
|
+
export type ApplePayButtonColor = 'black' | 'white' | 'white-outline';
|
|
977
1042
|
|
|
978
1043
|
export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
979
1044
|
/**
|
|
980
|
-
*
|
|
981
|
-
*
|
|
1045
|
+
* Supported methods for presenting the Apple Pay button.
|
|
1046
|
+
* A translated button label may appear if a language specified in the
|
|
1047
|
+
* viewer's browser matches an [available language](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaybuttonlocale).
|
|
982
1048
|
*/
|
|
983
|
-
buttonType?:
|
|
1049
|
+
buttonType?: ApplePayButtonType;
|
|
984
1050
|
/**
|
|
985
1051
|
* Indicate the color of the button.
|
|
986
1052
|
*
|
|
987
|
-
* @defaultValue
|
|
1053
|
+
* @defaultValue `'black'`
|
|
988
1054
|
*/
|
|
989
|
-
buttonColor?:
|
|
1055
|
+
buttonColor?: ApplePayButtonColor;
|
|
990
1056
|
/**
|
|
991
1057
|
* Provide a business name for the label field. Use the same business name that you want displayed for the charge on the shopper's bank or credit card statement. For example, "COMPANY, INC.".
|
|
992
1058
|
*
|
|
@@ -996,7 +1062,7 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
|
996
1062
|
* Indicate whether a line item is final or pending.
|
|
997
1063
|
* If the mode is `recurring` and if it's a variable subscription, the value should be pending.
|
|
998
1064
|
*
|
|
999
|
-
* @defaultValue
|
|
1065
|
+
* @defaultValue `'final'`
|
|
1000
1066
|
*/
|
|
1001
1067
|
totalPriceType?: 'final' | 'pending';
|
|
1002
1068
|
/**
|
|
@@ -1015,51 +1081,64 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
|
1015
1081
|
*/
|
|
1016
1082
|
merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
|
|
1017
1083
|
}
|
|
1018
|
-
|
|
1084
|
+
|
|
1085
|
+
interface Amount {
|
|
1086
|
+
value: number;
|
|
1087
|
+
currency: string;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Applies to `applePayButton` element type integration, the interface used when `createElement()` is called with type `applePayButton`.
|
|
1092
|
+
*/
|
|
1093
|
+
export interface ApplePayButtonOptions extends ApplePayRequestOptions {
|
|
1019
1094
|
/**
|
|
1020
1095
|
* The ID of the Payment Intent you would like to checkout.
|
|
1021
|
-
* Required when `mode` is set to `payment` but optional for `recurring`.
|
|
1022
|
-
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/
|
|
1096
|
+
* Required when `mode` is set to `'payment'` but optional for `'recurring'`.
|
|
1097
|
+
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
|
|
1023
1098
|
*
|
|
1024
1099
|
*/
|
|
1025
1100
|
intent_id?: string;
|
|
1026
1101
|
/**
|
|
1027
1102
|
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
1028
|
-
* Leave it empty if intent_id and customer_id are not provided as you can provide it in the update() function later.
|
|
1103
|
+
* Leave it empty if `intent_id` and `customer_id` are not provided as you can provide it in the update() function later.
|
|
1029
1104
|
*/
|
|
1030
1105
|
client_secret?: string;
|
|
1031
1106
|
/**
|
|
1032
1107
|
* The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
1033
|
-
* This field is required when `mode` is `recurring`.
|
|
1108
|
+
* This field is required when `mode` is `'recurring'`.
|
|
1034
1109
|
*/
|
|
1035
1110
|
customer_id?: string;
|
|
1036
1111
|
/**
|
|
1037
1112
|
* The checkout mode for the shopper.
|
|
1038
|
-
* @
|
|
1113
|
+
* @defaultValue `'payment'`
|
|
1039
1114
|
*/
|
|
1040
1115
|
mode?: Mode;
|
|
1041
1116
|
/**
|
|
1042
1117
|
* Indicate the amount and currency of the Payment Intent.
|
|
1043
|
-
*
|
|
1044
|
-
* If the mode is set to `recurring` and intent_id omitted, amount should be {value: 0, currency: 'Replace with payment currency'}.
|
|
1118
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: 0, currency: 'Replace with payment currency'}`.
|
|
1045
1119
|
*/
|
|
1046
|
-
amount:
|
|
1047
|
-
value: number;
|
|
1048
|
-
currency: string;
|
|
1049
|
-
};
|
|
1120
|
+
amount: Amount;
|
|
1050
1121
|
/**
|
|
1051
1122
|
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
1052
1123
|
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
1053
|
-
* @defaultValue `true`
|
|
1124
|
+
* @defaultValue `true`
|
|
1054
1125
|
*/
|
|
1055
1126
|
autoCapture?: boolean;
|
|
1056
1127
|
/**
|
|
1057
|
-
* The authorization type for the card payment.
|
|
1058
|
-
* Set it to `pre_auth` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window.
|
|
1059
|
-
* Currently it's only available when the card brand is Visa or Mastercard.
|
|
1060
|
-
* @defaultValue `final_auth`
|
|
1128
|
+
* The authorization type for the card payment.
|
|
1129
|
+
* Set it to `'pre_auth'` if you want to place a hold on your customer’s card for more than 7 days, i.e., extend the authorization time window.
|
|
1130
|
+
* Currently it's only available when the card brand is Visa or Mastercard. `autoCapture` will be automatically set to `false` if you enable `pre_auth`.
|
|
1131
|
+
* @defaultValue `'final_auth'`
|
|
1061
1132
|
*/
|
|
1062
1133
|
authorizationType?: AuthorizationType;
|
|
1134
|
+
/**
|
|
1135
|
+
* The layout of each element stays consistent, but you can modify width, height, and more.
|
|
1136
|
+
*/
|
|
1137
|
+
appearance?: Appearance;
|
|
1138
|
+
/**
|
|
1139
|
+
* Box style for the ApplePayButton Element.
|
|
1140
|
+
*/
|
|
1141
|
+
style?: CSSProperties;
|
|
1063
1142
|
}
|
|
1064
1143
|
|
|
1065
1144
|
export interface ApplePayButtonUpdateOptions extends ApplePayButtonOptions {
|
|
@@ -1072,23 +1151,21 @@ export interface ApplePayButtonUpdateOptions extends ApplePayButtonOptions {
|
|
|
1072
1151
|
/**
|
|
1073
1152
|
* Apply to wechat Element type integration, the interface used when createElemen() is called with type `wechat`.
|
|
1074
1153
|
*/
|
|
1075
|
-
export interface WechatElementOptions
|
|
1154
|
+
export interface WechatElementOptions {
|
|
1076
1155
|
/**
|
|
1077
1156
|
* The Payment Intent you would like to checkout.
|
|
1078
|
-
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/
|
|
1157
|
+
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/)
|
|
1079
1158
|
*
|
|
1080
1159
|
*/
|
|
1081
1160
|
intent?: Intent;
|
|
1161
|
+
/**
|
|
1162
|
+
* Box style for the WechatElement Element.
|
|
1163
|
+
*/
|
|
1164
|
+
style?: CSSProperties;
|
|
1082
1165
|
}
|
|
1083
1166
|
|
|
1084
1167
|
/**
|
|
1085
1168
|
* Functions and external fields can be used in your integration flow with Airwallex Payment Elements.
|
|
1086
|
-
*
|
|
1087
|
-
* Two ways to get elements: createElement() function or getElement() function
|
|
1088
|
-
*
|
|
1089
|
-
* ***IMPORTANT***
|
|
1090
|
-
*
|
|
1091
|
-
* Once Element is destroyed by calling destroyElement() function, the Element reference is no longer valid.
|
|
1092
1169
|
*/
|
|
1093
1170
|
export interface Element {
|
|
1094
1171
|
/**
|
|
@@ -1120,16 +1197,16 @@ export interface Element {
|
|
|
1120
1197
|
*/
|
|
1121
1198
|
mount(domElement: string | HTMLElement): null | HTMLElement;
|
|
1122
1199
|
/**
|
|
1123
|
-
* Blurs the
|
|
1200
|
+
* Blurs the the HTML Input element.
|
|
1124
1201
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
|
|
1125
1202
|
*/
|
|
1126
1203
|
blur(): void;
|
|
1127
1204
|
/**
|
|
1128
|
-
* Clears the
|
|
1205
|
+
* Clears the the HTML Input element.
|
|
1129
1206
|
*/
|
|
1130
1207
|
clear(): void;
|
|
1131
1208
|
/**
|
|
1132
|
-
* Focuses the
|
|
1209
|
+
* Focuses the the HTML Input element.
|
|
1133
1210
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus
|
|
1134
1211
|
*/
|
|
1135
1212
|
focus(): void;
|
|
@@ -1168,10 +1245,6 @@ interface ElementBaseType {
|
|
|
1168
1245
|
* The DOM element you called in the mount() function.
|
|
1169
1246
|
*/
|
|
1170
1247
|
domElement: null | HTMLElement;
|
|
1171
|
-
/**
|
|
1172
|
-
* Element integration `step #3`
|
|
1173
|
-
* Mounts payment Element to your HTML DOM element for checkout.
|
|
1174
|
-
*/
|
|
1175
1248
|
/**
|
|
1176
1249
|
* Mounts Element to your HTML DOM.
|
|
1177
1250
|
* @example
|
|
@@ -1184,7 +1257,7 @@ interface ElementBaseType {
|
|
|
1184
1257
|
element.mount('container-dom-id');
|
|
1185
1258
|
|
|
1186
1259
|
// 2. Find the created DOM in the existing HTML and call with the container DOM element
|
|
1187
|
-
const containerElement = document.getElementById(
|
|
1260
|
+
const containerElement = document.getElementById('container-dom-id');
|
|
1188
1261
|
element.mount(containerElement);
|
|
1189
1262
|
```
|
|
1190
1263
|
*/
|
|
@@ -1214,13 +1287,13 @@ interface ElementBaseType {
|
|
|
1214
1287
|
destroy(): void;
|
|
1215
1288
|
}
|
|
1216
1289
|
|
|
1217
|
-
type CardElementEvent = 'ready' | 'click' | 'focus' | 'blur';
|
|
1290
|
+
type CardElementEvent = 'ready' | 'click' | 'focus' | 'blur' | 'change';
|
|
1218
1291
|
/**
|
|
1219
1292
|
* Functions and external fields can be used in your integration flow with Airwallex Payment Elements.
|
|
1220
1293
|
*/
|
|
1221
1294
|
export interface CardElementType extends ElementBaseType {
|
|
1222
1295
|
/**
|
|
1223
|
-
* Using this function to blur the
|
|
1296
|
+
* Using this function to blur the HTML Input element
|
|
1224
1297
|
*@example
|
|
1225
1298
|
```ts
|
|
1226
1299
|
element.blur();
|
|
@@ -1228,16 +1301,16 @@ export interface CardElementType extends ElementBaseType {
|
|
|
1228
1301
|
*/
|
|
1229
1302
|
blur(): void;
|
|
1230
1303
|
/**
|
|
1231
|
-
* Using this function to clear the
|
|
1232
|
-
|
|
1304
|
+
* Using this function to clear the HTML Input element
|
|
1305
|
+
* @example
|
|
1233
1306
|
```ts
|
|
1234
1307
|
element.clear();
|
|
1235
1308
|
```
|
|
1236
1309
|
*/
|
|
1237
1310
|
clear(): void;
|
|
1238
1311
|
/**
|
|
1239
|
-
* Using this function to focus the
|
|
1240
|
-
|
|
1312
|
+
* Using this function to focus the HTML Input element
|
|
1313
|
+
* @example
|
|
1241
1314
|
```ts
|
|
1242
1315
|
element.focus();
|
|
1243
1316
|
```
|
|
@@ -1245,33 +1318,49 @@ export interface CardElementType extends ElementBaseType {
|
|
|
1245
1318
|
focus(): void;
|
|
1246
1319
|
/**
|
|
1247
1320
|
* Creates a Payment Consent, which represents the consent between you and the shopper to use the shopper’s saved card details for future payments.
|
|
1248
|
-
* @param data Payment consent request
|
|
1249
|
-
|
|
1321
|
+
* @param data - Payment consent request payload
|
|
1322
|
+
* @example
|
|
1250
1323
|
```ts
|
|
1251
1324
|
element.createPaymentConsent({client_secret: 'mock_client_secret'});
|
|
1252
1325
|
```
|
|
1253
1326
|
*/
|
|
1254
|
-
createPaymentConsent(data:
|
|
1327
|
+
createPaymentConsent(data: PaymentConsentRequestData): Promise<PaymentConsentResponse>;
|
|
1255
1328
|
/**
|
|
1329
|
+
* Using this function to verify consent
|
|
1330
|
+
* @param data - Verify consent request payload
|
|
1331
|
+
* @example
|
|
1332
|
+
```ts
|
|
1333
|
+
element.verifyConsent({
|
|
1334
|
+
consent_id: 'mock_consent_id',
|
|
1335
|
+
client_secret: 'mock_client_secret',
|
|
1336
|
+
currency: 'mock_currency'
|
|
1337
|
+
});
|
|
1338
|
+
```
|
|
1339
|
+
*/
|
|
1340
|
+
verifyConsent(data: VerifyConsentRequest): Promise<PaymentConsentResponse | boolean>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Using this function to confirm payment intent
|
|
1256
1343
|
* Confirms the Payment Intent. Call this function when the shopper is ready to make a payment as per the details in the Payment Intent.
|
|
1257
|
-
* @param data Payment method
|
|
1258
|
-
|
|
1344
|
+
* @param data - Payment method request payload
|
|
1345
|
+
* @example
|
|
1259
1346
|
```ts
|
|
1260
1347
|
element.confirm({client_secret: 'mock_client_secret'});
|
|
1261
1348
|
```
|
|
1262
1349
|
*/
|
|
1263
|
-
confirm(data:
|
|
1350
|
+
confirm(data: PaymentMethodRequestData): Promise<Intent>;
|
|
1264
1351
|
/**
|
|
1265
1352
|
* Using this function to update the element option after create the element
|
|
1266
|
-
|
|
1353
|
+
* @example
|
|
1267
1354
|
```ts
|
|
1268
|
-
element.
|
|
1355
|
+
element.update({autoCapture: true});
|
|
1269
1356
|
```
|
|
1270
1357
|
*/
|
|
1271
1358
|
update(options?: Partial<CardElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1272
1359
|
/**
|
|
1273
1360
|
* Listen to Element events.
|
|
1274
1361
|
*
|
|
1362
|
+
* @param event - The event name
|
|
1363
|
+
* @param handler - The event handler
|
|
1275
1364
|
* @example
|
|
1276
1365
|
```ts
|
|
1277
1366
|
element.on('success', () => {
|
|
@@ -1289,25 +1378,24 @@ export type CardNumberElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pr
|
|
|
1289
1378
|
*/
|
|
1290
1379
|
export interface CardNumberElementType extends ElementBaseType {
|
|
1291
1380
|
/**
|
|
1292
|
-
* Using this function to blur the
|
|
1293
|
-
|
|
1381
|
+
* Using this function to blur the HTML Input element
|
|
1382
|
+
* @example
|
|
1294
1383
|
```ts
|
|
1295
1384
|
element.blur();
|
|
1296
1385
|
```
|
|
1297
1386
|
*/
|
|
1298
1387
|
blur(): void;
|
|
1299
1388
|
/**
|
|
1300
|
-
* Using this function to clear the
|
|
1301
|
-
|
|
1389
|
+
* Using this function to clear the HTML Input element
|
|
1390
|
+
* @example
|
|
1302
1391
|
```ts
|
|
1303
1392
|
element.clear();
|
|
1304
1393
|
```
|
|
1305
1394
|
*/
|
|
1306
1395
|
clear(): void;
|
|
1307
1396
|
/**
|
|
1308
|
-
* Using this function to focus the
|
|
1309
|
-
*
|
|
1310
|
-
*@example
|
|
1397
|
+
* Using this function to focus the HTML Input element
|
|
1398
|
+
* @example
|
|
1311
1399
|
```ts
|
|
1312
1400
|
element.focus();
|
|
1313
1401
|
```
|
|
@@ -1315,22 +1403,33 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1315
1403
|
focus(): void;
|
|
1316
1404
|
/**
|
|
1317
1405
|
* Creates a Payment Consent, which represents the consent between you and the shopper to use the shopper’s saved card details for future payments.
|
|
1318
|
-
* @param data Payment consent request
|
|
1319
1406
|
*@example
|
|
1320
1407
|
```ts
|
|
1321
1408
|
element.createPaymentConsent({client_secret: 'mock_client_secret'});
|
|
1322
1409
|
```
|
|
1323
1410
|
*/
|
|
1324
|
-
createPaymentConsent(data:
|
|
1411
|
+
createPaymentConsent(data: PaymentConsentRequestData): Promise<PaymentConsentResponse>;
|
|
1325
1412
|
/**
|
|
1413
|
+
* Using this function to verify payment consent.
|
|
1414
|
+
*@example
|
|
1415
|
+
```ts
|
|
1416
|
+
element.verifyConsent({
|
|
1417
|
+
consent_id: 'mock_consent_id',
|
|
1418
|
+
client_secret: 'mock_client_secret',
|
|
1419
|
+
currency: 'mock_currency'
|
|
1420
|
+
});
|
|
1421
|
+
```
|
|
1422
|
+
*/
|
|
1423
|
+
verifyConsent(data: VerifyConsentRequest): Promise<PaymentConsentResponse | boolean>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Using this function to confirm payment intent.
|
|
1326
1426
|
* Confirms the Payment Intent.
|
|
1327
|
-
* @param data Payment method
|
|
1328
1427
|
*@example
|
|
1329
1428
|
```ts
|
|
1330
1429
|
element.confirm({client_secret: 'mock_client_secret'});
|
|
1331
1430
|
```
|
|
1332
1431
|
*/
|
|
1333
|
-
confirm(data:
|
|
1432
|
+
confirm(data: PaymentMethodRequestData): Promise<Intent>;
|
|
1334
1433
|
/**
|
|
1335
1434
|
* Using this function to update the element option after create the element
|
|
1336
1435
|
*@example
|
|
@@ -1355,28 +1454,28 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1355
1454
|
export type ExpiryElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey';
|
|
1356
1455
|
|
|
1357
1456
|
/**
|
|
1358
|
-
* Functions and external fields can be used in your integration flow with
|
|
1457
|
+
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1359
1458
|
*/
|
|
1360
1459
|
export interface ExpiryDateElementType extends ElementBaseType {
|
|
1361
1460
|
/**
|
|
1362
|
-
* Using this function to blur the
|
|
1363
|
-
|
|
1461
|
+
* Using this function to blur the HTML Input element
|
|
1462
|
+
* @example
|
|
1364
1463
|
```ts
|
|
1365
1464
|
element.blur();
|
|
1366
1465
|
```
|
|
1367
1466
|
*/
|
|
1368
1467
|
blur(): void;
|
|
1369
1468
|
/**
|
|
1370
|
-
* Using this function to clear the
|
|
1371
|
-
|
|
1469
|
+
* Using this function to clear the HTML Input element
|
|
1470
|
+
* @example
|
|
1372
1471
|
```ts
|
|
1373
1472
|
element.clear();
|
|
1374
1473
|
```
|
|
1375
1474
|
*/
|
|
1376
1475
|
clear(): void;
|
|
1377
1476
|
/**
|
|
1378
|
-
* Using this function to focus the
|
|
1379
|
-
|
|
1477
|
+
* Using this function to focus the HTML Input element
|
|
1478
|
+
* @example
|
|
1380
1479
|
```ts
|
|
1381
1480
|
element.focus();
|
|
1382
1481
|
```
|
|
@@ -1406,28 +1505,28 @@ export interface ExpiryDateElementType extends ElementBaseType {
|
|
|
1406
1505
|
export type CvcElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
|
|
1407
1506
|
|
|
1408
1507
|
/**
|
|
1409
|
-
* Functions and external fields can be used in your integration flow with
|
|
1508
|
+
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1410
1509
|
*/
|
|
1411
1510
|
export interface CvcElementType extends ElementBaseType {
|
|
1412
1511
|
/**
|
|
1413
|
-
* Using this function to blur the
|
|
1414
|
-
|
|
1512
|
+
* Using this function to blur the HTML Input element
|
|
1513
|
+
* @example
|
|
1415
1514
|
```ts
|
|
1416
1515
|
element.blur();
|
|
1417
1516
|
```
|
|
1418
1517
|
*/
|
|
1419
1518
|
blur(): void;
|
|
1420
1519
|
/**
|
|
1421
|
-
* Using this function to clear the
|
|
1422
|
-
|
|
1520
|
+
* Using this function to clear the HTML Input element
|
|
1521
|
+
* @example
|
|
1423
1522
|
```ts
|
|
1424
1523
|
element.clear();
|
|
1425
1524
|
```
|
|
1426
1525
|
*/
|
|
1427
1526
|
clear(): void;
|
|
1428
1527
|
/**
|
|
1429
|
-
* Using this function to focus the
|
|
1430
|
-
|
|
1528
|
+
* Using this function to focus the HTML Input element
|
|
1529
|
+
* @example
|
|
1431
1530
|
```ts
|
|
1432
1531
|
element.focus();
|
|
1433
1532
|
```
|
|
@@ -1435,25 +1534,23 @@ export interface CvcElementType extends ElementBaseType {
|
|
|
1435
1534
|
focus(): void;
|
|
1436
1535
|
/**
|
|
1437
1536
|
* Using this function to confirm payment intent
|
|
1438
|
-
* @
|
|
1439
|
-
*@example
|
|
1537
|
+
* @example
|
|
1440
1538
|
```ts
|
|
1441
1539
|
element.confirm({client_secret: 'mocked client_secret'});
|
|
1442
1540
|
```
|
|
1443
1541
|
*/
|
|
1444
|
-
confirm(data:
|
|
1542
|
+
confirm(data: PaymentMethodRequestData): Promise<Intent>;
|
|
1445
1543
|
/**
|
|
1446
1544
|
* Using this function to create payment consent
|
|
1447
|
-
* @
|
|
1448
|
-
*@example
|
|
1545
|
+
* @example
|
|
1449
1546
|
```ts
|
|
1450
1547
|
element.createPaymentConsent({client_secret: 'mocked client_secret'});
|
|
1451
1548
|
```
|
|
1452
1549
|
*/
|
|
1453
|
-
createPaymentConsent(data:
|
|
1550
|
+
createPaymentConsent(data: PaymentConsentRequestData): Promise<PaymentConsentResponse>;
|
|
1454
1551
|
/**
|
|
1455
1552
|
* Using this function to update the element option after create the element
|
|
1456
|
-
|
|
1553
|
+
* @example
|
|
1457
1554
|
```ts
|
|
1458
1555
|
element.update({placeholder: 'mocked placeholder'});
|
|
1459
1556
|
```
|
|
@@ -1483,8 +1580,15 @@ export type ApplePayButtonEvent =
|
|
|
1483
1580
|
| 'success'
|
|
1484
1581
|
| 'error';
|
|
1485
1582
|
|
|
1583
|
+
interface ParameterObject {
|
|
1584
|
+
/**
|
|
1585
|
+
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
1586
|
+
*/
|
|
1587
|
+
client_secret: string;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1486
1590
|
/**
|
|
1487
|
-
* Functions and external fields can be used in your integration flow with
|
|
1591
|
+
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1488
1592
|
*/
|
|
1489
1593
|
export interface ApplePayButtonElementType extends ElementBaseType {
|
|
1490
1594
|
/**
|
|
@@ -1513,7 +1617,6 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1513
1617
|
on(event: ApplePayButtonEvent, handler: EventListener): void;
|
|
1514
1618
|
/**
|
|
1515
1619
|
* Using this function to confirm payment intent
|
|
1516
|
-
* @param data client_secret returned in create intent response
|
|
1517
1620
|
* @example
|
|
1518
1621
|
```ts
|
|
1519
1622
|
element.confirmIntent({
|
|
@@ -1521,10 +1624,9 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1521
1624
|
});
|
|
1522
1625
|
```
|
|
1523
1626
|
*/
|
|
1524
|
-
confirmIntent(data:
|
|
1627
|
+
confirmIntent(data: ParameterObject): Promise<Intent>;
|
|
1525
1628
|
/**
|
|
1526
1629
|
* Using this function to create payment consent
|
|
1527
|
-
* @param data client_secret returned in create intent response or returned in create customer response
|
|
1528
1630
|
* @example
|
|
1529
1631
|
```ts
|
|
1530
1632
|
element.createPaymentConsent({
|
|
@@ -1532,33 +1634,33 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1532
1634
|
});
|
|
1533
1635
|
```
|
|
1534
1636
|
*/
|
|
1535
|
-
createPaymentConsent(data:
|
|
1637
|
+
createPaymentConsent(data: ParameterObject): Promise<Consent | undefined>;
|
|
1536
1638
|
/**
|
|
1537
1639
|
*
|
|
1538
|
-
* @param
|
|
1640
|
+
* @param merchantSession - An opaque message session object.
|
|
1539
1641
|
* @example
|
|
1540
1642
|
```ts
|
|
1541
1643
|
element.completeValidation({
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1644
|
+
epochTimestamp: 1721269728247,
|
|
1645
|
+
expiresAt: 1721273328247,
|
|
1646
|
+
merchantSessionIdentifier: 'xxx',
|
|
1647
|
+
nonce: '9c283350',
|
|
1648
|
+
merchantIdentifier: 'xxx',
|
|
1649
|
+
domainName: 'your domain name',
|
|
1650
|
+
displayName: 'Sawayn, O\'Conner and Quigley',
|
|
1651
|
+
signature: 'xxx',
|
|
1652
|
+
operationalAnalyticsIdentifier: 'xxx',
|
|
1653
|
+
retries: 0,
|
|
1654
|
+
pspId: 'xxx',
|
|
1655
|
+
});
|
|
1554
1656
|
```
|
|
1555
1657
|
*/
|
|
1556
|
-
completeValidation(
|
|
1658
|
+
completeValidation(merchantSession: unknown): void;
|
|
1557
1659
|
}
|
|
1558
1660
|
|
|
1559
1661
|
export type DropInElementEvent =
|
|
1560
1662
|
| 'ready'
|
|
1561
|
-
| '
|
|
1663
|
+
| 'clickConfirmButton'
|
|
1562
1664
|
| 'cancel'
|
|
1563
1665
|
| 'success'
|
|
1564
1666
|
| 'error'
|
|
@@ -1566,7 +1668,7 @@ export type DropInElementEvent =
|
|
|
1566
1668
|
| 'pendingVerifyAccount';
|
|
1567
1669
|
|
|
1568
1670
|
/**
|
|
1569
|
-
* Functions and external fields can be used in your integration flow with
|
|
1671
|
+
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1570
1672
|
*/
|
|
1571
1673
|
export interface DropInElementType extends ElementBaseType {
|
|
1572
1674
|
/**
|
|
@@ -1604,7 +1706,7 @@ export type GooglePayButtonEvent =
|
|
|
1604
1706
|
| 'shippingAddressChange'
|
|
1605
1707
|
| 'shippingMethodChange';
|
|
1606
1708
|
/**
|
|
1607
|
-
* Functions and external fields can be used in your integration flow with
|
|
1709
|
+
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1608
1710
|
*/
|
|
1609
1711
|
export interface GooglePayButtonElementType extends ElementBaseType {
|
|
1610
1712
|
/**
|
|
@@ -1634,7 +1736,6 @@ export interface GooglePayButtonElementType extends ElementBaseType {
|
|
|
1634
1736
|
|
|
1635
1737
|
/**
|
|
1636
1738
|
* Using this function to confirm payment intent
|
|
1637
|
-
* @param data client_secret returned in create intent response
|
|
1638
1739
|
* @example
|
|
1639
1740
|
```ts
|
|
1640
1741
|
element.confirmIntent({
|
|
@@ -1642,7 +1743,7 @@ export interface GooglePayButtonElementType extends ElementBaseType {
|
|
|
1642
1743
|
});
|
|
1643
1744
|
```
|
|
1644
1745
|
*/
|
|
1645
|
-
confirmIntent(data:
|
|
1746
|
+
confirmIntent(data: ParameterObject): Promise<Intent>;
|
|
1646
1747
|
/**
|
|
1647
1748
|
* Using this function to create payment consent
|
|
1648
1749
|
* @param data client_secret returned in create intent response or returned in create customer response
|
|
@@ -1653,12 +1754,12 @@ export interface GooglePayButtonElementType extends ElementBaseType {
|
|
|
1653
1754
|
});
|
|
1654
1755
|
```
|
|
1655
1756
|
*/
|
|
1656
|
-
createPaymentConsent(data:
|
|
1757
|
+
createPaymentConsent(data: ParameterObject): Promise<Consent | undefined>;
|
|
1657
1758
|
}
|
|
1658
1759
|
|
|
1659
1760
|
export type WechatElementEvent = 'ready' | 'success' | 'error';
|
|
1660
1761
|
/**
|
|
1661
|
-
* @deprecated
|
|
1762
|
+
* @deprecated Use {@link DropInElementType} instead
|
|
1662
1763
|
*/
|
|
1663
1764
|
export interface WechatElementType extends ElementBaseType {
|
|
1664
1765
|
/**
|
|
@@ -1689,7 +1790,7 @@ export interface WechatElementType extends ElementBaseType {
|
|
|
1689
1790
|
|
|
1690
1791
|
export type QrcodeElementEvent = 'ready' | 'success' | 'error';
|
|
1691
1792
|
/**
|
|
1692
|
-
* @deprecated
|
|
1793
|
+
* @deprecated Use {@link DropInElementType} instead
|
|
1693
1794
|
*/
|
|
1694
1795
|
export interface QrcodeElementType extends ElementBaseType {
|
|
1695
1796
|
/**
|
|
@@ -1712,7 +1813,7 @@ export interface QrcodeElementType extends ElementBaseType {
|
|
|
1712
1813
|
type FullFeaturedCardElementEvent = 'ready' | 'success' | 'error';
|
|
1713
1814
|
|
|
1714
1815
|
/**
|
|
1715
|
-
* @deprecated
|
|
1816
|
+
* @deprecated Use {@link DropInElementType} instead
|
|
1716
1817
|
*/
|
|
1717
1818
|
export interface FullFeaturedCardElementType extends ElementBaseType {
|
|
1718
1819
|
/**
|
|
@@ -1742,7 +1843,7 @@ export interface FullFeaturedCardElementType extends ElementBaseType {
|
|
|
1742
1843
|
|
|
1743
1844
|
export type RedirectElementEvent = 'ready' | 'success' | 'error';
|
|
1744
1845
|
/**
|
|
1745
|
-
* @deprecated
|
|
1846
|
+
* @deprecated Use {@link DropInElementType} instead
|
|
1746
1847
|
*/
|
|
1747
1848
|
export interface RedirectElementType extends ElementBaseType {
|
|
1748
1849
|
/**
|