airwallex-payment-elements 1.104.0 → 1.119.1
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/README.md +1 -1
- package/lib/bin/airwallex.cjs.js +2 -2
- package/lib/bin/airwallex.es.js +2 -2
- package/lib/bin/airwallex.iife.js +2 -2
- package/package.json +2 -2
- package/typedoc.config.js +5 -0
- package/types/airwallex.d.ts +36 -12
- package/types/dropInElement.d.ts +27 -5
- package/types/element.d.ts +201 -115
- package/types/events.d.ts +742 -0
- package/types/index.d.ts +1 -0
- package/types/qrcodeElement.d.ts +12 -1
package/types/element.d.ts
CHANGED
|
@@ -13,8 +13,20 @@ import {
|
|
|
13
13
|
VerifyConsentRequest,
|
|
14
14
|
PaymentConsentRequestData,
|
|
15
15
|
CreatePaymentMethodRequest,
|
|
16
|
+
PaymentConsentOptions,
|
|
16
17
|
} from './airwallex';
|
|
17
|
-
|
|
18
|
+
import {
|
|
19
|
+
ApplePayButtonEventCode,
|
|
20
|
+
ApplePayButtonEventHandler,
|
|
21
|
+
CardElementEventCode,
|
|
22
|
+
CardElementEventHandler,
|
|
23
|
+
DropInElementEventCode,
|
|
24
|
+
DropInElementEventHandler,
|
|
25
|
+
GooglePayButtonEventCode,
|
|
26
|
+
GooglePayButtonEventHandler,
|
|
27
|
+
SplitElementEventCode,
|
|
28
|
+
SplitElementEventHandler,
|
|
29
|
+
} from './events';
|
|
18
30
|
/**
|
|
19
31
|
* All the flows supported by Local Payment Methods.
|
|
20
32
|
*/
|
|
@@ -44,7 +56,7 @@ export type ElementType =
|
|
|
44
56
|
| 'fullFeaturedCard';
|
|
45
57
|
|
|
46
58
|
/**
|
|
47
|
-
* The payment method options for the redirect element. Integration with the payment method will redirect the shopper from the merchant's checkout site to the specific provider
|
|
59
|
+
* The payment method options for the redirect element. Integration with the payment method will redirect the shopper from the merchant's checkout site to the specific provider's authentication page.
|
|
48
60
|
*/
|
|
49
61
|
export type PaymentMethodWithRedirect =
|
|
50
62
|
| 'alipaycn'
|
|
@@ -129,7 +141,10 @@ export type PaymentMethodWithRedirect =
|
|
|
129
141
|
| 'upi'
|
|
130
142
|
| 'zip'
|
|
131
143
|
| 'spei'
|
|
132
|
-
| 'afterpay'
|
|
144
|
+
| 'afterpay'
|
|
145
|
+
| 'cash_app_pay'
|
|
146
|
+
| 'twint'
|
|
147
|
+
| 'laybuy';
|
|
133
148
|
|
|
134
149
|
export type DirectDebitPaymentMethod =
|
|
135
150
|
| 'ach_direct_debit'
|
|
@@ -376,8 +391,70 @@ export type SelectorAllowed =
|
|
|
376
391
|
export interface CSSProperties {
|
|
377
392
|
[CSSPropertyName: string]: string | number | undefined;
|
|
378
393
|
}
|
|
394
|
+
|
|
395
|
+
export interface Variables {
|
|
396
|
+
/**
|
|
397
|
+
* Sets the main accent color used for Elements such as text links, focus borders, interactive backgrounds, highlights, etc.
|
|
398
|
+
* @defaultValue `'#612fff'` (light mode) and `'#ABA8FF'` (dark mode)
|
|
399
|
+
*/
|
|
400
|
+
colorBrand?: string;
|
|
401
|
+
/**
|
|
402
|
+
* Sets the primary text color. This selection automatically expands to generate a comprehensive color set, including secondary text, inverse text, disabled text, placeholder text, and more.
|
|
403
|
+
* @defaultValue `'#14171a'` (light mode) and `'#F5F6F7'` (dark mode)
|
|
404
|
+
*/
|
|
405
|
+
colorText?: string;
|
|
406
|
+
/**
|
|
407
|
+
* Sets the primary background color. This option also generates a complete set of background colors, including primary, secondary, field, and disabled backgrounds.
|
|
408
|
+
* @defaultValue `'#ffffff'` (light mode) and `'#14171A'` (dark mode)
|
|
409
|
+
*/
|
|
410
|
+
colorBackground?: string;
|
|
411
|
+
}
|
|
412
|
+
|
|
379
413
|
export interface Appearance {
|
|
380
|
-
|
|
414
|
+
/**
|
|
415
|
+
* The appearance mode for the Element. Accepts `'dark'` or `'light'` modes where each mode provides a different color variable preset and color generation logic.
|
|
416
|
+
* @defaultValue `'light'`
|
|
417
|
+
*/
|
|
418
|
+
mode?: 'light' | 'dark';
|
|
419
|
+
/**
|
|
420
|
+
* Set variables to customize the Element's appearance. The following color variables are supported:
|
|
421
|
+
*
|
|
422
|
+
* - `colorBackground`: Sets the primary background color. This automatically generates a complete
|
|
423
|
+
* set of background colors including primary, secondary, field, and disabled backgrounds.
|
|
424
|
+
*
|
|
425
|
+
* - `colorBrand`: Sets the main accent color used for Elements such as buttons, text links, focus borders,
|
|
426
|
+
* interactive backgrounds, highlights, etc. This color defines your brand's visual identity in the Element.
|
|
427
|
+
*
|
|
428
|
+
* - `colorText`: Sets the primary text color. This automatically generates a complete set of
|
|
429
|
+
* text colors including secondary text, inverse text, disabled text, and placeholder text.
|
|
430
|
+
*
|
|
431
|
+
* All color values can be specified in either RGB or HEX format.
|
|
432
|
+
*/
|
|
433
|
+
variables?: Variables;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
interface GooglePayButtonCssSelector {
|
|
437
|
+
'.GooglePayButton'?: CSSProperties;
|
|
438
|
+
'.GooglePayButton:hover'?: CSSProperties;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export interface GooglePayButtonAppearance {
|
|
442
|
+
/**
|
|
443
|
+
* Set rules customize the appearance of the Google Pay button.
|
|
444
|
+
*/
|
|
445
|
+
rules?: GooglePayButtonCssSelector;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
interface ApplePayButtonCssSelector {
|
|
449
|
+
'.ApplePayButton'?: CSSProperties;
|
|
450
|
+
'.ApplePayButton:hover'?: CSSProperties;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export interface ApplePayButtonAppearance {
|
|
454
|
+
/**
|
|
455
|
+
* Set rules customize the appearance of the Apple Pay button.
|
|
456
|
+
*/
|
|
457
|
+
rules?: ApplePayButtonCssSelector;
|
|
381
458
|
}
|
|
382
459
|
|
|
383
460
|
/**
|
|
@@ -445,7 +522,7 @@ export interface CardElementOptions {
|
|
|
445
522
|
autoCapture?: boolean;
|
|
446
523
|
/**
|
|
447
524
|
* The authorization type for the card payment.
|
|
448
|
-
* Set it to `'pre_auth'` if you want to place a hold on your customer
|
|
525
|
+
* 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.
|
|
449
526
|
* `autoCapture` will be automatically set to `false` if you enable `'pre_auth'`.
|
|
450
527
|
* @defaultValue `'final_auth'`
|
|
451
528
|
*/
|
|
@@ -534,7 +611,7 @@ export interface ExpiryDateElementOptions {
|
|
|
534
611
|
*/
|
|
535
612
|
export interface CvcElementOptions {
|
|
536
613
|
/**
|
|
537
|
-
* Whether the `
|
|
614
|
+
* Whether the `CVC` Element input is disabled or not.
|
|
538
615
|
* @defaultValue `false`
|
|
539
616
|
*/
|
|
540
617
|
disabled?: boolean;
|
|
@@ -543,11 +620,11 @@ export interface CvcElementOptions {
|
|
|
543
620
|
*/
|
|
544
621
|
placeholder?: string;
|
|
545
622
|
/**
|
|
546
|
-
* Indicate
|
|
623
|
+
* Indicate CVC length.
|
|
547
624
|
*/
|
|
548
625
|
cvcLength?: number;
|
|
549
626
|
/**
|
|
550
|
-
* Style for the
|
|
627
|
+
* Style for the CVC Element.
|
|
551
628
|
*/
|
|
552
629
|
style?: InputStyle;
|
|
553
630
|
/**
|
|
@@ -555,10 +632,15 @@ export interface CvcElementOptions {
|
|
|
555
632
|
*/
|
|
556
633
|
authFormContainer?: string;
|
|
557
634
|
/**
|
|
558
|
-
* Whether
|
|
635
|
+
* Whether CVC Element works alone or not.
|
|
559
636
|
* If you want to use the CVC Element for a saved Payment Consent, you could set it `true` to improve the checkout experience.
|
|
560
637
|
*/
|
|
561
638
|
isStandalone?: boolean;
|
|
639
|
+
/**
|
|
640
|
+
* Whether the CVC input is masked
|
|
641
|
+
* @defaultValue `false`
|
|
642
|
+
*/
|
|
643
|
+
isMasked?: boolean;
|
|
562
644
|
}
|
|
563
645
|
|
|
564
646
|
/**
|
|
@@ -595,7 +677,7 @@ export interface FullFeaturedCardElementOptions {
|
|
|
595
677
|
autoCapture?: boolean;
|
|
596
678
|
/**
|
|
597
679
|
* The authorization type for the card payment.
|
|
598
|
-
* Set it to `'pre_auth'` if you want to place a hold on your customer
|
|
680
|
+
* 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.
|
|
599
681
|
* `autoCapture` will be automatically set to `false` if you enable `'pre_auth'`.
|
|
600
682
|
* @defaultValue `'final_auth'`
|
|
601
683
|
*/
|
|
@@ -630,6 +712,10 @@ export interface FullFeaturedCardElementOptions {
|
|
|
630
712
|
* The options for the recurring flow. Required when `mode` is `'recurring'`.
|
|
631
713
|
*/
|
|
632
714
|
recurringOptions?: RecurringOptions;
|
|
715
|
+
/**
|
|
716
|
+
* Options for PaymentConsent.
|
|
717
|
+
*/
|
|
718
|
+
payment_consent?: PaymentConsentOptions;
|
|
633
719
|
/**
|
|
634
720
|
* Specifies whether the card payment method should be automatically saved for future transactions.
|
|
635
721
|
*
|
|
@@ -662,7 +748,7 @@ export interface ApplePayRecurringLineItem {
|
|
|
662
748
|
recurringPaymentIntervalCount: number;
|
|
663
749
|
recurringPaymentEndDate: Date;
|
|
664
750
|
}
|
|
665
|
-
|
|
751
|
+
type ApplePayBillingContactField = 'postalAddress';
|
|
666
752
|
export interface ApplePayRequestOriginalOptions {
|
|
667
753
|
/**
|
|
668
754
|
* The merchant's two-letter ISO 3166 country code. For example, 'US'.
|
|
@@ -680,9 +766,9 @@ export interface ApplePayRequestOriginalOptions {
|
|
|
680
766
|
billingContact?: ApplePayJS.ApplePayPaymentContact;
|
|
681
767
|
|
|
682
768
|
/**
|
|
683
|
-
* The billing information that you require from the shopper in order to process the transaction.
|
|
769
|
+
* The billing information that you require from the shopper in order to process the transaction. Only postalAddress is supported. If you need to collect name, email, phone, you need to add requiredShippingContactFields config. e.g. requiredShippingContactFields: ['name', 'email', 'phone']
|
|
684
770
|
*/
|
|
685
|
-
requiredBillingContactFields?:
|
|
771
|
+
requiredBillingContactFields?: ApplePayBillingContactField[];
|
|
686
772
|
|
|
687
773
|
/**
|
|
688
774
|
* The shipping information that you require from the shopper in order to fulfill the order.
|
|
@@ -738,10 +824,13 @@ export interface GooglePayRequestOptions {
|
|
|
738
824
|
* The two-letter ISO-3166 country code.
|
|
739
825
|
*/
|
|
740
826
|
countryCode: string;
|
|
827
|
+
/**
|
|
828
|
+
* The merchant account ID in Airwallex. It is required for Google Pay Express Checkout Element.
|
|
829
|
+
*/
|
|
830
|
+
gatewayMerchantId?: string;
|
|
741
831
|
/**
|
|
742
832
|
* Detailed information about the merchant.
|
|
743
833
|
*/
|
|
744
|
-
|
|
745
834
|
merchantInfo?: {
|
|
746
835
|
/**
|
|
747
836
|
* Merchant name encoded as UTF-8.
|
|
@@ -904,9 +993,9 @@ export interface GooglePayRequestOptions {
|
|
|
904
993
|
*/
|
|
905
994
|
export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
906
995
|
/**
|
|
907
|
-
*
|
|
996
|
+
* Customize the appearance of the Google Pay button.
|
|
908
997
|
*/
|
|
909
|
-
appearance?:
|
|
998
|
+
appearance?: GooglePayButtonAppearance;
|
|
910
999
|
/**
|
|
911
1000
|
* Box style and 3ds popUp style for the GooglePayButton Element.
|
|
912
1001
|
*/
|
|
@@ -945,7 +1034,7 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
|
945
1034
|
autoCapture?: boolean;
|
|
946
1035
|
/**
|
|
947
1036
|
* The authorization type for the card payment. Options include: `"pre_auth"`, `"final_auth"`.
|
|
948
|
-
* Set it to `"pre_auth"` if you want to place a hold on your customer
|
|
1037
|
+
* 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.
|
|
949
1038
|
* `autoCapture` will be automatically set to `false` if you enable `pre_auth`.
|
|
950
1039
|
*
|
|
951
1040
|
* @defaultValue `'final_auth'`
|
|
@@ -961,6 +1050,10 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
|
961
1050
|
* Note: This field is currently available for web only.
|
|
962
1051
|
*/
|
|
963
1052
|
error?: google.payments.api.PaymentDataError;
|
|
1053
|
+
/**
|
|
1054
|
+
* Options for PaymentConsent.
|
|
1055
|
+
*/
|
|
1056
|
+
payment_consent?: PaymentConsentOptions;
|
|
964
1057
|
}
|
|
965
1058
|
|
|
966
1059
|
type GooglePayNextActionOptions = Pick<
|
|
@@ -1102,6 +1195,10 @@ interface Amount {
|
|
|
1102
1195
|
* Applies to `applePayButton` element type integration, the interface used when `createElement()` is called with type `applePayButton`.
|
|
1103
1196
|
*/
|
|
1104
1197
|
export interface ApplePayButtonOptions extends ApplePayRequestOptions {
|
|
1198
|
+
/**
|
|
1199
|
+
* Customize the appearance of the Apple Pay button.
|
|
1200
|
+
*/
|
|
1201
|
+
appearance?: ApplePayButtonAppearance;
|
|
1105
1202
|
/**
|
|
1106
1203
|
* The ID of the Payment Intent you would like to checkout.
|
|
1107
1204
|
*
|
|
@@ -1144,20 +1241,20 @@ export interface ApplePayButtonOptions extends ApplePayRequestOptions {
|
|
|
1144
1241
|
/**
|
|
1145
1242
|
* The authorization type for the card payment.
|
|
1146
1243
|
*
|
|
1147
|
-
* Set it to `'pre_auth'` if you want to place a hold on your customer
|
|
1244
|
+
* 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.
|
|
1148
1245
|
*
|
|
1149
1246
|
* 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`.
|
|
1150
1247
|
* @defaultValue `'final_auth'`
|
|
1151
1248
|
*/
|
|
1152
1249
|
authorizationType?: AuthorizationType;
|
|
1153
|
-
/**
|
|
1154
|
-
* The layout of each element stays consistent, but you can modify width, height, and more.
|
|
1155
|
-
*/
|
|
1156
|
-
appearance?: Appearance;
|
|
1157
1250
|
/**
|
|
1158
1251
|
* Box style for the ApplePayButton Element.
|
|
1159
1252
|
*/
|
|
1160
1253
|
style?: CSSProperties;
|
|
1254
|
+
/**
|
|
1255
|
+
* Options for PaymentConsent.
|
|
1256
|
+
*/
|
|
1257
|
+
payment_consent?: PaymentConsentOptions;
|
|
1161
1258
|
}
|
|
1162
1259
|
|
|
1163
1260
|
export interface ApplePayButtonUpdateOptions extends ApplePayButtonOptions {
|
|
@@ -1214,7 +1311,7 @@ export interface Element {
|
|
|
1214
1311
|
/**
|
|
1215
1312
|
* Element integration `step #3`
|
|
1216
1313
|
*
|
|
1217
|
-
* Mounts
|
|
1314
|
+
* Mounts Element to your HTML DOM.
|
|
1218
1315
|
*/
|
|
1219
1316
|
mount(domElement: string | HTMLElement): null | HTMLElement;
|
|
1220
1317
|
/**
|
|
@@ -1232,7 +1329,7 @@ export interface Element {
|
|
|
1232
1329
|
*/
|
|
1233
1330
|
focus(): void;
|
|
1234
1331
|
/**
|
|
1235
|
-
* Unmounts the Element
|
|
1332
|
+
* Unmounts the Element. Note that the Element instance will remain.
|
|
1236
1333
|
*/
|
|
1237
1334
|
unmount(): void;
|
|
1238
1335
|
/**
|
|
@@ -1300,7 +1397,6 @@ interface ElementBaseType {
|
|
|
1300
1397
|
destroy(): void;
|
|
1301
1398
|
}
|
|
1302
1399
|
|
|
1303
|
-
type CardElementEvent = 'ready' | 'click' | 'focus' | 'blur' | 'change';
|
|
1304
1400
|
/**
|
|
1305
1401
|
* Functions and external fields can be used in your integration flow with Airwallex Payment Elements.
|
|
1306
1402
|
*/
|
|
@@ -1330,7 +1426,7 @@ export interface CardElementType extends ElementBaseType {
|
|
|
1330
1426
|
*/
|
|
1331
1427
|
focus(): void;
|
|
1332
1428
|
/**
|
|
1333
|
-
*
|
|
1429
|
+
* Call this function to create a Payment Consent, which represents the agreement between the merchant and shopper of making subsequent payments using the provided payment method.
|
|
1334
1430
|
* @param data - Payment consent request payload
|
|
1335
1431
|
* @example
|
|
1336
1432
|
* ```ts
|
|
@@ -1380,16 +1476,14 @@ export interface CardElementType extends ElementBaseType {
|
|
|
1380
1476
|
* @param handler - The event handler
|
|
1381
1477
|
* @example
|
|
1382
1478
|
* ```ts
|
|
1383
|
-
* element.on('
|
|
1384
|
-
* // Handle
|
|
1479
|
+
* element.on('submit', () => {
|
|
1480
|
+
* // Handle submit event
|
|
1385
1481
|
* });
|
|
1386
1482
|
* ```
|
|
1387
1483
|
*/
|
|
1388
|
-
on(
|
|
1484
|
+
on<T extends CardElementEventCode>(eventCode: T, handler: CardElementEventHandler<T>): void;
|
|
1389
1485
|
}
|
|
1390
1486
|
|
|
1391
|
-
export type CardNumberElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
|
|
1392
|
-
|
|
1393
1487
|
/**
|
|
1394
1488
|
* Functions and external fields can be used in your integration flow with Airwallex Payment Elements.
|
|
1395
1489
|
*/
|
|
@@ -1419,7 +1513,7 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1419
1513
|
*/
|
|
1420
1514
|
focus(): void;
|
|
1421
1515
|
/**
|
|
1422
|
-
*
|
|
1516
|
+
* Call this function to create a Payment Consent, which represents the agreement between the merchant and shopper of making subsequent payments using the provided payment method.
|
|
1423
1517
|
* @example
|
|
1424
1518
|
* ```ts
|
|
1425
1519
|
* element.createPaymentConsent({
|
|
@@ -1440,7 +1534,7 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1440
1534
|
*/
|
|
1441
1535
|
verifyConsent(data: VerifyConsentRequest): Promise<PaymentConsentResponse | boolean>;
|
|
1442
1536
|
/**
|
|
1443
|
-
*
|
|
1537
|
+
* Call this function when the shopper is ready to make a payment as per the details in the Payment Intent.
|
|
1444
1538
|
*
|
|
1445
1539
|
* Confirms the Payment Intent.
|
|
1446
1540
|
*@example
|
|
@@ -1469,7 +1563,7 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1469
1563
|
*/
|
|
1470
1564
|
createPaymentMethod(data: CreatePaymentMethodRequest): Promise<PaymentMethodBasicInfo>;
|
|
1471
1565
|
/**
|
|
1472
|
-
*
|
|
1566
|
+
* Call this function to update Element options after creating the Element.
|
|
1473
1567
|
* @example
|
|
1474
1568
|
* ```ts
|
|
1475
1569
|
* element.update({
|
|
@@ -1479,20 +1573,20 @@ export interface CardNumberElementType extends ElementBaseType {
|
|
|
1479
1573
|
*/
|
|
1480
1574
|
update(options?: Partial<CardNumberElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1481
1575
|
/**
|
|
1482
|
-
* Listen to
|
|
1483
|
-
*
|
|
1576
|
+
* Listen to Element events.
|
|
1577
|
+
* @param eventCode - The event code to listen for.
|
|
1578
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1484
1579
|
* @example
|
|
1485
1580
|
* ```ts
|
|
1486
|
-
* element.on('change', () => {
|
|
1581
|
+
* element.on('change', (e) => {
|
|
1582
|
+
* const { completed, empty, error } = e.detail;
|
|
1487
1583
|
* // Handle change event
|
|
1488
1584
|
* });
|
|
1489
1585
|
* ```
|
|
1490
1586
|
*/
|
|
1491
|
-
on(
|
|
1587
|
+
on<T extends SplitElementEventCode>(eventCode: T, handler: SplitElementEventHandler<T>): void;
|
|
1492
1588
|
}
|
|
1493
1589
|
|
|
1494
|
-
export type ExpiryElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey';
|
|
1495
|
-
|
|
1496
1590
|
/**
|
|
1497
1591
|
* Functions and external fields can be used in your integration flow with Airwallex element
|
|
1498
1592
|
*/
|
|
@@ -1522,7 +1616,7 @@ export interface ExpiryDateElementType extends ElementBaseType {
|
|
|
1522
1616
|
*/
|
|
1523
1617
|
focus(): void;
|
|
1524
1618
|
/**
|
|
1525
|
-
*
|
|
1619
|
+
* Call this function to update Element options after creating the Element.
|
|
1526
1620
|
* @example
|
|
1527
1621
|
* ```ts
|
|
1528
1622
|
* element.update({
|
|
@@ -1532,20 +1626,20 @@ export interface ExpiryDateElementType extends ElementBaseType {
|
|
|
1532
1626
|
*/
|
|
1533
1627
|
update(options?: Partial<ExpiryDateElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1534
1628
|
/**
|
|
1535
|
-
* Listen to
|
|
1536
|
-
*
|
|
1629
|
+
* Listen to Element events.
|
|
1630
|
+
* @param eventCode - The event code to listen for.
|
|
1631
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1537
1632
|
* @example
|
|
1538
1633
|
* ```ts
|
|
1539
|
-
* element.on('change', () => {
|
|
1634
|
+
* element.on('change', (e) => {
|
|
1635
|
+
* const { completed, empty, error } = e.detail;
|
|
1540
1636
|
* // Handle change event
|
|
1541
1637
|
* });
|
|
1542
1638
|
* ```
|
|
1543
1639
|
*/
|
|
1544
|
-
on(
|
|
1640
|
+
on<T extends SplitElementEventCode>(eventCode: T, handler: SplitElementEventHandler<T>): void;
|
|
1545
1641
|
}
|
|
1546
1642
|
|
|
1547
|
-
export type CvcElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
|
|
1548
|
-
|
|
1549
1643
|
/**
|
|
1550
1644
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1551
1645
|
*/
|
|
@@ -1575,7 +1669,7 @@ export interface CvcElementType extends ElementBaseType {
|
|
|
1575
1669
|
*/
|
|
1576
1670
|
focus(): void;
|
|
1577
1671
|
/**
|
|
1578
|
-
*
|
|
1672
|
+
* Call this function when the shopper is ready to make a payment as per the details in the Payment Intent.
|
|
1579
1673
|
* @example
|
|
1580
1674
|
* ```ts
|
|
1581
1675
|
* element.confirm({
|
|
@@ -1585,7 +1679,7 @@ export interface CvcElementType extends ElementBaseType {
|
|
|
1585
1679
|
*/
|
|
1586
1680
|
confirm(data: PaymentMethodRequestData): Promise<Intent>;
|
|
1587
1681
|
/**
|
|
1588
|
-
*
|
|
1682
|
+
* Call this function to create a Payment Consent, which represents the agreement between the merchant and shopper of making subsequent payments using the provided payment method.
|
|
1589
1683
|
* @example
|
|
1590
1684
|
* ```ts
|
|
1591
1685
|
* element.createPaymentConsent({
|
|
@@ -1595,7 +1689,7 @@ export interface CvcElementType extends ElementBaseType {
|
|
|
1595
1689
|
*/
|
|
1596
1690
|
createPaymentConsent(data: PaymentConsentRequestData): Promise<PaymentConsentResponse>;
|
|
1597
1691
|
/**
|
|
1598
|
-
*
|
|
1692
|
+
* Call this function to update Element options after creating the Element.
|
|
1599
1693
|
* @example
|
|
1600
1694
|
* ```ts
|
|
1601
1695
|
* element.update({
|
|
@@ -1605,29 +1699,20 @@ export interface CvcElementType extends ElementBaseType {
|
|
|
1605
1699
|
*/
|
|
1606
1700
|
update(options?: Partial<CvcElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1607
1701
|
/**
|
|
1608
|
-
* Listen to
|
|
1609
|
-
*
|
|
1702
|
+
* Listen to Element events.
|
|
1703
|
+
* @param eventCode - The event code to listen for.
|
|
1704
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1610
1705
|
* @example
|
|
1611
1706
|
* ```ts
|
|
1612
|
-
* element.on('change', () => {
|
|
1707
|
+
* element.on('change', (e) => {
|
|
1708
|
+
* const { completed, empty, error } = e.detail;
|
|
1613
1709
|
* // Handle change event
|
|
1614
1710
|
* });
|
|
1615
1711
|
* ```
|
|
1616
1712
|
*/
|
|
1617
|
-
on(
|
|
1713
|
+
on<T extends SplitElementEventCode>(eventCode: T, handler: SplitElementEventHandler<T>): void;
|
|
1618
1714
|
}
|
|
1619
1715
|
|
|
1620
|
-
export type ApplePayButtonEvent =
|
|
1621
|
-
| 'ready'
|
|
1622
|
-
| 'click'
|
|
1623
|
-
| 'shippingMethodChange'
|
|
1624
|
-
| 'shippingAddressChange'
|
|
1625
|
-
| 'validateMerchant'
|
|
1626
|
-
| 'authorized'
|
|
1627
|
-
| 'cancel'
|
|
1628
|
-
| 'success'
|
|
1629
|
-
| 'error';
|
|
1630
|
-
|
|
1631
1716
|
interface ParameterObject {
|
|
1632
1717
|
/**
|
|
1633
1718
|
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
@@ -1635,12 +1720,24 @@ interface ParameterObject {
|
|
|
1635
1720
|
client_secret: string;
|
|
1636
1721
|
}
|
|
1637
1722
|
|
|
1723
|
+
interface ConfirmIntentData {
|
|
1724
|
+
/**
|
|
1725
|
+
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
1726
|
+
*/
|
|
1727
|
+
client_secret: string;
|
|
1728
|
+
|
|
1729
|
+
/**
|
|
1730
|
+
* Options for PaymentConsent.
|
|
1731
|
+
*/
|
|
1732
|
+
payment_consent?: PaymentConsentOptions;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1638
1735
|
/**
|
|
1639
1736
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1640
1737
|
*/
|
|
1641
1738
|
export interface ApplePayButtonElementType extends ElementBaseType {
|
|
1642
1739
|
/**
|
|
1643
|
-
*
|
|
1740
|
+
* Call this function to update Element options after creating the Element.
|
|
1644
1741
|
* @example
|
|
1645
1742
|
* ```ts
|
|
1646
1743
|
* element.update({
|
|
@@ -1653,18 +1750,20 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1653
1750
|
update(options?: Partial<ApplePayButtonUpdateOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1654
1751
|
|
|
1655
1752
|
/**
|
|
1656
|
-
* Listen to
|
|
1657
|
-
*
|
|
1753
|
+
* Listen to Element events.
|
|
1754
|
+
* @param eventCode - The event code to listen for.
|
|
1755
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1658
1756
|
* @example
|
|
1659
1757
|
* ```ts
|
|
1660
|
-
* element.on('success', () => {
|
|
1758
|
+
* element.on('success', (e) => {
|
|
1759
|
+
* const { intent } = e.detail;
|
|
1661
1760
|
* // Handle success event
|
|
1662
1761
|
* });
|
|
1663
1762
|
* ```
|
|
1664
1763
|
*/
|
|
1665
|
-
on(
|
|
1764
|
+
on<T extends ApplePayButtonEventCode>(eventCode: T, handler: ApplePayButtonEventHandler<T>): void;
|
|
1666
1765
|
/**
|
|
1667
|
-
*
|
|
1766
|
+
* Call this function when the shopper is ready to make a payment as per the details in the Payment Intent.
|
|
1668
1767
|
* @example
|
|
1669
1768
|
* ```ts
|
|
1670
1769
|
* element.confirmIntent({
|
|
@@ -1672,9 +1771,9 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1672
1771
|
* });
|
|
1673
1772
|
* ```
|
|
1674
1773
|
*/
|
|
1675
|
-
confirmIntent(data:
|
|
1774
|
+
confirmIntent(data: ConfirmIntentData): Promise<Intent>;
|
|
1676
1775
|
/**
|
|
1677
|
-
*
|
|
1776
|
+
* Call this function to create a Payment Consent, which represents the agreement between the merchant and shopper of making subsequent payments using the provided payment method.
|
|
1678
1777
|
* @example
|
|
1679
1778
|
* ```ts
|
|
1680
1779
|
* element.createPaymentConsent({
|
|
@@ -1706,21 +1805,12 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1706
1805
|
completeValidation(merchantSession: unknown): void;
|
|
1707
1806
|
}
|
|
1708
1807
|
|
|
1709
|
-
export type DropInElementEvent =
|
|
1710
|
-
| 'ready'
|
|
1711
|
-
| 'clickConfirmButton'
|
|
1712
|
-
| 'cancel'
|
|
1713
|
-
| 'success'
|
|
1714
|
-
| 'error'
|
|
1715
|
-
| 'switchMethod'
|
|
1716
|
-
| 'pendingVerifyAccount';
|
|
1717
|
-
|
|
1718
1808
|
/**
|
|
1719
1809
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1720
1810
|
*/
|
|
1721
1811
|
export interface DropInElementType extends ElementBaseType {
|
|
1722
1812
|
/**
|
|
1723
|
-
*
|
|
1813
|
+
* Call this function to update Element options after creating the Element.
|
|
1724
1814
|
* @example
|
|
1725
1815
|
* ```ts
|
|
1726
1816
|
* element.update({
|
|
@@ -1732,33 +1822,26 @@ export interface DropInElementType extends ElementBaseType {
|
|
|
1732
1822
|
*/
|
|
1733
1823
|
update(options?: Partial<DropInElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1734
1824
|
/**
|
|
1735
|
-
* Listen to
|
|
1736
|
-
*
|
|
1825
|
+
* Listen to the Element events.
|
|
1826
|
+
* @param eventCode - The event code to listen for.
|
|
1827
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1737
1828
|
* @example
|
|
1738
1829
|
* ```ts
|
|
1739
|
-
* element.on('success', () => {
|
|
1740
|
-
*
|
|
1830
|
+
* element.on('success', (e) => {
|
|
1831
|
+
* const { intent } = e.detail;
|
|
1832
|
+
* // Handle success event
|
|
1741
1833
|
* });
|
|
1742
1834
|
* ```
|
|
1743
1835
|
*/
|
|
1744
|
-
on(
|
|
1836
|
+
on<T extends DropInElementEventCode>(eventCode: T, handler: DropInElementEventHandler<T>): void;
|
|
1745
1837
|
}
|
|
1746
1838
|
|
|
1747
|
-
export type GooglePayButtonEvent =
|
|
1748
|
-
| 'ready'
|
|
1749
|
-
| 'click'
|
|
1750
|
-
| 'cancel'
|
|
1751
|
-
| 'success'
|
|
1752
|
-
| 'error'
|
|
1753
|
-
| 'authorized'
|
|
1754
|
-
| 'shippingAddressChange'
|
|
1755
|
-
| 'shippingMethodChange';
|
|
1756
1839
|
/**
|
|
1757
1840
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1758
1841
|
*/
|
|
1759
1842
|
export interface GooglePayButtonElementType extends ElementBaseType {
|
|
1760
1843
|
/**
|
|
1761
|
-
*
|
|
1844
|
+
* Call this function to update Element options after creating the Element.
|
|
1762
1845
|
* @example
|
|
1763
1846
|
* ```ts
|
|
1764
1847
|
* element.update({
|
|
@@ -1772,19 +1855,21 @@ export interface GooglePayButtonElementType extends ElementBaseType {
|
|
|
1772
1855
|
update(options?: Partial<GooglePayButtonOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1773
1856
|
|
|
1774
1857
|
/**
|
|
1775
|
-
* Listen to
|
|
1776
|
-
*
|
|
1858
|
+
* Listen to Element events.
|
|
1859
|
+
* @param eventCode - The event code to listen for.
|
|
1860
|
+
* @param handler - The callback function that will be called when the event occurs.
|
|
1777
1861
|
* @example
|
|
1778
1862
|
* ```ts
|
|
1779
|
-
* element.on('success', () => {
|
|
1780
|
-
*
|
|
1863
|
+
* element.on('success', (e) => {
|
|
1864
|
+
* const { intent } = e.detail;
|
|
1865
|
+
* // Handle success event
|
|
1781
1866
|
* });
|
|
1782
1867
|
* ```
|
|
1783
1868
|
*/
|
|
1784
|
-
on(
|
|
1869
|
+
on<T extends GooglePayButtonEventCode>(eventCode: T, handler: GooglePayButtonEventHandler<T>): void;
|
|
1785
1870
|
|
|
1786
1871
|
/**
|
|
1787
|
-
*
|
|
1872
|
+
* Call this function when the shopper is ready to make a payment as per the details in the Payment Intent.
|
|
1788
1873
|
* @example
|
|
1789
1874
|
* ```ts
|
|
1790
1875
|
* element.confirmIntent({
|
|
@@ -1792,9 +1877,9 @@ export interface GooglePayButtonElementType extends ElementBaseType {
|
|
|
1792
1877
|
* });
|
|
1793
1878
|
* ```
|
|
1794
1879
|
*/
|
|
1795
|
-
confirmIntent(data:
|
|
1880
|
+
confirmIntent(data: ConfirmIntentData): Promise<Intent>;
|
|
1796
1881
|
/**
|
|
1797
|
-
*
|
|
1882
|
+
* Call this function to create a Payment Consent, which represents the agreement between the merchant and shopper of making subsequent payments using the provided payment method.
|
|
1798
1883
|
* @example
|
|
1799
1884
|
* ```ts
|
|
1800
1885
|
* element.createPaymentConsent({
|
|
@@ -1811,7 +1896,7 @@ export type WechatElementEvent = 'ready' | 'success' | 'error';
|
|
|
1811
1896
|
*/
|
|
1812
1897
|
export interface WechatElementType extends ElementBaseType {
|
|
1813
1898
|
/**
|
|
1814
|
-
*
|
|
1899
|
+
* Call this function to update Element options after creating the Element.
|
|
1815
1900
|
* @example
|
|
1816
1901
|
* ```ts
|
|
1817
1902
|
* element.update({
|
|
@@ -1824,7 +1909,7 @@ export interface WechatElementType extends ElementBaseType {
|
|
|
1824
1909
|
*/
|
|
1825
1910
|
update(options?: Partial<WechatElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1826
1911
|
/**
|
|
1827
|
-
* Listen to
|
|
1912
|
+
* Listen to Element events.
|
|
1828
1913
|
*
|
|
1829
1914
|
* @example
|
|
1830
1915
|
* ```ts
|
|
@@ -1842,7 +1927,7 @@ export type QrcodeElementEvent = 'ready' | 'success' | 'error';
|
|
|
1842
1927
|
*/
|
|
1843
1928
|
export interface QrcodeElementType extends ElementBaseType {
|
|
1844
1929
|
/**
|
|
1845
|
-
*
|
|
1930
|
+
* Call this function to update Element options after creating the Element.
|
|
1846
1931
|
* @example
|
|
1847
1932
|
* ```ts
|
|
1848
1933
|
* element.update({
|
|
@@ -1854,7 +1939,7 @@ export interface QrcodeElementType extends ElementBaseType {
|
|
|
1854
1939
|
*/
|
|
1855
1940
|
update(options?: Partial<QrcodeElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1856
1941
|
/**
|
|
1857
|
-
* Listen to
|
|
1942
|
+
* Listen to Element events.
|
|
1858
1943
|
*
|
|
1859
1944
|
* @example
|
|
1860
1945
|
* ```ts
|
|
@@ -1873,7 +1958,7 @@ type FullFeaturedCardElementEvent = 'ready' | 'success' | 'error';
|
|
|
1873
1958
|
*/
|
|
1874
1959
|
export interface FullFeaturedCardElementType extends ElementBaseType {
|
|
1875
1960
|
/**
|
|
1876
|
-
*
|
|
1961
|
+
* Call this function to update Element options after creating the Element.
|
|
1877
1962
|
* @example
|
|
1878
1963
|
* ```ts
|
|
1879
1964
|
* element.update({
|
|
@@ -1885,7 +1970,7 @@ export interface FullFeaturedCardElementType extends ElementBaseType {
|
|
|
1885
1970
|
*/
|
|
1886
1971
|
update(options?: Partial<FullFeaturedCardElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1887
1972
|
/**
|
|
1888
|
-
* Listen to
|
|
1973
|
+
* Listen to Element events.
|
|
1889
1974
|
* @example
|
|
1890
1975
|
* ```ts
|
|
1891
1976
|
* element.on('change', () => {
|
|
@@ -1902,15 +1987,16 @@ export type RedirectElementEvent = 'ready' | 'success' | 'error';
|
|
|
1902
1987
|
*/
|
|
1903
1988
|
export interface RedirectElementType extends ElementBaseType {
|
|
1904
1989
|
/**
|
|
1905
|
-
*
|
|
1990
|
+
* Call this function to update Element options after creating the Element.
|
|
1906
1991
|
*/
|
|
1907
1992
|
update(options?: Partial<RedirectElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1908
1993
|
/**
|
|
1909
|
-
* Listen to
|
|
1994
|
+
* Listen to Element events.
|
|
1910
1995
|
*
|
|
1911
1996
|
* @example
|
|
1912
1997
|
* ```ts
|
|
1913
|
-
* element.on('change', () => {
|
|
1998
|
+
* element.on('change', (e) => {
|
|
1999
|
+
* const { completed, empty, error } = e.detail;
|
|
1914
2000
|
* // Handle change event
|
|
1915
2001
|
* });
|
|
1916
2002
|
* ```
|