airwallex-payment-elements 1.119.1 → 1.122.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/README.md +11 -0
- 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 +84 -3
- package/types/dropInElement.d.ts +5 -1
- package/types/element.d.ts +2 -1
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# airwallex-payment-elements
|
|
2
2
|
|
|
3
|
+
> **IMPORTANT NOTICE**: This package is being superseded by [Airwallex.js](https://www.airwallex.com/docs/developer-tools__sdks__airwallex.js__upgrade-to-airwallex.js__upgrade-from-payment-elements-sdk). We strongly recommend upgrading to Airwallex.js for the latest features and improvements.
|
|
4
|
+
|
|
5
|
+
Comprehensive documentation for Airwallex Payment Elements is now available via Airwallex.js. Airwallex.js consolidates all Airwallex Elements into a single, unified SDK for greater efficiency and ease of integration. The SDK includes:
|
|
6
|
+
- Payment Elements (Drop-In, HPP, Card, Apple Pay, Google Pay, etc.)
|
|
7
|
+
- Payout Elements (Beneficiary, Transfer, Tax Form)
|
|
8
|
+
- Onboarding Elements (KYC, KYB)
|
|
9
|
+
- Risk Elements (RFI)
|
|
10
|
+
- Compliance Support Elements (SCA)
|
|
11
|
+
|
|
12
|
+
We recommend [upgrading to the new Airwallex.js SDK](https://www.airwallex.com/docs/developer-tools__sdks__airwallex.js__upgrade-to-airwallex.js__upgrade-from-payment-elements-sdk) to access the latest Payment Elements features and enhancements.
|
|
13
|
+
|
|
3
14
|
[](https://www.npmjs.org/package/airwallex-payment-elements)
|
|
4
15
|
[](https://github.com/semantic-release/semantic-release)
|
|
5
16
|
|
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.122.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.122.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.122.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.122.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.122.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.122.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
|
@@ -247,6 +247,10 @@ export interface HostPaymentPage {
|
|
|
247
247
|
* - `variables`: Set `colorBrand`, `colorText`, `colorBackground` properties.
|
|
248
248
|
*/
|
|
249
249
|
appearance?: Appearance;
|
|
250
|
+
/**
|
|
251
|
+
* The payment consent details.
|
|
252
|
+
*/
|
|
253
|
+
payment_consent?: PaymentConsentOptions;
|
|
250
254
|
/**
|
|
251
255
|
* The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
252
256
|
* This field is required when `mode` is `'recurring'`.
|
|
@@ -540,17 +544,95 @@ export interface PaymentMethodOptionsType {
|
|
|
540
544
|
};
|
|
541
545
|
}
|
|
542
546
|
|
|
547
|
+
/**
|
|
548
|
+
* Terms of use for recurring payments or payment agreements.
|
|
549
|
+
*/
|
|
550
|
+
export interface TermsOfUse {
|
|
551
|
+
/**
|
|
552
|
+
* The types of Payto agreements. Should be one of FIXED, VARIABLE.
|
|
553
|
+
*/
|
|
554
|
+
payment_amount_type: 'FIXED' | 'VARIABLE';
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* The fixed payment amount that can be charged for a single payment.
|
|
558
|
+
* Required if payment_amount_type is FIXED.
|
|
559
|
+
*/
|
|
560
|
+
fixed_payment_amount?: number;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* The maximum payment amount that can be charged for a single payment.
|
|
564
|
+
* Optional if payment_amount_type is VARIABLE.
|
|
565
|
+
*/
|
|
566
|
+
max_payment_amount?: number;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* The first payment. It could include the costs associated with the first debited amount.
|
|
570
|
+
* Optional if payment_amount_type is VARIABLE.
|
|
571
|
+
*/
|
|
572
|
+
first_payment_amount?: number;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Payment schedule details.
|
|
576
|
+
*/
|
|
577
|
+
payment_schedule?: {
|
|
578
|
+
/**
|
|
579
|
+
* The number of period units between billing cycles.
|
|
580
|
+
* For example, the payment cycle is one month if period=1 and period_unit=MONTH.
|
|
581
|
+
* Required when merchant_trigger_reason = scheduled.
|
|
582
|
+
*/
|
|
583
|
+
period: number;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Specifies billing frequency. One of DAY, WEEK, MONTH, and YEAR.
|
|
587
|
+
* Required when merchant_trigger_reason = scheduled.
|
|
588
|
+
*/
|
|
589
|
+
period_unit: 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The total number of billing cycles of the payment schedule.
|
|
594
|
+
* If null, the mandate will continue indefinitely.
|
|
595
|
+
*/
|
|
596
|
+
total_billing_cycles?: number;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* The granularity per billing cycle.
|
|
600
|
+
* Required when payment_schedule.period_unit is WEEK, MONTH, or YEAR.
|
|
601
|
+
*/
|
|
602
|
+
billing_cycle_charge_day?: number;
|
|
603
|
+
/**
|
|
604
|
+
* The currency of this payment.
|
|
605
|
+
*/
|
|
606
|
+
payment_currency: string;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Start date to expect payment request.
|
|
610
|
+
* @example "2025-01-01"
|
|
611
|
+
*/
|
|
612
|
+
start_date: string;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* End date to expect payment request.
|
|
616
|
+
* @example "2025-01-01"
|
|
617
|
+
*/
|
|
618
|
+
end_date?: string;
|
|
619
|
+
}
|
|
620
|
+
|
|
543
621
|
export interface PaymentConsentOptions {
|
|
544
622
|
/**
|
|
545
623
|
* Indicate the current payment initiator.
|
|
546
624
|
*/
|
|
547
625
|
next_triggered_by: 'merchant' | 'customer';
|
|
548
626
|
/**
|
|
549
|
-
* The trigger reasons for CoF. One of
|
|
627
|
+
* The trigger reasons for CoF. One of installments, unscheduled and scheduled
|
|
550
628
|
*
|
|
551
629
|
* @defaultValue `'unscheduled'`
|
|
552
630
|
*/
|
|
553
|
-
merchant_trigger_reason?: 'scheduled' | 'unscheduled';
|
|
631
|
+
merchant_trigger_reason?: 'scheduled' | 'unscheduled' | 'installments';
|
|
632
|
+
/**
|
|
633
|
+
* Specifies the agreed legal and regulatory terms governing the recurring payment arrangement between the merchant and the customer.
|
|
634
|
+
*/
|
|
635
|
+
terms_of_use?: TermsOfUse;
|
|
554
636
|
}
|
|
555
637
|
|
|
556
638
|
/**
|
|
@@ -588,7 +670,6 @@ export interface PaymentMethodRequestData {
|
|
|
588
670
|
customer_id?: string;
|
|
589
671
|
/**
|
|
590
672
|
* The payment consent details.
|
|
591
|
-
* @hidden - It is used in the second initial of recurring in cvc element to reduce multiple card number inputs. Use cvc element for recurring payment is a temporary solution since cvc is not required in this case.
|
|
592
673
|
*/
|
|
593
674
|
payment_consent?: PaymentConsentOptions;
|
|
594
675
|
/**
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PaymentMethodType, BoxStyle, CardNetwork, Appearance, CSSProperties, SelectorAllowed } from './element';
|
|
2
|
-
import { Mode, RecurringOptions, Billing, AuthorizationType, Layout } from './airwallex';
|
|
2
|
+
import { Mode, RecurringOptions, Billing, AuthorizationType, Layout, PaymentConsentOptions } from './airwallex';
|
|
3
3
|
import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions, ContactField, LPMFlows } from './element';
|
|
4
4
|
interface WeChatPayFlow {
|
|
5
5
|
desktopFlow?: LPMFlows;
|
|
@@ -58,6 +58,10 @@ export interface DropInElementOptions {
|
|
|
58
58
|
* @defaultValue `'payment'`
|
|
59
59
|
*/
|
|
60
60
|
mode?: Mode;
|
|
61
|
+
/**
|
|
62
|
+
* The payment consent details.
|
|
63
|
+
*/
|
|
64
|
+
payment_consent?: PaymentConsentOptions;
|
|
61
65
|
/**
|
|
62
66
|
* The payment methods your website would like to integrate with
|
|
63
67
|
* @deprecated use {@link methods} instead
|