airwallex-payment-elements 0.2.73 → 0.2.80
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 +1 -1
- package/lib/bin/airwallex.es.js +1 -1
- package/lib/bin/airwallex.iife.js +1 -1
- package/package.json +1 -1
- package/types/airwallex.d.ts +92 -6
- package/types/directDebitElement.d.ts +6 -8
- package/types/dropInElement.d.ts +8 -3
- package/types/element.d.ts +81 -9
- package/types/index.d.ts +4 -2
package/lib/bin/airwallex.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.80] */
|
|
2
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",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js",t=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const t=document.head||document.body;if(!t)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return t.appendChild(r),r};exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},exports.createPaymentMethod=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)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),exports.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),exports.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getGatewayUrl=r,exports.getPaymentIntent=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)}},exports.handle3ds=e=>window.Airwallex.handle3ds(e),exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=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="${o}"], script[src="${o}/"]`)||t(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(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},exports.loadAirwallexJs=t,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
|
|
3
3
|
//# sourceMappingURL=airwallex.cjs.js.map
|
package/lib/bin/airwallex.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.80] */
|
|
2
2
|
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js",l=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(r),r},n=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const w=async()=>{const n=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await w()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},w=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},i=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),a=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)}},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)}},u=e=>window.Airwallex.getBrowserInfo(e),f=e=>window.Airwallex.getDeviceFingerprint(e),h=e=>window.Airwallex.get3dsReturnUrl(e),y=e=>window.Airwallex.handle3ds(e);export{c as confirmPaymentIntent,s as confirmPaymentIntentWithSavedCard,t as createElement,A as createPaymentConsent,x as createPaymentMethod,a as destroyElement,h as get3dsReturnUrl,u as getBrowserInfo,f as getDeviceFingerprint,d as getElement,r as getGatewayUrl,m as getPaymentIntent,y as handle3ds,w as init,n as loadAirwallex,l as loadAirwallexJs,i as redirectToCheckout};
|
|
3
3
|
//# sourceMappingURL=airwallex.es.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.80] */
|
|
2
2
|
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,o="/assets/elements.bundle.min.js",l=e=>{const r=document.createElement("script");r.src=`${e}${o}`;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};return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},e.createPaymentMethod=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)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),e.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),e.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=n,e.getPaymentIntent=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)}},e.handle3ds=e=>window.Airwallex.handle3ds(e),e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let r=0;const t=async()=>{const r=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(n((null==e?void 0:e.env)||"prod"));return new Promise(((n,o)=>{r.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),r.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),r.remove&&r.remove()}))}))};for(;r<3;)try{return await t()}catch(e){r++,await new Promise((e=>window.setTimeout(e,500)))}return null},e.loadAirwallexJs=l,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
3
3
|
//# sourceMappingURL=airwallex.iife.js.map
|
package/package.json
CHANGED
package/types/airwallex.d.ts
CHANGED
|
@@ -76,6 +76,29 @@ export interface HppTheme extends BoxStyle {
|
|
|
76
76
|
fonts?: FontOptions[];
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
export interface RecurringOptions extends HppRecurringOptions {
|
|
80
|
+
/**
|
|
81
|
+
* The subsequent transactions are triggered by `merchant` or `customer`
|
|
82
|
+
*/
|
|
83
|
+
next_triggered_by?: 'merchant' | 'customer';
|
|
84
|
+
/**
|
|
85
|
+
* The reason why merchant trigger transaction. Only applicable when next_triggered_by is `merchant`
|
|
86
|
+
*/
|
|
87
|
+
merchant_trigger_reason?: 'scheduled' | 'unscheduled';
|
|
88
|
+
/**
|
|
89
|
+
* Only applicable when next_triggered_by is customer and method is card. If true, the customer must provide cvc for the subsequent payment with this PaymentConsent
|
|
90
|
+
*/
|
|
91
|
+
requires_cvc?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Currency of the initial PaymentIntent to verify the PaymentConsent. Three-letter ISO currency code. Only applicable for card method
|
|
94
|
+
*/
|
|
95
|
+
currency?: string;
|
|
96
|
+
/**
|
|
97
|
+
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
98
|
+
*/
|
|
99
|
+
connected_account_id?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
79
102
|
/**
|
|
80
103
|
* Config for HPP recurring flow
|
|
81
104
|
*/
|
|
@@ -84,6 +107,7 @@ export interface HppRecurringOptions {
|
|
|
84
107
|
* Currently we supports card and alipay(exclude alipaycn) recurring flow
|
|
85
108
|
* For alipay, merchant does not need to config anything
|
|
86
109
|
* For card, merchant needs to provide related configurations
|
|
110
|
+
* @deperacated use `RecurringOptions` instead
|
|
87
111
|
*/
|
|
88
112
|
card?: {
|
|
89
113
|
/**
|
|
@@ -102,6 +126,10 @@ export interface HppRecurringOptions {
|
|
|
102
126
|
* Currency of the initial PaymentIntent to verify the PaymentConsent. Three-letter ISO currency code
|
|
103
127
|
*/
|
|
104
128
|
currency?: string;
|
|
129
|
+
/**
|
|
130
|
+
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
131
|
+
*/
|
|
132
|
+
connected_account_id?: string;
|
|
105
133
|
};
|
|
106
134
|
}
|
|
107
135
|
|
|
@@ -131,9 +159,14 @@ export interface HostPaymentPage {
|
|
|
131
159
|
*/
|
|
132
160
|
customer_id?: string;
|
|
133
161
|
/**
|
|
134
|
-
* The payment
|
|
162
|
+
* The payment methods your website would like to integrate with
|
|
163
|
+
* @deprecated use `methods` instead
|
|
135
164
|
*/
|
|
136
165
|
components?: Array<PaymentMethodType>;
|
|
166
|
+
/**
|
|
167
|
+
* The payment methods your website would like to integrate with
|
|
168
|
+
*/
|
|
169
|
+
methods?: Array<PaymentMethodType>;
|
|
137
170
|
/**
|
|
138
171
|
* Only support for card payment, indicate whether to capture immediate when authentication success
|
|
139
172
|
*/
|
|
@@ -170,7 +203,7 @@ export interface HostPaymentPage {
|
|
|
170
203
|
/**
|
|
171
204
|
* The options of recurring flow
|
|
172
205
|
*/
|
|
173
|
-
recurringOptions?:
|
|
206
|
+
recurringOptions?: RecurringOptions;
|
|
174
207
|
/**
|
|
175
208
|
* The options of apple pay
|
|
176
209
|
* If you want to integrate with apple pay, you need to provide the following options
|
|
@@ -186,7 +219,7 @@ export interface HostPaymentPage {
|
|
|
186
219
|
currency: string;
|
|
187
220
|
/**
|
|
188
221
|
* The 2-letter ISO country code from which the consumer will be paying
|
|
189
|
-
* If you want to integrate with `
|
|
222
|
+
* If you want to integrate with `bank_transfer`, `online_banking`, `skrill` or `seven_eleven` payment method, it would be required
|
|
190
223
|
*/
|
|
191
224
|
country_code?: string;
|
|
192
225
|
/**
|
|
@@ -439,6 +472,49 @@ export interface PaymentMethodWithConsent {
|
|
|
439
472
|
payment_consent_id: string;
|
|
440
473
|
}
|
|
441
474
|
|
|
475
|
+
export interface Consent {
|
|
476
|
+
/**
|
|
477
|
+
* The id of the consent which would be confirmed
|
|
478
|
+
*/
|
|
479
|
+
id: string;
|
|
480
|
+
/**
|
|
481
|
+
* The `client_secret` of the consent.
|
|
482
|
+
*/
|
|
483
|
+
client_secret: string;
|
|
484
|
+
/**
|
|
485
|
+
* The status of the consent.
|
|
486
|
+
*/
|
|
487
|
+
status: 'PENDING_VERIFICATION' | 'VERIFIED' | 'DISABLED';
|
|
488
|
+
/**
|
|
489
|
+
* The create time of the consent.
|
|
490
|
+
*/
|
|
491
|
+
created_at: string;
|
|
492
|
+
/**
|
|
493
|
+
* The update time of the consent.
|
|
494
|
+
*/
|
|
495
|
+
updated_at: string;
|
|
496
|
+
/**
|
|
497
|
+
* Whether the consent is required cvc.
|
|
498
|
+
*/
|
|
499
|
+
requires_cvc: boolean;
|
|
500
|
+
/**
|
|
501
|
+
* It determines who will be the next one to trigger this consent.
|
|
502
|
+
*/
|
|
503
|
+
next_triggered_by: 'merchant' | 'customer';
|
|
504
|
+
/**
|
|
505
|
+
* The reason why the consent is triggered.
|
|
506
|
+
*/
|
|
507
|
+
merchant_trigger_reason?: 'scheduled' | 'unscheduled';
|
|
508
|
+
/**
|
|
509
|
+
* The id of the customer
|
|
510
|
+
*/
|
|
511
|
+
customer_id: string;
|
|
512
|
+
/**
|
|
513
|
+
* The id of the initial payment intent
|
|
514
|
+
*/
|
|
515
|
+
initial_payment_intent_id?: string;
|
|
516
|
+
}
|
|
517
|
+
|
|
442
518
|
/**
|
|
443
519
|
* Element integration `step #2`
|
|
444
520
|
* Create payment element for checkout
|
|
@@ -506,8 +582,10 @@ export interface PaymentConsentRequest {
|
|
|
506
582
|
/**
|
|
507
583
|
* If the intent provided, this should be the client_secret of the intent
|
|
508
584
|
* If no intent provided, this should be the client_secret of the customer
|
|
585
|
+
* For `cardNumber` or `card` element, it should be required.
|
|
586
|
+
* For `directDebit` element, you needn't provide it.
|
|
509
587
|
*/
|
|
510
|
-
client_secret
|
|
588
|
+
client_secret?: string;
|
|
511
589
|
/**
|
|
512
590
|
* The element you would like to use to create consent
|
|
513
591
|
*/
|
|
@@ -516,6 +594,10 @@ export interface PaymentConsentRequest {
|
|
|
516
594
|
* The customer_id of the consent
|
|
517
595
|
*/
|
|
518
596
|
customer_id: string;
|
|
597
|
+
/**
|
|
598
|
+
* The cardholder name for this payment method
|
|
599
|
+
*/
|
|
600
|
+
cardname?: string;
|
|
519
601
|
/**
|
|
520
602
|
* If customer already has a payment method, merchant could provide it instead of create a new one
|
|
521
603
|
*/
|
|
@@ -536,6 +618,10 @@ export interface PaymentConsentRequest {
|
|
|
536
618
|
* The billing info for the payment consent
|
|
537
619
|
*/
|
|
538
620
|
billing?: Billing;
|
|
621
|
+
/**
|
|
622
|
+
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
623
|
+
*/
|
|
624
|
+
connected_account_id?: string;
|
|
539
625
|
}
|
|
540
626
|
|
|
541
627
|
/**
|
|
@@ -558,11 +644,11 @@ export interface PaymentConsentResponse {
|
|
|
558
644
|
/**
|
|
559
645
|
* The currency of the payment consent
|
|
560
646
|
*/
|
|
561
|
-
currency
|
|
647
|
+
currency?: string;
|
|
562
648
|
/**
|
|
563
649
|
* The payment method of the payment consent
|
|
564
650
|
*/
|
|
565
|
-
payment_method
|
|
651
|
+
payment_method?: {
|
|
566
652
|
/**
|
|
567
653
|
* The id of the payment method
|
|
568
654
|
*/
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { Mode } from './airwallex';
|
|
2
1
|
import { ElementOptions, DirectDebitPaymentMethod } from './element';
|
|
3
2
|
|
|
4
3
|
export interface DirectDebitElementOptions extends ElementOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The payment intent id you would like to checkout
|
|
7
|
-
*/
|
|
8
|
-
intent_id: string;
|
|
9
4
|
/**
|
|
10
5
|
* If the intent provided, this should be the client_secret of the intent
|
|
11
6
|
* If no intent provided, this should be the client_secret of the customer
|
|
@@ -17,8 +12,11 @@ export interface DirectDebitElementOptions extends ElementOptions {
|
|
|
17
12
|
*/
|
|
18
13
|
method: DirectDebitPaymentMethod;
|
|
19
14
|
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
15
|
+
* Customer name
|
|
16
|
+
*/
|
|
17
|
+
shopper_name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Customer email
|
|
22
20
|
*/
|
|
23
|
-
|
|
21
|
+
shopper_email?: string;
|
|
24
22
|
}
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementOptions, PaymentMethodType, BoxStyle } from './element';
|
|
2
|
-
import { Mode,
|
|
2
|
+
import { Mode, RecurringOptions, Billing } from './airwallex';
|
|
3
3
|
import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions } from './element';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -21,9 +21,14 @@ export interface DropInElementOptions extends ElementOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
mode?: Mode;
|
|
23
23
|
/**
|
|
24
|
-
* The payment
|
|
24
|
+
* The payment methods your website would like to integrate with
|
|
25
|
+
* @deprecated use `methods` instead
|
|
25
26
|
*/
|
|
26
27
|
components?: Array<PaymentMethodType>;
|
|
28
|
+
/**
|
|
29
|
+
* The payment methods your website would like to integrate with
|
|
30
|
+
*/
|
|
31
|
+
methods?: Array<PaymentMethodType>;
|
|
27
32
|
/**
|
|
28
33
|
* Indicate whether to capture immediate when authentication success
|
|
29
34
|
*/
|
|
@@ -61,7 +66,7 @@ export interface DropInElementOptions extends ElementOptions {
|
|
|
61
66
|
/**
|
|
62
67
|
* The options of recurring flow
|
|
63
68
|
*/
|
|
64
|
-
recurringOptions?:
|
|
69
|
+
recurringOptions?: RecurringOptions;
|
|
65
70
|
/**
|
|
66
71
|
* The 2-letter ISO country code from which the consumer will be paying
|
|
67
72
|
* If you want to integrate with `bank_transfer` payment method, it would be required
|
package/types/element.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Intent, PaymentMethodBasicInfo } from './cardNumber';
|
|
2
2
|
import { Properties } from 'csstype';
|
|
3
3
|
import { QrcodeElementOptions } from './qrcodeElement';
|
|
4
|
-
import {
|
|
4
|
+
import { RecurringOptions } from './airwallex';
|
|
5
5
|
import { DropInElementOptions } from './dropInElement';
|
|
6
6
|
import { RedirectElementOptions } from './redirectElement';
|
|
7
7
|
import { NextAction } from './fraud';
|
|
8
|
-
|
|
8
|
+
import { Mode } from './airwallex';
|
|
9
9
|
/**
|
|
10
10
|
* Supported integration element type
|
|
11
11
|
*/
|
|
@@ -490,7 +490,7 @@ export interface FullFeaturedCardRecurringOptions extends Omit<FullFeaturedCardP
|
|
|
490
490
|
/**
|
|
491
491
|
* The options of recurring flow
|
|
492
492
|
*/
|
|
493
|
-
recurringOptions:
|
|
493
|
+
recurringOptions: RecurringOptions;
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
export type FullFeaturedCardElementOptions = FullFeaturedCardPaymentOptions | FullFeaturedCardRecurringOptions;
|
|
@@ -510,6 +510,14 @@ export interface PaymentShippingOption {
|
|
|
510
510
|
|
|
511
511
|
export type ApplePayHppOrDropInRequestOptions = ApplePayRequestOptions;
|
|
512
512
|
|
|
513
|
+
export type ApplePayRecurringLineItem = {
|
|
514
|
+
paymentTiming: 'recurring' | 'deferred';
|
|
515
|
+
recurringPaymentStartDate: Date;
|
|
516
|
+
recurringPaymentIntervalUnit: 'year' | 'month' | 'day' | 'hour' | 'minute';
|
|
517
|
+
recurringPaymentIntervalCount: number;
|
|
518
|
+
recurringPaymentEndDate: Date;
|
|
519
|
+
};
|
|
520
|
+
|
|
513
521
|
export interface ApplePayRequestOriginalOptions {
|
|
514
522
|
/**
|
|
515
523
|
* The merchant's two-letter ISO 3166 country code. Like 'US'
|
|
@@ -519,7 +527,7 @@ export interface ApplePayRequestOriginalOptions {
|
|
|
519
527
|
/**
|
|
520
528
|
* A set of line items that explain recurring payments and/or additional charges.
|
|
521
529
|
*/
|
|
522
|
-
lineItems?: ApplePayJS.ApplePayLineItem[];
|
|
530
|
+
lineItems?: (ApplePayJS.ApplePayLineItem & ApplePayRecurringLineItem)[];
|
|
523
531
|
|
|
524
532
|
/**
|
|
525
533
|
* Billing contact information for the user.
|
|
@@ -635,6 +643,26 @@ export interface GooglePayRequestOptions {
|
|
|
635
643
|
* Definition of a cart item.
|
|
636
644
|
*/
|
|
637
645
|
displayItems?: google.payments.api.DisplayItem[];
|
|
646
|
+
/**
|
|
647
|
+
* The status of the total price used.
|
|
648
|
+
* If it is a variable subscription, the status should be NOT_CURRENTLY_KNOWN.
|
|
649
|
+
*
|
|
650
|
+
* Options:
|
|
651
|
+
*
|
|
652
|
+
* - `NOT_CURRENTLY_KNOWN`:
|
|
653
|
+
* The total price is not known currently.
|
|
654
|
+
*
|
|
655
|
+
* - `ESTIMATED`:
|
|
656
|
+
* The total price provided is an estimated price. The final price may
|
|
657
|
+
* change depending on the selected shipping address or billing address,
|
|
658
|
+
* if requested.
|
|
659
|
+
*
|
|
660
|
+
* - `FINAL`:
|
|
661
|
+
* The total price is the final total price of the transaction, and will
|
|
662
|
+
* not change based on selections made by the buyer.
|
|
663
|
+
* * @default "FINAL"
|
|
664
|
+
*/
|
|
665
|
+
totalPriceStatus?: 'NOT_CURRENTLY_KNOWN' | 'ESTIMATED' | 'FINAL';
|
|
638
666
|
/**
|
|
639
667
|
* Total price label of this transaction.
|
|
640
668
|
*
|
|
@@ -725,21 +753,35 @@ export interface GooglePayRequestOptions {
|
|
|
725
753
|
export interface GooglePayButtonOptions extends GooglePayRequestOptions, ElementOptions {
|
|
726
754
|
/**
|
|
727
755
|
* The payment intent id you would like to checkout
|
|
756
|
+
* It's required for payment mode and optional for recurring mode
|
|
728
757
|
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro)
|
|
729
758
|
*
|
|
730
759
|
*/
|
|
731
|
-
intent_id
|
|
760
|
+
intent_id?: string;
|
|
732
761
|
/**
|
|
733
|
-
*
|
|
762
|
+
* If the intent_id provided, this should be the client_secret of the intent
|
|
763
|
+
* If no intent_id provided, this should be the client_secret of the customer
|
|
734
764
|
*/
|
|
735
765
|
client_secret: string;
|
|
766
|
+
/**
|
|
767
|
+
* Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
768
|
+
* It's required for recurring mode
|
|
769
|
+
*/
|
|
770
|
+
customer_id?: string;
|
|
771
|
+
/**
|
|
772
|
+
* Checkout mode
|
|
773
|
+
* @default "payment"
|
|
774
|
+
*/
|
|
775
|
+
mode?: Mode;
|
|
736
776
|
/**
|
|
737
777
|
* Indicate the amount and currency of the intent.
|
|
778
|
+
* If the mode is recurring and there is no intent_id provided, amount should be {value: 0, currency: 'Replace with payment currency'}.
|
|
738
779
|
*/
|
|
739
780
|
amount: {
|
|
740
781
|
value: number;
|
|
741
782
|
currency: string;
|
|
742
783
|
};
|
|
784
|
+
|
|
743
785
|
/**
|
|
744
786
|
* Indicate whether to capture immediate when authentication success
|
|
745
787
|
*/
|
|
@@ -765,23 +807,53 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
|
765
807
|
*/
|
|
766
808
|
totalPriceLabel?: string;
|
|
767
809
|
/**
|
|
768
|
-
*
|
|
810
|
+
* A type that indicates whether a line item is final or pending.
|
|
811
|
+
* if the mode is recurring and it's a variable subscription, the value should be pending.
|
|
812
|
+
* @default "final"
|
|
813
|
+
*/
|
|
814
|
+
totalPriceType?: 'final' | 'pending';
|
|
815
|
+
/**
|
|
816
|
+
* Card networks supported by the merchant.
|
|
817
|
+
* if not configured, supportedNetworks will automatically configure based on merchant account settings
|
|
818
|
+
* For more details, please refer to https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
|
|
819
|
+
*/
|
|
820
|
+
supportedNetworks?: string[];
|
|
821
|
+
/**
|
|
822
|
+
* Payment capabilities supported by the merchant.
|
|
823
|
+
* If not configured, supportedNetworks will automatically configure according to the merchant account settings
|
|
824
|
+
* supports3DS - Required. This value must be supplied.
|
|
825
|
+
* supportsCredit - Optional. If present, only transactions that are categorized as credit cards are allowed.
|
|
826
|
+
* supportsDebit - Optional. If present, only transactions that are categorized as debit cards are allowed.
|
|
827
|
+
* supportsEMV - Include this value only if you support China Union Pay transactions. (if supportedNetworks don't contains chinaUnionPay, please don't include it).
|
|
769
828
|
*/
|
|
770
829
|
merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
|
|
771
830
|
}
|
|
772
831
|
export interface ApplePayButtonOptions extends ElementOptions, ApplePayRequestOptions {
|
|
773
832
|
/**
|
|
774
833
|
* The payment intent id you would like to checkout
|
|
834
|
+
* It's required for payment mode and optional for recurring mode
|
|
775
835
|
* Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro)
|
|
776
836
|
*
|
|
777
837
|
*/
|
|
778
|
-
intent_id
|
|
838
|
+
intent_id?: string;
|
|
779
839
|
/**
|
|
780
|
-
*
|
|
840
|
+
* If the intent_id provided, this should be the client_secret of the intent
|
|
841
|
+
* If no intent_id provided, this should be the client_secret of the customer
|
|
781
842
|
*/
|
|
782
843
|
client_secret: string;
|
|
844
|
+
/**
|
|
845
|
+
* Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
846
|
+
* It's required for recurring mode
|
|
847
|
+
*/
|
|
848
|
+
customer_id?: string;
|
|
849
|
+
/**
|
|
850
|
+
* Checkout mode
|
|
851
|
+
* @default "payment"
|
|
852
|
+
*/
|
|
853
|
+
mode?: Mode;
|
|
783
854
|
/**
|
|
784
855
|
* Indicate the amount and currency of the intent.
|
|
856
|
+
* If the mode is recurring and there is no intent_id provided, amount should be {value: 0, currency: 'Replace with payment currency'}.
|
|
785
857
|
*/
|
|
786
858
|
amount: {
|
|
787
859
|
value: number;
|
package/types/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ import Airwallex, {
|
|
|
27
27
|
HppTheme,
|
|
28
28
|
HostPaymentPage,
|
|
29
29
|
Mode,
|
|
30
|
-
|
|
30
|
+
RecurringOptions,
|
|
31
|
+
Consent,
|
|
31
32
|
} from './airwallex';
|
|
32
33
|
|
|
33
34
|
export {
|
|
@@ -51,7 +52,8 @@ export {
|
|
|
51
52
|
FontOptions,
|
|
52
53
|
HppTheme,
|
|
53
54
|
HostPaymentPage,
|
|
54
|
-
|
|
55
|
+
RecurringOptions,
|
|
56
|
+
Consent,
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
/**
|