airwallex-payment-elements 1.25.0 → 1.40.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/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 +1 -1
- package/types/airwallex.d.ts +41 -11
- package/types/dropInElement.d.ts +6 -0
- package/types/element.d.ts +542 -13
- package/types/index.d.ts +4 -0
package/lib/bin/airwallex.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,t="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.40.0] */
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,t="/assets/elements.bundle.min.js?version=1.40.0",o=e=>{const r=document.createElement("script");r.src=`${e}${t}`,r.crossOrigin="anonymous";const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r},n=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const l=async()=>{const n=document.querySelector(`script[src="${t}"], script[src="${t}/"]`)||o(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,t)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):t(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{t(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await l()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},l=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},a=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},i=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),w=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),d=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},c=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},m=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},y=e=>window.Airwallex.getDeviceFingerprint(e);var u={getGatewayUrl:r,loadAirwallex:n,loadAirwallexJs:o,init:l,redirectToCheckout:a,createElement:i,destroyElement:w,getDeviceFingerprint:y,getElement:d,getPaymentIntent:m,createPaymentMethod:x,createPaymentConsent:A,confirmPaymentIntent:s,confirmPaymentIntentWithSavedCard:c};exports.confirmPaymentIntent=s,exports.confirmPaymentIntentWithSavedCard=c,exports.createElement=i,exports.createPaymentConsent=A,exports.createPaymentMethod=x,exports.default=u,exports.destroyElement=w,exports.getDeviceFingerprint=y,exports.getElement=d,exports.getGatewayUrl=r,exports.getPaymentIntent=m,exports.init=l,exports.loadAirwallex=n,exports.loadAirwallexJs=o,exports.redirectToCheckout=a;
|
|
3
3
|
//# sourceMappingURL=airwallex.cjs.js.map
|
package/lib/bin/airwallex.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.40.0] */
|
|
2
|
+
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js?version=1.40.0",n=e=>{const r=document.createElement("script");r.src=`${e}${o}`,r.crossOrigin="anonymous";const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r},l=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let l=0;const t=async()=>{const l=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||n(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{l.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),l.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),l.remove&&l.remove()}))}))};for(;l<3;)try{return await t()}catch(e){l++,await new Promise((e=>window.setTimeout(e,500)))}return null},t=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},a=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},i=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),w=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),d=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),c=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},m=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},u=e=>window.Airwallex.getDeviceFingerprint(e);var y={getGatewayUrl:r,loadAirwallex:l,loadAirwallexJs:n,init:t,redirectToCheckout:a,createElement:i,destroyElement:w,getDeviceFingerprint:u,getElement:d,getPaymentIntent:x,createPaymentMethod:m,createPaymentConsent:A,confirmPaymentIntent:c,confirmPaymentIntentWithSavedCard:s};export default y;export{c as confirmPaymentIntent,s as confirmPaymentIntentWithSavedCard,i as createElement,A as createPaymentConsent,m as createPaymentMethod,w as destroyElement,u as getDeviceFingerprint,d as getElement,r as getGatewayUrl,x as getPaymentIntent,t as init,l as loadAirwallex,n as loadAirwallexJs,a as redirectToCheckout};
|
|
3
3
|
//# sourceMappingURL=airwallex.es.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,t="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.40.0] */
|
|
2
|
+
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,t="/assets/elements.bundle.min.js?version=1.40.0",o=e=>{const r=document.createElement("script");r.src=`${e}${t}`,r.crossOrigin="anonymous";const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r},l=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let r=0;const l=async()=>{const r=document.querySelector(`script[src="${t}"], script[src="${t}/"]`)||o(n((null==e?void 0:e.env)||"prod"));return new Promise(((n,t)=>{r.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):t(new Error("Failed to load Airwallex on load event"))})),r.addEventListener("error",(()=>{t(new Error("Failed to load Airwallex scripts")),r.remove&&r.remove()}))}))};for(;r<3;)try{return await l()}catch(e){r++,await new Promise((e=>window.setTimeout(e,500)))}return null},a=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},i=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},w=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),d=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),c=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},m=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},A=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},u=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},y=e=>window.Airwallex.getDeviceFingerprint(e);var f={getGatewayUrl:n,loadAirwallex:l,loadAirwallexJs:o,init:a,redirectToCheckout:i,createElement:w,destroyElement:d,getDeviceFingerprint:y,getElement:c,getPaymentIntent:A,createPaymentMethod:x,createPaymentConsent:u,confirmPaymentIntent:s,confirmPaymentIntentWithSavedCard:m};return e.confirmPaymentIntent=s,e.confirmPaymentIntentWithSavedCard=m,e.createElement=w,e.createPaymentConsent=u,e.createPaymentMethod=x,e.default=f,e.destroyElement=d,e.getDeviceFingerprint=y,e.getElement=c,e.getGatewayUrl=n,e.getPaymentIntent=A,e.init=a,e.loadAirwallex=l,e.loadAirwallexJs=o,e.redirectToCheckout=i,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
3
3
|
//# sourceMappingURL=airwallex.iife.js.map
|
package/package.json
CHANGED
package/types/airwallex.d.ts
CHANGED
|
@@ -9,6 +9,17 @@ import {
|
|
|
9
9
|
WechatElementOptions,
|
|
10
10
|
ApplePayButtonOptions,
|
|
11
11
|
GooglePayButtonOptions,
|
|
12
|
+
ApplePayButtonElementType,
|
|
13
|
+
GooglePayButtonElementType,
|
|
14
|
+
CardElementType,
|
|
15
|
+
DropInElementType,
|
|
16
|
+
CardNumberElementType,
|
|
17
|
+
ExpiryDateElementType,
|
|
18
|
+
CvcElementType,
|
|
19
|
+
WechatElementType,
|
|
20
|
+
FullFeaturedCardElementType,
|
|
21
|
+
RedirectElementType,
|
|
22
|
+
QrcodeElementType,
|
|
12
23
|
} from './element';
|
|
13
24
|
import { QrcodeElementOptions } from './qrcodeElement';
|
|
14
25
|
import { Intent, PaymentMethodBasicInfo } from './cardNumber';
|
|
@@ -127,6 +138,10 @@ export interface RecurringOptions extends HppRecurringOptions {
|
|
|
127
138
|
* Set it to true if you want to skip 3DS regardless of the risk score and SCA. Only applicable when it's card recurring flow.
|
|
128
139
|
*/
|
|
129
140
|
skip_3ds?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Descriptor that may be displayed to the customer during the verification.
|
|
143
|
+
*/
|
|
144
|
+
descriptor?: string;
|
|
130
145
|
}
|
|
131
146
|
|
|
132
147
|
/**
|
|
@@ -218,10 +233,6 @@ export interface HostPaymentPage {
|
|
|
218
233
|
* The failed return url when shopper can not fulfill the payment intent
|
|
219
234
|
*/
|
|
220
235
|
failUrl?: string;
|
|
221
|
-
/**
|
|
222
|
-
* The cancel return url when shopper canceled the payment intent
|
|
223
|
-
*/
|
|
224
|
-
cancelUrl?: string;
|
|
225
236
|
/**
|
|
226
237
|
* The logo url of your website you want to show in the HPP head
|
|
227
238
|
*/
|
|
@@ -260,6 +271,10 @@ export interface HostPaymentPage {
|
|
|
260
271
|
* Currency of your payment intent or consent. Three-letter ISO currency code
|
|
261
272
|
*/
|
|
262
273
|
currency: string;
|
|
274
|
+
/**
|
|
275
|
+
* The connected account associated with the payment when you are using Payments for Platforms. You should specify the specific connected account if you want to use its information to process the payment. This includes the statement descriptor displayed on the shopper's credit card or bank statement. The shopper will also see the available payment methods activated by the connected account.
|
|
276
|
+
*/
|
|
277
|
+
platformConnectedAccount?: string;
|
|
263
278
|
/**
|
|
264
279
|
* The 2-letter ISO country code from which the consumer will be paying
|
|
265
280
|
* If you want to integrate with `bank_transfer`, `online_banking`, `skrill` or `seven_eleven` payment method, it would be required
|
|
@@ -424,6 +439,7 @@ export interface PaymentMethod {
|
|
|
424
439
|
code?: string;
|
|
425
440
|
};
|
|
426
441
|
}
|
|
442
|
+
|
|
427
443
|
/**
|
|
428
444
|
* Element integration `step #1.1` (optional)
|
|
429
445
|
*
|
|
@@ -495,6 +511,20 @@ export interface ElementOptionsTypeMap {
|
|
|
495
511
|
fullFeaturedCard: FullFeaturedCardElementOptions;
|
|
496
512
|
}
|
|
497
513
|
|
|
514
|
+
export interface ElementTypeMap {
|
|
515
|
+
cardNumber?: CardNumberElementType;
|
|
516
|
+
expiry?: ExpiryDateElementType;
|
|
517
|
+
cvc?: CvcElementType;
|
|
518
|
+
applePayButton?: ApplePayButtonElementType;
|
|
519
|
+
googlePayButton?: GooglePayButtonElementType;
|
|
520
|
+
card?: CardElementType;
|
|
521
|
+
dropIn?: DropInElementType;
|
|
522
|
+
wechat?: WechatElementType;
|
|
523
|
+
qrcode?: QrcodeElementType;
|
|
524
|
+
redirect?: RedirectElementType;
|
|
525
|
+
fullFeaturedCard?: FullFeaturedCardElementType;
|
|
526
|
+
}
|
|
527
|
+
|
|
498
528
|
/**
|
|
499
529
|
* Interface of the request when call confirmPaymentIntent with contact.
|
|
500
530
|
* The application scenario: when you already have a payment consent created by call createPaymentConsent and your customer would like to trigger a payment intent confirm with the pre signed consent (linked with customer_id)
|
|
@@ -504,7 +534,7 @@ export interface PaymentMethodWithConsent {
|
|
|
504
534
|
* The id of the intent which would be confirmed
|
|
505
535
|
* @deprecated Please use `intent_id`
|
|
506
536
|
*/
|
|
507
|
-
id
|
|
537
|
+
id?: string;
|
|
508
538
|
/**
|
|
509
539
|
* The id of the intent which would be confirmed
|
|
510
540
|
*/
|
|
@@ -571,7 +601,7 @@ export interface Consent {
|
|
|
571
601
|
export declare function createElement<T extends keyof ElementOptionsTypeMap>(
|
|
572
602
|
type: T,
|
|
573
603
|
options?: ElementOptionsTypeMap[T],
|
|
574
|
-
):
|
|
604
|
+
): ElementTypeMap[T] | null;
|
|
575
605
|
/**
|
|
576
606
|
* Destroy element on the demand
|
|
577
607
|
*/
|
|
@@ -580,7 +610,7 @@ export declare const destroyElement: (type: ElementType) => boolean;
|
|
|
580
610
|
/**
|
|
581
611
|
* Query created element by type, there are only exist one type of element in one page
|
|
582
612
|
*/
|
|
583
|
-
export declare
|
|
613
|
+
export declare function getElement<T extends keyof ElementOptionsTypeMap>(type: T): ElementTypeMap[T] | null;
|
|
584
614
|
|
|
585
615
|
/**
|
|
586
616
|
* Element integration `step #4`
|
|
@@ -637,6 +667,10 @@ export interface PaymentConsentRequest {
|
|
|
637
667
|
* The element you would like to use to create consent
|
|
638
668
|
*/
|
|
639
669
|
element: Element;
|
|
670
|
+
/**
|
|
671
|
+
* payment_method_id is required when you want to create a payment consent with a saved payment method
|
|
672
|
+
*/
|
|
673
|
+
payment_method_id?: string;
|
|
640
674
|
/**
|
|
641
675
|
* The customer_id of the consent
|
|
642
676
|
*/
|
|
@@ -645,10 +679,6 @@ export interface PaymentConsentRequest {
|
|
|
645
679
|
* The cardholder name for this payment method
|
|
646
680
|
*/
|
|
647
681
|
cardname?: string;
|
|
648
|
-
/**
|
|
649
|
-
* If customer already has a payment method, merchant could provide it instead of create a new one
|
|
650
|
-
*/
|
|
651
|
-
payment_method_id?: string;
|
|
652
682
|
/**
|
|
653
683
|
* The subsequent transactions are triggered by `merchant` or `customer`
|
|
654
684
|
*/
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface DropInElementOptions extends ElementOptions {
|
|
|
15
15
|
* Currency of your payment intent or consent. Three-letter ISO currency code
|
|
16
16
|
*/
|
|
17
17
|
currency: string;
|
|
18
|
+
/**
|
|
19
|
+
* The connected account associated with the payment when you are using Payments for Platforms. You should specify the specific connected account if you want to use its information to process the payment. This includes the statement descriptor displayed on the shopper's credit card or bank statement. The shopper will also see the available payment methods activated by the connected account.
|
|
20
|
+
*/
|
|
21
|
+
platformConnectedAccount?: string;
|
|
18
22
|
/**
|
|
19
23
|
* Checkout mode, can be one of payment, recurring
|
|
20
24
|
* @default payment
|
|
@@ -58,6 +62,7 @@ export interface DropInElementOptions extends ElementOptions {
|
|
|
58
62
|
googlePayRequestOptions?: GooglePayRequestOptions;
|
|
59
63
|
/**
|
|
60
64
|
* Indicate to improve 3DS experience, indicate if the payment form will collect billing info from shopper
|
|
65
|
+
* @deprecated please use `requiredBillingContactFields` instead
|
|
61
66
|
*/
|
|
62
67
|
withBilling?: boolean;
|
|
63
68
|
/**
|
|
@@ -103,6 +108,7 @@ export interface DropInElementOptions extends ElementOptions {
|
|
|
103
108
|
shopper_email?: string;
|
|
104
109
|
/**
|
|
105
110
|
* Billing info from merchant
|
|
111
|
+
* This option would override the user input billing fields, so don't set withBilling and requiredBillingContactFields when you use this option
|
|
106
112
|
*/
|
|
107
113
|
billing?: Billing;
|
|
108
114
|
|
package/types/element.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Intent, PaymentMethodBasicInfo } from './cardNumber';
|
|
2
2
|
import { Properties } from 'csstype';
|
|
3
3
|
import { PaymentMethodWithQrcode, QrcodeElementOptions } from './qrcodeElement';
|
|
4
|
-
import { AuthorizationType, RecurringOptions } from './airwallex';
|
|
4
|
+
import { AuthorizationType, Consent, RecurringOptions } from './airwallex';
|
|
5
5
|
import { DropInElementOptions } from './dropInElement';
|
|
6
6
|
import { RedirectElementOptions } from './redirectElement';
|
|
7
|
-
import { Mode, InitOptions } from './airwallex';
|
|
7
|
+
import { Mode, InitOptions, PaymentMethod, PaymentConsentRequest, PaymentConsentResponse } from './airwallex';
|
|
8
|
+
|
|
9
|
+
export type PaymentMethodRequest = Omit<PaymentMethod, 'element'>;
|
|
10
|
+
export type CreatePaymentConsentRequest = Omit<PaymentConsentRequest, 'element'>;
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* All the flows that supported by Local Payment Methods
|
|
@@ -107,7 +110,20 @@ export type PaymentMethodWithRedirect =
|
|
|
107
110
|
| 'korean_local_card'
|
|
108
111
|
| 'naver_pay'
|
|
109
112
|
| 'payco'
|
|
110
|
-
| 'samsung_pay'
|
|
113
|
+
| 'samsung_pay'
|
|
114
|
+
| 'au_pay'
|
|
115
|
+
| 'bkash'
|
|
116
|
+
| 'd_barai'
|
|
117
|
+
| 'line_pay'
|
|
118
|
+
| 'merpay'
|
|
119
|
+
| 'payeasy_atm'
|
|
120
|
+
| 'paypay'
|
|
121
|
+
| 'rakuten_pay'
|
|
122
|
+
| 'safetypay'
|
|
123
|
+
| 'toss_pay'
|
|
124
|
+
| 'upi'
|
|
125
|
+
| 'zip'
|
|
126
|
+
| 'spei';
|
|
111
127
|
|
|
112
128
|
export type DirectDebitPaymentMethod =
|
|
113
129
|
| 'ach_direct_debit'
|
|
@@ -344,7 +360,7 @@ export interface PopUpStyle {
|
|
|
344
360
|
*/
|
|
345
361
|
export interface ElementOptions {
|
|
346
362
|
/**
|
|
347
|
-
* Element css style camelcase option, default style by Chrome browser default
|
|
363
|
+
* Element container css style camelcase option, default style by Chrome browser default
|
|
348
364
|
*/
|
|
349
365
|
style?: PopUpStyle & Properties;
|
|
350
366
|
/**
|
|
@@ -518,6 +534,11 @@ export interface CvcElementOptions extends ElementOptions {
|
|
|
518
534
|
* Container for authentication form, it's an element id
|
|
519
535
|
*/
|
|
520
536
|
authFormContainer?: string;
|
|
537
|
+
/**
|
|
538
|
+
* Indicate if cvc elemment works alone or not.
|
|
539
|
+
* If you want to use cvc elements for saved consents payment, you could set it true to improve checkout experience
|
|
540
|
+
*/
|
|
541
|
+
isStandalone?: boolean;
|
|
521
542
|
}
|
|
522
543
|
|
|
523
544
|
/**
|
|
@@ -626,25 +647,21 @@ export interface ApplePayRequestOriginalOptions {
|
|
|
626
647
|
|
|
627
648
|
/**
|
|
628
649
|
* The shipping information that you require from the user in order to fulfill the order.
|
|
629
|
-
* @deprecated Airwallex won't save shipping info in apple pay
|
|
630
650
|
*/
|
|
631
651
|
requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
|
|
632
652
|
|
|
633
653
|
/**
|
|
634
654
|
* Shipping contact information for the user.
|
|
635
|
-
* @deprecated Airwallex won't save shipping info in apple pay
|
|
636
655
|
*/
|
|
637
656
|
shippingContact?: ApplePayJS.ApplePayPaymentContact;
|
|
638
657
|
|
|
639
658
|
/**
|
|
640
659
|
* A set of shipping method objects that describe the available shipping methods.
|
|
641
|
-
* @deprecated Airwallex won't save shipping info in apple pay
|
|
642
660
|
*/
|
|
643
661
|
shippingMethods?: ApplePayJS.ApplePayShippingMethod[];
|
|
644
662
|
|
|
645
663
|
/**
|
|
646
664
|
* How the items are to be shipped.
|
|
647
|
-
* @deprecated Airwallex won't save shipping info in apple pay
|
|
648
665
|
*/
|
|
649
666
|
shippingType?: ApplePayJS.ApplePayShippingType;
|
|
650
667
|
|
|
@@ -685,6 +702,7 @@ export interface GooglePayRequestOptions {
|
|
|
685
702
|
/**
|
|
686
703
|
* Detailed information about the merchant.
|
|
687
704
|
*/
|
|
705
|
+
|
|
688
706
|
merchantInfo?: {
|
|
689
707
|
/**
|
|
690
708
|
* Merchant name encoded as UTF-8.
|
|
@@ -835,21 +853,78 @@ export interface GooglePayRequestOptions {
|
|
|
835
853
|
* Optional billing address parameters for the returned billing address.
|
|
836
854
|
*/
|
|
837
855
|
billingAddressParameters?: google.payments.api.BillingAddressParameters;
|
|
856
|
+
/**
|
|
857
|
+
* Whether a shipping address is required from the buyer.
|
|
858
|
+
*
|
|
859
|
+
* The returned shipping address can be retrieved from
|
|
860
|
+
* [[Address|`Address`]].
|
|
861
|
+
*
|
|
862
|
+
* If omitted, defaults to `false`.
|
|
863
|
+
*
|
|
864
|
+
* @default false
|
|
865
|
+
*/
|
|
866
|
+
shippingAddressRequired?: false | true | undefined;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Optional shipping address parameters.
|
|
870
|
+
*
|
|
871
|
+
* If omitted, the default values specified in
|
|
872
|
+
* [[ShippingAddressParameters|`ShippingAddressParameters`]] will be
|
|
873
|
+
* assumed.
|
|
874
|
+
*/
|
|
875
|
+
shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
|
|
876
|
+
/**
|
|
877
|
+
* Offers available for redemption that can be used with the current
|
|
878
|
+
* order.
|
|
879
|
+
*/
|
|
880
|
+
offerInfo?: google.payments.api.OfferInfo;
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Whether a shipping option is required from the buyer.
|
|
884
|
+
*
|
|
885
|
+
* If omitted, defaults to `false`.
|
|
886
|
+
* Note: This field is currently only for web only.
|
|
887
|
+
*
|
|
888
|
+
* @default false
|
|
889
|
+
*/
|
|
890
|
+
shippingOptionRequired?: boolean;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Parameters for shipping option that can be used in this request.
|
|
894
|
+
*
|
|
895
|
+
* This should only be set if
|
|
896
|
+
* [[PaymentDataRequest.shippingOptionRequired|`PaymentDataRequest.shippingOptionRequired`]]
|
|
897
|
+
* is set to true.
|
|
898
|
+
*
|
|
899
|
+
* Note: This field is currently only for web only.
|
|
900
|
+
*/
|
|
901
|
+
shippingOptionParameters?: google.payments.api.ShippingOptionParameters;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* List of callbacks that the developer intents to handle.
|
|
905
|
+
* Upon selection by the user, these intents can be used to update the
|
|
906
|
+
* request with new data based on that selection (e.g. if a shipping
|
|
907
|
+
* option is selected, the developer could update the `transactionInfo`
|
|
908
|
+
* with new `totalPrice` and `diplayItems`).
|
|
909
|
+
*
|
|
910
|
+
* Note: This functionality is only available for web.
|
|
911
|
+
*/
|
|
912
|
+
callbackIntents?: google.payments.api.CallbackIntent[];
|
|
838
913
|
}
|
|
839
914
|
|
|
840
915
|
export interface GooglePayButtonOptions extends GooglePayRequestOptions, ElementOptions {
|
|
841
916
|
/**
|
|
842
917
|
* The payment intent id you would like to checkout
|
|
843
|
-
* It's required for payment mode and optional for recurring mode
|
|
844
918
|
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro)
|
|
845
919
|
*
|
|
846
920
|
*/
|
|
847
921
|
intent_id?: string;
|
|
848
922
|
/**
|
|
849
923
|
* If the intent_id provided, this should be the client_secret of the intent
|
|
850
|
-
* If no intent_id provided, this should be the client_secret of the customer
|
|
924
|
+
* If no intent_id provided and customer_id provided, this should be the client_secret of the customer
|
|
925
|
+
* If no intent_id provided and no customer_id provided, this field can be empty
|
|
851
926
|
*/
|
|
852
|
-
client_secret
|
|
927
|
+
client_secret?: string;
|
|
853
928
|
/**
|
|
854
929
|
* Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
855
930
|
* It's required for recurring mode
|
|
@@ -884,8 +959,19 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions, Element
|
|
|
884
959
|
* Container for authentication form, it's an element id
|
|
885
960
|
*/
|
|
886
961
|
authFormContainer?: string;
|
|
962
|
+
/**
|
|
963
|
+
* Error for the last PaymentData, will be displayed to the user.
|
|
964
|
+
* Example: you can update error when user selected the wrong shipping option
|
|
965
|
+
* Note: This field is currently only for web only.
|
|
966
|
+
*/
|
|
967
|
+
error?: google.payments.api.PaymentDataError;
|
|
887
968
|
}
|
|
888
969
|
|
|
970
|
+
type GooglePayNextActionOptions = Pick<
|
|
971
|
+
GooglePayButtonOptions,
|
|
972
|
+
'client_secret' | 'intent_id' | 'customer_id' | 'autoCapture' | 'authorizationType' | 'authFormContainer'
|
|
973
|
+
>;
|
|
974
|
+
|
|
889
975
|
export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
890
976
|
/**
|
|
891
977
|
* Indicate the type of button you want displayed on your payments form. Like 'donate'
|
|
@@ -932,9 +1018,10 @@ export interface ApplePayButtonOptions extends ElementOptions, ApplePayRequestOp
|
|
|
932
1018
|
intent_id?: string;
|
|
933
1019
|
/**
|
|
934
1020
|
* If the intent_id provided, this should be the client_secret of the intent
|
|
935
|
-
* If no intent_id provided, this should be the client_secret of the customer
|
|
1021
|
+
* If no intent_id provided and customer_id provided, this should be the client_secret of the customer
|
|
1022
|
+
* If no intent_id provided and no customer_id provided, this value can be passed in update function later
|
|
936
1023
|
*/
|
|
937
|
-
client_secret
|
|
1024
|
+
client_secret?: string;
|
|
938
1025
|
/**
|
|
939
1026
|
* Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
940
1027
|
* It's required for recurring mode
|
|
@@ -992,6 +1079,8 @@ export interface Element {
|
|
|
992
1079
|
* Refer to the options when call createElement
|
|
993
1080
|
*/
|
|
994
1081
|
options?:
|
|
1082
|
+
| GooglePayButtonOptions
|
|
1083
|
+
| ApplePayButtonOptions
|
|
995
1084
|
| CardElementOptions
|
|
996
1085
|
| CardNumberElementOptions
|
|
997
1086
|
| ExpiryDateElementOptions
|
|
@@ -1051,3 +1140,443 @@ export interface Element {
|
|
|
1051
1140
|
initOptions?: InitOptions,
|
|
1052
1141
|
): void;
|
|
1053
1142
|
}
|
|
1143
|
+
|
|
1144
|
+
interface ElementBaseType {
|
|
1145
|
+
/**
|
|
1146
|
+
* @hidden
|
|
1147
|
+
* The iframe element after mount to the DOM
|
|
1148
|
+
*/
|
|
1149
|
+
iframe: HTMLIFrameElement | null;
|
|
1150
|
+
/**
|
|
1151
|
+
* @hidden
|
|
1152
|
+
* Refer to the DOM element you call mount function
|
|
1153
|
+
*/
|
|
1154
|
+
domElement: null | HTMLElement;
|
|
1155
|
+
/**
|
|
1156
|
+
* Element integration `step #3`
|
|
1157
|
+
* Mount payment element to your HTML DOM element for checkout
|
|
1158
|
+
*/
|
|
1159
|
+
/**
|
|
1160
|
+
* Mount element to your HTML DOM
|
|
1161
|
+
* @example
|
|
1162
|
+
* ```ts
|
|
1163
|
+
// type
|
|
1164
|
+
element.mount: (domElement: string | HTMLElement) => void
|
|
1165
|
+
|
|
1166
|
+
// There are two ways to mount element:
|
|
1167
|
+
// 1. call with container dom id
|
|
1168
|
+
element.mount('container-dom-id');
|
|
1169
|
+
|
|
1170
|
+
// 2.find the created DOM in existing HTML and call with container DOM element
|
|
1171
|
+
const containerElement = document.getElementById("container-dom-id");
|
|
1172
|
+
element.mount(containerElement);
|
|
1173
|
+
```
|
|
1174
|
+
*/
|
|
1175
|
+
mount(domElement: string | HTMLElement): null | HTMLElement;
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Using this function to unmount the element, opposite to mount function
|
|
1179
|
+
* The element instance is still kept
|
|
1180
|
+
* @example
|
|
1181
|
+
* ```ts
|
|
1182
|
+
element.unmount();
|
|
1183
|
+
```
|
|
1184
|
+
*/
|
|
1185
|
+
unmount(): void;
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Using this function to destory the element instance
|
|
1189
|
+
* @example
|
|
1190
|
+
```ts
|
|
1191
|
+
element.destroy();
|
|
1192
|
+
```
|
|
1193
|
+
*
|
|
1194
|
+
* ***IMPORTANT***
|
|
1195
|
+
*
|
|
1196
|
+
* Once element destroy by call function destroyElement, the element reference should not be used anymore
|
|
1197
|
+
*/
|
|
1198
|
+
destroy(): void;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
type CardElementEvent = 'ready' | 'click' | 'focus' | 'blur';
|
|
1202
|
+
/**
|
|
1203
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1204
|
+
*/
|
|
1205
|
+
export interface CardElementType extends ElementBaseType {
|
|
1206
|
+
/**
|
|
1207
|
+
* Using this function to blur the input html element
|
|
1208
|
+
*/
|
|
1209
|
+
blur(): void;
|
|
1210
|
+
/**
|
|
1211
|
+
* Using this function to clear the input html element
|
|
1212
|
+
*/
|
|
1213
|
+
clear(): void;
|
|
1214
|
+
/**
|
|
1215
|
+
* Using this function to focus the input html element
|
|
1216
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
|
|
1217
|
+
*/
|
|
1218
|
+
focus(): void;
|
|
1219
|
+
/**
|
|
1220
|
+
* Using this function to create payment consent
|
|
1221
|
+
* @param data Payment consent request
|
|
1222
|
+
*/
|
|
1223
|
+
createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Using this function to confirm payment intent
|
|
1226
|
+
* @param data Payment method
|
|
1227
|
+
*/
|
|
1228
|
+
confirm(data: PaymentMethodRequest): Promise<Intent>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Using this function to update the element option after create the element
|
|
1231
|
+
*/
|
|
1232
|
+
update(options?: Partial<CardElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1233
|
+
/**
|
|
1234
|
+
* Listen to element event
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
```ts
|
|
1238
|
+
element.on('success', () => {
|
|
1239
|
+
// Handle success event
|
|
1240
|
+
});
|
|
1241
|
+
```
|
|
1242
|
+
*/
|
|
1243
|
+
on(event: CardElementEvent, handler: EventListener): void;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
export type CardNumberElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1250
|
+
*/
|
|
1251
|
+
export interface CardNumberElementType extends ElementBaseType {
|
|
1252
|
+
/**
|
|
1253
|
+
* Using this function to blur the input html element
|
|
1254
|
+
*/
|
|
1255
|
+
blur(): void;
|
|
1256
|
+
/**
|
|
1257
|
+
* Using this function to clear the input html element
|
|
1258
|
+
*/
|
|
1259
|
+
clear(): void;
|
|
1260
|
+
/**
|
|
1261
|
+
* Using this function to focus the input html element
|
|
1262
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
|
|
1263
|
+
*/
|
|
1264
|
+
focus(): void;
|
|
1265
|
+
/**
|
|
1266
|
+
* Using this function to create payment consent
|
|
1267
|
+
* @param data Payment consent request
|
|
1268
|
+
*/
|
|
1269
|
+
createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Using this function to confirm payment intent
|
|
1272
|
+
* @param data Payment method
|
|
1273
|
+
*/
|
|
1274
|
+
confirm(data: PaymentMethodRequest): Promise<Intent>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Using this function to update the element option after create the element
|
|
1277
|
+
*/
|
|
1278
|
+
update(options?: Partial<CardNumberElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1279
|
+
/**
|
|
1280
|
+
* Listen to element event
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
```ts
|
|
1284
|
+
element.on('change', () => {
|
|
1285
|
+
// Handle change event
|
|
1286
|
+
});
|
|
1287
|
+
```
|
|
1288
|
+
*/
|
|
1289
|
+
on(event: CardNumberElementEvent, handler: EventListener): void;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
export type ExpiryElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey';
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1296
|
+
*/
|
|
1297
|
+
export interface ExpiryDateElementType extends ElementBaseType {
|
|
1298
|
+
/**
|
|
1299
|
+
* Using this function to blur the input html element
|
|
1300
|
+
*/
|
|
1301
|
+
blur(): void;
|
|
1302
|
+
/**
|
|
1303
|
+
* Using this function to clear the input html element
|
|
1304
|
+
*/
|
|
1305
|
+
clear(): void;
|
|
1306
|
+
/**
|
|
1307
|
+
* Using this function to focus the input html element
|
|
1308
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
|
|
1309
|
+
*/
|
|
1310
|
+
focus(): void;
|
|
1311
|
+
/**
|
|
1312
|
+
* Using this function to update the element option after create the element
|
|
1313
|
+
*/
|
|
1314
|
+
update(options?: Partial<ExpiryDateElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1315
|
+
/**
|
|
1316
|
+
* Listen to element event
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
```ts
|
|
1320
|
+
element.on('change', () => {
|
|
1321
|
+
// Handle change event
|
|
1322
|
+
});
|
|
1323
|
+
```
|
|
1324
|
+
*/
|
|
1325
|
+
on(event: ExpiryElementEvent, handler: EventListener): void;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
export type CvcElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1332
|
+
*/
|
|
1333
|
+
export interface CvcElementType extends ElementBaseType {
|
|
1334
|
+
/**
|
|
1335
|
+
* Using this function to blur the input html element
|
|
1336
|
+
*/
|
|
1337
|
+
blur(): void;
|
|
1338
|
+
/**
|
|
1339
|
+
* Using this function to clear the input html element
|
|
1340
|
+
*/
|
|
1341
|
+
clear(): void;
|
|
1342
|
+
/**
|
|
1343
|
+
* Using this function to focus the input html element
|
|
1344
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
|
|
1345
|
+
*/
|
|
1346
|
+
focus(): void;
|
|
1347
|
+
/**
|
|
1348
|
+
* Using this function to confirm payment intent
|
|
1349
|
+
* @param data Payment method
|
|
1350
|
+
*/
|
|
1351
|
+
confirm(data: PaymentMethodRequest): Promise<Intent>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Using this function to create payment consent
|
|
1354
|
+
* @param data Payment consent request
|
|
1355
|
+
*/
|
|
1356
|
+
createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
|
|
1357
|
+
/**
|
|
1358
|
+
* Using this function to update the element option after create the element
|
|
1359
|
+
*/
|
|
1360
|
+
|
|
1361
|
+
update(options?: Partial<CvcElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Listen to element event
|
|
1364
|
+
*
|
|
1365
|
+
* @example
|
|
1366
|
+
```ts
|
|
1367
|
+
element.on('change', () => {
|
|
1368
|
+
// Handle change event
|
|
1369
|
+
});
|
|
1370
|
+
```
|
|
1371
|
+
*/
|
|
1372
|
+
on(event: CvcElementEvent, handler: EventListener): void;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
export type ApplePayButtonEvent =
|
|
1376
|
+
| 'ready'
|
|
1377
|
+
| 'click'
|
|
1378
|
+
| 'shippingMethodChange'
|
|
1379
|
+
| 'shippingAddressChange'
|
|
1380
|
+
| 'validateMerchant'
|
|
1381
|
+
| 'authorized'
|
|
1382
|
+
| 'cancel'
|
|
1383
|
+
| 'success'
|
|
1384
|
+
| 'error';
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1388
|
+
*/
|
|
1389
|
+
export interface ApplePayButtonElementType extends ElementBaseType {
|
|
1390
|
+
/**
|
|
1391
|
+
* Using this function to update the element option after create the element
|
|
1392
|
+
*/
|
|
1393
|
+
update(options?: Partial<ApplePayButtonOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Listen to element event
|
|
1397
|
+
*
|
|
1398
|
+
* @example
|
|
1399
|
+
```ts
|
|
1400
|
+
element.on('success', () => {
|
|
1401
|
+
// Handle success event
|
|
1402
|
+
});
|
|
1403
|
+
```
|
|
1404
|
+
*/
|
|
1405
|
+
on(event: ApplePayButtonEvent, handler: EventListener): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Using this function to confirm payment intent
|
|
1408
|
+
* @param data client_secret returned in create intent response
|
|
1409
|
+
*/
|
|
1410
|
+
confirmIntent(data: { client_secret: string }): Promise<Intent>;
|
|
1411
|
+
/**
|
|
1412
|
+
* Using this function to create payment consent
|
|
1413
|
+
* @param data client_secret returned in create intent response or returned in create customer response
|
|
1414
|
+
*/
|
|
1415
|
+
createPaymentConsent(data: { client_secret: string }): Promise<Consent | undefined>;
|
|
1416
|
+
/**
|
|
1417
|
+
*
|
|
1418
|
+
* @param data apple pay session data
|
|
1419
|
+
*/
|
|
1420
|
+
completeValidation(data: unknown): void;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
export type DropInElementEvent =
|
|
1424
|
+
| 'ready'
|
|
1425
|
+
| 'click'
|
|
1426
|
+
| 'cancel'
|
|
1427
|
+
| 'success'
|
|
1428
|
+
| 'error'
|
|
1429
|
+
| 'switchMethod'
|
|
1430
|
+
| 'pendingVerifyAccount';
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1434
|
+
*/
|
|
1435
|
+
export interface DropInElementType extends ElementBaseType {
|
|
1436
|
+
/**
|
|
1437
|
+
* Using this function to update the element option after create the element
|
|
1438
|
+
*/
|
|
1439
|
+
update(options?: Partial<DropInElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1440
|
+
/**
|
|
1441
|
+
* Listen to element event
|
|
1442
|
+
*
|
|
1443
|
+
* @example
|
|
1444
|
+
```ts
|
|
1445
|
+
element.on('success', () => {
|
|
1446
|
+
// Handle success event
|
|
1447
|
+
});
|
|
1448
|
+
```
|
|
1449
|
+
*/
|
|
1450
|
+
on(event: DropInElementEvent, handler: EventListener): void;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
export type GooglePayButtonEvent =
|
|
1454
|
+
| 'ready'
|
|
1455
|
+
| 'click'
|
|
1456
|
+
| 'cancel'
|
|
1457
|
+
| 'success'
|
|
1458
|
+
| 'error'
|
|
1459
|
+
| 'authorized'
|
|
1460
|
+
| 'shippingAddressChange'
|
|
1461
|
+
| 'shippingMethodChange';
|
|
1462
|
+
/**
|
|
1463
|
+
* Functions and external fields can be used in your integration flow with airwallex element
|
|
1464
|
+
*/
|
|
1465
|
+
export interface GooglePayButtonElementType extends ElementBaseType {
|
|
1466
|
+
/**
|
|
1467
|
+
* Using this function to update the element option after create the element
|
|
1468
|
+
*/
|
|
1469
|
+
update(options?: Partial<GooglePayButtonOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Listen to element event
|
|
1473
|
+
*
|
|
1474
|
+
* @example
|
|
1475
|
+
```ts
|
|
1476
|
+
element.on('success', () => {
|
|
1477
|
+
// Handle success event
|
|
1478
|
+
});
|
|
1479
|
+
```
|
|
1480
|
+
*/
|
|
1481
|
+
on(event: GooglePayButtonEvent, handler: EventListener): void;
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* Using this function to confirm payment intent
|
|
1485
|
+
* @param data client_secret returned in create intent response
|
|
1486
|
+
*/
|
|
1487
|
+
confirmIntent(data: { client_secret: string }): Promise<Intent>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Using this function to create payment consent
|
|
1490
|
+
* @param data client_secret returned in create intent response or returned in create customer response
|
|
1491
|
+
*/
|
|
1492
|
+
createPaymentConsent(data: { client_secret: string }): Promise<Consent | undefined>;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
export type WechatElementEvent = 'ready' | 'success' | 'error';
|
|
1496
|
+
/**
|
|
1497
|
+
* @deprecated
|
|
1498
|
+
*/
|
|
1499
|
+
export interface WechatElementType extends ElementBaseType {
|
|
1500
|
+
/**
|
|
1501
|
+
* Using this function to update the element option after create the element
|
|
1502
|
+
*/
|
|
1503
|
+
update(options?: Partial<WechatElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1504
|
+
/**
|
|
1505
|
+
* Listen to element event
|
|
1506
|
+
*
|
|
1507
|
+
* @example
|
|
1508
|
+
```ts
|
|
1509
|
+
element.on('ready', () => {
|
|
1510
|
+
// Handle ready event
|
|
1511
|
+
});
|
|
1512
|
+
```
|
|
1513
|
+
*/
|
|
1514
|
+
on(event: WechatElementEvent, handler: EventListener): void;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
export type QrcodeElementEvent = 'ready' | 'success' | 'error';
|
|
1518
|
+
/**
|
|
1519
|
+
* @deprecated
|
|
1520
|
+
*/
|
|
1521
|
+
export interface QrcodeElementType extends ElementBaseType {
|
|
1522
|
+
/**
|
|
1523
|
+
* Using this function to update the element option after create the element
|
|
1524
|
+
*/
|
|
1525
|
+
update(options?: Partial<QrcodeElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1526
|
+
/**
|
|
1527
|
+
* Listen to element event
|
|
1528
|
+
*
|
|
1529
|
+
* @example
|
|
1530
|
+
```ts
|
|
1531
|
+
element.on('change', () => {
|
|
1532
|
+
// Handle change event
|
|
1533
|
+
});
|
|
1534
|
+
```
|
|
1535
|
+
*/
|
|
1536
|
+
on(event: QrcodeElementEvent, handler: EventListener): void;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
type FullFeaturedCardElementEvent = 'ready' | 'success' | 'error';
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* @deprecated
|
|
1543
|
+
*/
|
|
1544
|
+
export interface FullFeaturedCardElementType extends ElementBaseType {
|
|
1545
|
+
/**
|
|
1546
|
+
* Using this function to update the element option after create the element
|
|
1547
|
+
*/
|
|
1548
|
+
update(options?: Partial<FullFeaturedCardElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1549
|
+
/**
|
|
1550
|
+
* Listen to element event
|
|
1551
|
+
*
|
|
1552
|
+
* @example
|
|
1553
|
+
```ts
|
|
1554
|
+
element.on('change', () => {
|
|
1555
|
+
// Handle change event
|
|
1556
|
+
});
|
|
1557
|
+
```
|
|
1558
|
+
*/
|
|
1559
|
+
on(event: FullFeaturedCardElementEvent, handler: EventListener): void;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
export type RedirectElementEvent = 'ready' | 'success' | 'error';
|
|
1563
|
+
/**
|
|
1564
|
+
* @deprecated
|
|
1565
|
+
*/
|
|
1566
|
+
export interface RedirectElementType extends ElementBaseType {
|
|
1567
|
+
/**
|
|
1568
|
+
* Using this function to update the element option after create the element
|
|
1569
|
+
*/
|
|
1570
|
+
update(options?: Partial<RedirectElementOptions>, initOptions?: Partial<InitOptions>): void;
|
|
1571
|
+
/**
|
|
1572
|
+
* Listen to element event
|
|
1573
|
+
*
|
|
1574
|
+
* @example
|
|
1575
|
+
```ts
|
|
1576
|
+
element.on('change', () => {
|
|
1577
|
+
// Handle change event
|
|
1578
|
+
});
|
|
1579
|
+
```
|
|
1580
|
+
*/
|
|
1581
|
+
on(event: RedirectElementEvent, handler: EventListener): void;
|
|
1582
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -28,7 +28,9 @@ import Airwallex, {
|
|
|
28
28
|
Mode,
|
|
29
29
|
RecurringOptions,
|
|
30
30
|
Consent,
|
|
31
|
+
ElementTypeMap,
|
|
31
32
|
Locale,
|
|
33
|
+
Billing,
|
|
32
34
|
} from './airwallex';
|
|
33
35
|
|
|
34
36
|
export {
|
|
@@ -55,6 +57,8 @@ export {
|
|
|
55
57
|
RecurringOptions,
|
|
56
58
|
Consent,
|
|
57
59
|
Locale,
|
|
60
|
+
Billing,
|
|
61
|
+
ElementTypeMap,
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
/**
|