@bigcommerce/checkout-sdk 1.817.0 → 1.819.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/dist/cjs/checkout-button.js +1 -1
- package/dist/cjs/checkout-sdk-essential.js +1 -1
- package/dist/cjs/checkout-sdk.js +1 -1
- package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
- package/dist/cjs/integrations/amazon-pay.js +1 -1
- package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
- package/dist/cjs/integrations/braintree.js +1 -1
- package/dist/cjs/integrations/google-pay.js +1 -1
- package/dist/cjs/integrations/klarna.js +1 -1
- package/dist/cjs/integrations/paypal-commerce.js +1 -1
- package/dist/cjs/integrations/paypal-express.js +1 -1
- package/dist/cjs/integrations/zip.js +1 -1
- package/dist/esm/checkout-button.js +1 -1
- package/dist/esm/checkout-sdk-essential.js +1 -1
- package/dist/esm/checkout-sdk.js +1 -1
- package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
- package/dist/esm/integrations/amazon-pay.js +1 -1
- package/dist/esm/integrations/bigcommerce-payments.js +1 -1
- package/dist/esm/integrations/braintree.js +1 -1
- package/dist/esm/integrations/google-pay.js +1 -1
- package/dist/esm/integrations/klarna.js +1 -1
- package/dist/esm/integrations/paypal-commerce.js +1 -1
- package/dist/esm/integrations/paypal-express.js +1 -1
- package/dist/esm/integrations/zip.js +1 -1
- package/dist/types/checkout-sdk.d.ts +71 -1
- package/docs/README.md +3 -1
- package/docs/interfaces/BraintreeCreditCardPaymentInitializeOptions.md +140 -0
- package/docs/interfaces/WithBraintreeCreditCardPaymentInitializeOptions.md +17 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getScriptLoader as e}from"@bigcommerce/script-loader";import{noop as t}from"lodash";import{createFormPoster as n}from"@bigcommerce/form-poster";var i,a,s,r,o,c,d,l,u={};function p(e,t){return Object.assign(e,{resolveIds:t})}u.d=(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class h extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}!function(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(i||(i={}));class y extends h{constructor(e){super(function(e){switch(e){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}!function(e){e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(a||(a={}));class m extends h{constructor(e){super(function(e){switch(e){case a.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case a.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case a.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case a.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class g extends h{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(s||(s={})),function(e){e.SMALL="small",e.MEDIUM="medium",e.LARGE="large",e.RESPONSIVE="responsive"}(r||(r={})),function(e){e.GOLD="gold",e.BLUE="blue",e.SIlVER="silver",e.BLACK="black"}(o||(o={})),function(e){e.CHECKOUT="checkout",e.PAY="pay",e.BUYNOW="buynow",e.PAYPAL="paypal",e.CREDIT="credit"}(c||(c={})),function(e){e.PILL="pill",e.RECT="rect"}(d||(d={})),function(e){e.ACKNOWLEDGE="ACKNOWLEDGE",e.FINALIZE="FINALIZE",e.INITIALIZE="INITIALIZE"}(l||(l={}));var f=function(e,t,n,i){return new(n||(n=Promise))(function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((i=i.apply(e,t||[])).next())})};class I{constructor(e,t){this.paymentIntegrationService=e,this.scriptLoader=t,this.useRedirectFlow=!1,this.window=window}initialize(e){return f(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState();this.paymentMethod=t.getPaymentMethodOrThrow(e.methodId),this.useRedirectFlow=!0===(e.paypalexpress&&e.paypalexpress.useRedirectFlow);const n=this.paymentMethod.config.merchantId;if(!this.isInContextEnabled()||!n)throw new y(i.MissingPaymentMethod);const a=yield this.scriptLoader.loadPaypalSDK();this.paypalSdk=a,this.paypalSdk.checkout.setup(n,{button:"paypal-button",environment:this.paymentMethod.config.testMode?"sandbox":"production"})})}deinitialize(){return this.isInContextEnabled()&&this.paypalSdk&&(this.paypalSdk.checkout.closeFlow(),this.paypalSdk=void 0),Promise.resolve()}execute(e,n){return f(this,void 0,void 0,function*(){let i,s;const r=this.paypalSdk;if(!this.isAcknowledgedOrFinalized()){if(!this.isInContextEnabled()||this.useRedirectFlow)return i=yield this.paymentIntegrationService.submitOrder(e,n),s=i.getPaymentRedirectUrl(),s&&this.window.top&&(this.window.top.location.href=s),new Promise(t);if(!r)throw new m(a.PaymentNotInitialized);r.checkout.initXO();try{i=yield this.paymentIntegrationService.submitOrder(e,n)}catch(e){return r.checkout.closeFlow(),Promise.reject(e)}return s=i.getPaymentRedirectUrl(),s&&r.checkout.startFlow(s),new Promise(t)}yield this.paymentIntegrationService.submitOrder(e,n)})}finalize(e){return f(this,void 0,void 0,function*(){return this.paymentIntegrationService.getState().getOrder()&&this.isAcknowledgedOrFinalized()?(yield this.paymentIntegrationService.finalizeOrder(e),Promise.resolve()):Promise.reject(new g)})}isAcknowledgedOrFinalized(){const e=this.paymentIntegrationService.getState();return e.getPaymentStatus()===l.ACKNOWLEDGE||e.getPaymentStatus()===l.FINALIZE}isInContextEnabled(){return!(!this.paymentMethod||!this.paymentMethod.config.merchantId)}}class b extends h{constructor(e){super(e||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}class w{constructor(e){this.scriptLoader=e,this.window=window}loadPaypalSDK(e=""){return t=this,n=void 0,a=function*(){const t=Object.assign({async:!0,attributes:{"data-merchant-id":e}},e&&{attributes:{"data-merchant-id":e}});if(yield this.scriptLoader.loadScript("//www.paypalobjects.com/api/checkout.min.js",t),!this.window.paypal)throw new b;return this.window.paypal},new((i=void 0)||(i=Promise))(function(e,s){function r(e){try{c(a.next(e))}catch(e){s(e)}}function o(e){try{c(a.throw(e))}catch(e){s(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(r,o)}c((a=a.apply(t,n||[])).next())});var t,n,i,a}}const P=p(t=>new I(t,new w(e())),[{id:"paypalexpress",type:"PAYMENT_TYPE_HOSTED"},{id:"paypalexpresscredit",type:"PAYMENT_TYPE_HOSTED"}]);class M extends h{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}const v={"X-Checkout-SDK-Version":"1.817.0"};var S=function(e,t,n,i){return new(n||(n=Promise))(function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((i=i.apply(e,t||[])).next())})};class E{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalExpressScriptLoader=t,this.formPoster=n}initialize(e){return S(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e.methodId);if(!e.paypal)throw new M;if(!t.config.merchantId)throw new y(i.MissingPaymentMethod);const n=yield this.paypalExpressScriptLoader.loadPaypalSDK(t.config.merchantId);this.renderButton(e,n)})}deinitialize(){return Promise.resolve()}renderButton(e,t){const{containerId:n,methodId:a,paypal:s}=e,{allowCredit:r,clientId:o,onPaymentError:c,shouldProcessPayment:d,style:l}=s,u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e.methodId);if(!u.config.merchantId)throw new y(i.MissingPaymentMethod);const p=u.config.merchantId,h=u.config.testMode?"sandbox":"production",m={[h]:o},g=t.FUNDING.CREDIT||"credit",f=r?[g]:[],I=r?[]:[g];return t.Button.render({env:h,client:m,commit:d,funding:{allowed:f,disallowed:I},style:this.getStyle(l),payment:(e,t)=>this.setupPayment(p,t,c),onAuthorize:(e,t)=>this.tokenizePayment(e,a,t,d)},n)}getStyle(e){const{color:t,fundingicons:n,label:i,layout:a,shape:s,size:o,tagline:c}=e||{};return{color:t,fundingicons:n,label:i,layout:a,shape:s||d.RECT,size:"small"===o?r.RESPONSIVE:o,tagline:c}}setupPayment(e,t,n){return S(this,void 0,void 0,function*(){if(!t)throw new m(a.CheckoutButtonNotInitialized);try{const n=yield this.paymentIntegrationService.loadDefaultCheckout(),{id:i}=n.getCartOrThrow(),a=n.getHost()||"";return(yield t.request.post(`${a}/api/storefront/payment/paypalexpress`,{merchantId:e,cartId:i},{headers:Object.assign({"X-API-INTERNAL":"This API endpoint is for internal use only and may change in the future"},v)})).id}catch(e){throw n&&e instanceof h&&n(e),e}})}tokenizePayment(e,t,n,s){return S(this,void 0,void 0,function*(){if(!n)throw new m(a.CheckoutButtonNotInitialized);if(!e.paymentID||!e.payerID)throw new y(i.MissingPayment);const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),o=yield n.payment.get(e.paymentID);return this.formPoster.postForm("/checkout.php",{payment_type:"paypal",provider:r.id,action:s?"process_payment":"set_external_checkout",paymentId:e.paymentID,payerId:e.payerID,payerInfo:JSON.stringify(o.payer.payer_info)})})}}const C=p(t=>new E(t,new w(e()),n()),[{id:"paypalexpress"}]);export{C as createPaypalExpressButtonStrategy,P as createPaypalExpressPaymentStrategy};
|
|
1
|
+
import{getScriptLoader as e}from"@bigcommerce/script-loader";import{noop as t}from"lodash";import{createFormPoster as n}from"@bigcommerce/form-poster";var i,a,s,r,o,c,d,l,u={};function p(e,t){return Object.assign(e,{resolveIds:t})}u.d=(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class h extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}!function(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(i||(i={}));class y extends h{constructor(e){super(function(e){switch(e){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}!function(e){e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(a||(a={}));class m extends h{constructor(e){super(function(e){switch(e){case a.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case a.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case a.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case a.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class g extends h{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}!function(e){e.HORIZONTAL="horizontal",e.VERTICAL="vertical"}(s||(s={})),function(e){e.SMALL="small",e.MEDIUM="medium",e.LARGE="large",e.RESPONSIVE="responsive"}(r||(r={})),function(e){e.GOLD="gold",e.BLUE="blue",e.SIlVER="silver",e.BLACK="black"}(o||(o={})),function(e){e.CHECKOUT="checkout",e.PAY="pay",e.BUYNOW="buynow",e.PAYPAL="paypal",e.CREDIT="credit"}(c||(c={})),function(e){e.PILL="pill",e.RECT="rect"}(d||(d={})),function(e){e.ACKNOWLEDGE="ACKNOWLEDGE",e.FINALIZE="FINALIZE",e.INITIALIZE="INITIALIZE"}(l||(l={}));var f=function(e,t,n,i){return new(n||(n=Promise))(function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((i=i.apply(e,t||[])).next())})};class I{constructor(e,t){this.paymentIntegrationService=e,this.scriptLoader=t,this.useRedirectFlow=!1,this.window=window}initialize(e){return f(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState();this.paymentMethod=t.getPaymentMethodOrThrow(e.methodId),this.useRedirectFlow=!0===(e.paypalexpress&&e.paypalexpress.useRedirectFlow);const n=this.paymentMethod.config.merchantId;if(!this.isInContextEnabled()||!n)throw new y(i.MissingPaymentMethod);const a=yield this.scriptLoader.loadPaypalSDK();this.paypalSdk=a,this.paypalSdk.checkout.setup(n,{button:"paypal-button",environment:this.paymentMethod.config.testMode?"sandbox":"production"})})}deinitialize(){return this.isInContextEnabled()&&this.paypalSdk&&(this.paypalSdk.checkout.closeFlow(),this.paypalSdk=void 0),Promise.resolve()}execute(e,n){return f(this,void 0,void 0,function*(){let i,s;const r=this.paypalSdk;if(!this.isAcknowledgedOrFinalized()){if(!this.isInContextEnabled()||this.useRedirectFlow)return i=yield this.paymentIntegrationService.submitOrder(e,n),s=i.getPaymentRedirectUrl(),s&&this.window.top&&(this.window.top.location.href=s),new Promise(t);if(!r)throw new m(a.PaymentNotInitialized);r.checkout.initXO();try{i=yield this.paymentIntegrationService.submitOrder(e,n)}catch(e){return r.checkout.closeFlow(),Promise.reject(e)}return s=i.getPaymentRedirectUrl(),s&&r.checkout.startFlow(s),new Promise(t)}yield this.paymentIntegrationService.submitOrder(e,n)})}finalize(e){return f(this,void 0,void 0,function*(){return this.paymentIntegrationService.getState().getOrder()&&this.isAcknowledgedOrFinalized()?(yield this.paymentIntegrationService.finalizeOrder(e),Promise.resolve()):Promise.reject(new g)})}isAcknowledgedOrFinalized(){const e=this.paymentIntegrationService.getState();return e.getPaymentStatus()===l.ACKNOWLEDGE||e.getPaymentStatus()===l.FINALIZE}isInContextEnabled(){return!(!this.paymentMethod||!this.paymentMethod.config.merchantId)}}class b extends h{constructor(e){super(e||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}class w{constructor(e){this.scriptLoader=e,this.window=window}loadPaypalSDK(e=""){return t=this,n=void 0,a=function*(){const t=Object.assign({async:!0,attributes:{"data-merchant-id":e}},e&&{attributes:{"data-merchant-id":e}});if(yield this.scriptLoader.loadScript("//www.paypalobjects.com/api/checkout.min.js",t),!this.window.paypal)throw new b;return this.window.paypal},new((i=void 0)||(i=Promise))(function(e,s){function r(e){try{c(a.next(e))}catch(e){s(e)}}function o(e){try{c(a.throw(e))}catch(e){s(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(r,o)}c((a=a.apply(t,n||[])).next())});var t,n,i,a}}const P=p(t=>new I(t,new w(e())),[{id:"paypalexpress",type:"PAYMENT_TYPE_HOSTED"},{id:"paypalexpresscredit",type:"PAYMENT_TYPE_HOSTED"}]);class M extends h{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}const v={"X-Checkout-SDK-Version":"1.819.0"};var S=function(e,t,n,i){return new(n||(n=Promise))(function(a,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,o)}c((i=i.apply(e,t||[])).next())})};class E{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalExpressScriptLoader=t,this.formPoster=n}initialize(e){return S(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e.methodId);if(!e.paypal)throw new M;if(!t.config.merchantId)throw new y(i.MissingPaymentMethod);const n=yield this.paypalExpressScriptLoader.loadPaypalSDK(t.config.merchantId);this.renderButton(e,n)})}deinitialize(){return Promise.resolve()}renderButton(e,t){const{containerId:n,methodId:a,paypal:s}=e,{allowCredit:r,clientId:o,onPaymentError:c,shouldProcessPayment:d,style:l}=s,u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e.methodId);if(!u.config.merchantId)throw new y(i.MissingPaymentMethod);const p=u.config.merchantId,h=u.config.testMode?"sandbox":"production",m={[h]:o},g=t.FUNDING.CREDIT||"credit",f=r?[g]:[],I=r?[]:[g];return t.Button.render({env:h,client:m,commit:d,funding:{allowed:f,disallowed:I},style:this.getStyle(l),payment:(e,t)=>this.setupPayment(p,t,c),onAuthorize:(e,t)=>this.tokenizePayment(e,a,t,d)},n)}getStyle(e){const{color:t,fundingicons:n,label:i,layout:a,shape:s,size:o,tagline:c}=e||{};return{color:t,fundingicons:n,label:i,layout:a,shape:s||d.RECT,size:"small"===o?r.RESPONSIVE:o,tagline:c}}setupPayment(e,t,n){return S(this,void 0,void 0,function*(){if(!t)throw new m(a.CheckoutButtonNotInitialized);try{const n=yield this.paymentIntegrationService.loadDefaultCheckout(),{id:i}=n.getCartOrThrow(),a=n.getHost()||"";return(yield t.request.post(`${a}/api/storefront/payment/paypalexpress`,{merchantId:e,cartId:i},{headers:Object.assign({"X-API-INTERNAL":"This API endpoint is for internal use only and may change in the future"},v)})).id}catch(e){throw n&&e instanceof h&&n(e),e}})}tokenizePayment(e,t,n,s){return S(this,void 0,void 0,function*(){if(!n)throw new m(a.CheckoutButtonNotInitialized);if(!e.paymentID||!e.payerID)throw new y(i.MissingPayment);const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),o=yield n.payment.get(e.paymentID);return this.formPoster.postForm("/checkout.php",{payment_type:"paypal",provider:r.id,action:s?"process_payment":"set_external_checkout",paymentId:e.paymentID,payerId:e.payerID,payerInfo:JSON.stringify(o.payer.payer_info)})})}}const C=p(t=>new E(t,new w(e()),n()),[{id:"paypalexpress"}]);export{C as createPaypalExpressButtonStrategy,P as createPaypalExpressPaymentStrategy};
|
|
2
2
|
//# sourceMappingURL=paypal-express.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequestSender as e}from"@bigcommerce/request-sender";var t;(function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"})(t||(t={}));const n=t,i={"X-Checkout-SDK-Version":"1.
|
|
1
|
+
import{createRequestSender as e}from"@bigcommerce/request-sender";var t;(function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"})(t||(t={}));const n=t,i={"X-Checkout-SDK-Version":"1.819.0"};var r;class s{constructor(e){this._requestSender=e}saveExternalId(e,t){return r=this,s=void 0,o=function*(){const r=`/api/storefront/payment/${e}/save-external-id`,s={headers:Object.assign({Accept:n.JsonV1,"X-API-INTERNAL":"This API endpoint is for internal use only and may change in the future"},i),body:{externalId:t,provider:e}};yield this._requestSender.post(r,s)},new((a=void 0)||(a=Promise))(function(e,t){function n(e){try{c(o.next(e))}catch(e){t(e)}}function i(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(n,i)}c((o=o.apply(r,s||[])).next())});var r,s,a,o}}class a extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class o extends a{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class c extends o{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}!function(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(r||(r={}));class d extends a{constructor(e){super(function(e){switch(e){case r.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case r.MissingCart:return"Unable to proceed because cart data is unavailable.";case r.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case r.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case r.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case r.MissingCheckoutConfig:case r.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case r.MissingOrder:return"Unable to proceed because order data is unavailable.";case r.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case r.MissingPayment:return"Unable to proceed because payment data is unavailable.";case r.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case r.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case r.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}class u extends a{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}class l{constructor(e,t){this.paymentIntegrationService=e,this.storefrontPaymentRequestSender=t}initialize(){return Promise.resolve()}execute(e,t){return n=this,i=void 0,a=function*(){const{payment:n}=e,i=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["payment"]);if(!n)throw new c(["payment"]);const{methodId:s}=n,{getPaymentMethodOrThrow:a}=yield this.paymentIntegrationService.loadPaymentMethod(s,t),{clientToken:o,initializationData:u}=a(s),l=null==u?void 0:u.redirectUrl;if(!o||!l)throw new d(r.MissingPaymentMethod);const{id:g}=JSON.parse(o);if(!g)throw new d(r.MissingPaymentToken);const{isStoreCreditApplied:p}=this.paymentIntegrationService.getState().getCheckoutOrThrow();yield this.paymentIntegrationService.applyStoreCredit(p),yield this.paymentIntegrationService.initializePayment(s,{useStoreCredit:p}),yield this.paymentIntegrationService.submitOrder(i,t),yield this._prepareForReferredRegistration(s,g);try{yield this.paymentIntegrationService.submitPayment({methodId:s,paymentData:{nonce:g}})}catch(e){if((e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&"additional_action_required"===e.body.status)return new Promise(()=>window.location.replace(l));throw e}},new((s=void 0)||(s=Promise))(function(e,t){function r(e){try{c(a.next(e))}catch(e){t(e)}}function o(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s(function(e){e(n)})).then(r,o)}c((a=a.apply(n,i||[])).next())});var n,i,s,a}finalize(){return Promise.reject(new u)}deinitialize(){return Promise.resolve()}_prepareForReferredRegistration(e,t){return this.storefrontPaymentRequestSender.saveExternalId(e,t)}}const g=(p=t=>{const{getHost:n}=t.getState(),i=e({host:n()}),r=new s(i);return new l(t,r)},y=[{id:"zip"},{id:"quadpay"}],Object.assign(p,{resolveIds:y}));var p,y;export{g as createZipPaymentStrategy};
|
|
2
2
|
//# sourceMappingURL=zip.js.map
|
|
@@ -6,6 +6,8 @@ import { AmazonPayV2ButtonConfig } from '@bigcommerce/checkout-sdk/amazon-pay-ut
|
|
|
6
6
|
import { AmazonPayV2ButtonParameters } from '@bigcommerce/checkout-sdk/amazon-pay-utils';
|
|
7
7
|
import { BraintreeError } from '@bigcommerce/checkout-sdk/braintree-utils';
|
|
8
8
|
import { BraintreeFastlaneStylesOption } from '@bigcommerce/checkout-sdk/braintree-utils';
|
|
9
|
+
import { BraintreeFormOptions } from '@bigcommerce/checkout-sdk/braintree-utils';
|
|
10
|
+
import { BraintreeThreeDSecureOptions } from '@bigcommerce/checkout-sdk/braintree-utils';
|
|
9
11
|
import { BuyNowCartRequestBody } from '@bigcommerce/checkout-sdk/payment-integration-api';
|
|
10
12
|
import { CardClassSelectors } from '@square/web-payments-sdk-types';
|
|
11
13
|
import { CardInstrument as CardInstrument_2 } from '@bigcommerce/checkout-sdk/payment-integration-api';
|
|
@@ -1877,6 +1879,67 @@ declare interface BraintreeAnalyticTrackerService {
|
|
|
1877
1879
|
walletButtonClick(methodId: string): void;
|
|
1878
1880
|
}
|
|
1879
1881
|
|
|
1882
|
+
declare interface BraintreeCreditCardPaymentInitializeOptions {
|
|
1883
|
+
/**
|
|
1884
|
+
* A list of card brands that are not supported by the merchant.
|
|
1885
|
+
*
|
|
1886
|
+
* List of supported brands by braintree can be found here: https://braintree.github.io/braintree-web/current/module-braintree-web_hosted-fields.html#~field
|
|
1887
|
+
* search for `supportedCardBrands` property.
|
|
1888
|
+
*
|
|
1889
|
+
* List of credit cards brands:
|
|
1890
|
+
* 'visa',
|
|
1891
|
+
* 'mastercard',
|
|
1892
|
+
* 'american-express',
|
|
1893
|
+
* 'diners-club',
|
|
1894
|
+
* 'discover',
|
|
1895
|
+
* 'jcb',
|
|
1896
|
+
* 'union-pay',
|
|
1897
|
+
* 'maestro',
|
|
1898
|
+
* 'elo',
|
|
1899
|
+
* 'mir',
|
|
1900
|
+
* 'hiper',
|
|
1901
|
+
* 'hipercard'
|
|
1902
|
+
*
|
|
1903
|
+
* */
|
|
1904
|
+
unsupportedCardBrands?: string[];
|
|
1905
|
+
/**
|
|
1906
|
+
* The CSS selector of a container where the payment widget should be inserted into.
|
|
1907
|
+
*/
|
|
1908
|
+
containerId?: string;
|
|
1909
|
+
threeDSecure?: BraintreeThreeDSecureOptions;
|
|
1910
|
+
/**
|
|
1911
|
+
* @alpha
|
|
1912
|
+
* Please note that this option is currently in an early stage of
|
|
1913
|
+
* development. Therefore the API is unstable and not ready for public
|
|
1914
|
+
* consumption.
|
|
1915
|
+
*/
|
|
1916
|
+
form?: BraintreeFormOptions;
|
|
1917
|
+
/**
|
|
1918
|
+
* The location to insert the Pay Later Messages.
|
|
1919
|
+
*/
|
|
1920
|
+
bannerContainerId?: string;
|
|
1921
|
+
/**
|
|
1922
|
+
* A callback right before render Smart Payment Button that gets called when
|
|
1923
|
+
* Smart Payment Button is eligible. This callback can be used to hide the standard submit button.
|
|
1924
|
+
*/
|
|
1925
|
+
onRenderButton?(): void;
|
|
1926
|
+
/**
|
|
1927
|
+
* A callback for submitting payment form that gets called
|
|
1928
|
+
* when buyer approved PayPal account.
|
|
1929
|
+
*/
|
|
1930
|
+
submitForm?(): void;
|
|
1931
|
+
/**
|
|
1932
|
+
* A callback that gets called if unable to submit payment.
|
|
1933
|
+
*
|
|
1934
|
+
* @param error - The error object describing the failure.
|
|
1935
|
+
*/
|
|
1936
|
+
onPaymentError?(error: BraintreeError | StandardError_2): void;
|
|
1937
|
+
/**
|
|
1938
|
+
* A callback for displaying error popup. This callback requires error object as parameter.
|
|
1939
|
+
*/
|
|
1940
|
+
onError?(error: unknown): void;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1880
1943
|
/**
|
|
1881
1944
|
* A set of options that are optional to initialize the Braintree Fastlane customer strategy
|
|
1882
1945
|
* that are responsible for Braintree Fastlane components styling and initialization
|
|
@@ -7454,7 +7517,7 @@ declare class PaymentHumanVerificationHandler {
|
|
|
7454
7517
|
private _isPaymentHumanVerificationRequest;
|
|
7455
7518
|
}
|
|
7456
7519
|
|
|
7457
|
-
declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAmazonPayV2PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBigCommercePaymentsPaymentInitializeOptions & WithBigCommercePaymentsFastlanePaymentInitializeOptions & WithBigCommercePaymentsPayLaterPaymentInitializeOptions & WithBigCommercePaymentsRatePayPaymentInitializeOptions & WithBigCommercePaymentsCreditCardsPaymentInitializeOptions & WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions & WithBigCommercePaymentsVenmoPaymentInitializeOptions & WithBlueSnapDirectAPMPaymentInitializeOptions & WithBlueSnapV2PaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithBraintreeAchPaymentInitializeOptions & WithBraintreeLocalMethodsPaymentInitializeOptions & WithBraintreeFastlanePaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithGooglePayPaymentInitializeOptions & WithMolliePaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditPaymentInitializeOptions & WithPayPalCommerceVenmoPaymentInitializeOptions & WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithPayPalCommerceRatePayPaymentInitializeOptions & WithPayPalCommerceFastlanePaymentInitializeOptions & WithPaypalExpressPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions & WithStripeV3PaymentInitializeOptions & WithStripeUPEPaymentInitializeOptions & WithStripeOCSPaymentInitializeOptions & WithWorldpayAccessPaymentInitializeOptions;
|
|
7520
|
+
declare type PaymentInitializeOptions = BasePaymentInitializeOptions & WithAdyenV3PaymentInitializeOptions & WithAdyenV2PaymentInitializeOptions & WithAmazonPayV2PaymentInitializeOptions & WithApplePayPaymentInitializeOptions & WithBigCommercePaymentsPaymentInitializeOptions & WithBigCommercePaymentsFastlanePaymentInitializeOptions & WithBigCommercePaymentsPayLaterPaymentInitializeOptions & WithBigCommercePaymentsRatePayPaymentInitializeOptions & WithBigCommercePaymentsCreditCardsPaymentInitializeOptions & WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions & WithBigCommercePaymentsVenmoPaymentInitializeOptions & WithBlueSnapDirectAPMPaymentInitializeOptions & WithBlueSnapV2PaymentInitializeOptions & WithBoltPaymentInitializeOptions & WithBraintreeAchPaymentInitializeOptions & WithBraintreeLocalMethodsPaymentInitializeOptions & WithBraintreeFastlanePaymentInitializeOptions & WithBraintreeCreditCardPaymentInitializeOptions & WithCreditCardPaymentInitializeOptions & WithGooglePayPaymentInitializeOptions & WithMolliePaymentInitializeOptions & WithPayPalCommercePaymentInitializeOptions & WithPayPalCommerceCreditPaymentInitializeOptions & WithPayPalCommerceVenmoPaymentInitializeOptions & WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions & WithPayPalCommerceCreditCardsPaymentInitializeOptions & WithPayPalCommerceRatePayPaymentInitializeOptions & WithPayPalCommerceFastlanePaymentInitializeOptions & WithPaypalExpressPaymentInitializeOptions & WithSquareV2PaymentInitializeOptions & WithStripeV3PaymentInitializeOptions & WithStripeUPEPaymentInitializeOptions & WithStripeOCSPaymentInitializeOptions & WithWorldpayAccessPaymentInitializeOptions;
|
|
7458
7521
|
|
|
7459
7522
|
declare type PaymentInstrument = CardInstrument | AccountInstrument;
|
|
7460
7523
|
|
|
@@ -8834,6 +8897,13 @@ declare interface WithBraintreeAchPaymentInitializeOptions {
|
|
|
8834
8897
|
braintreeach?: BraintreeAchInitializeOptions;
|
|
8835
8898
|
}
|
|
8836
8899
|
|
|
8900
|
+
declare interface WithBraintreeCreditCardPaymentInitializeOptions {
|
|
8901
|
+
/**
|
|
8902
|
+
* The options that are required to initialize Braintree PayPal wallet button on Product and Cart page.
|
|
8903
|
+
*/
|
|
8904
|
+
braintree?: BraintreeCreditCardPaymentInitializeOptions;
|
|
8905
|
+
}
|
|
8906
|
+
|
|
8837
8907
|
declare interface WithBraintreeFastlaneCustomerInitializeOptions {
|
|
8838
8908
|
braintreefastlane?: BraintreeFastlaneCustomerInitializeOptions;
|
|
8839
8909
|
}
|
package/docs/README.md
CHANGED
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
- [BoltPaymentInitializeOptions](interfaces/BoltPaymentInitializeOptions.md)
|
|
138
138
|
- [BraintreeAchInitializeOptions](interfaces/BraintreeAchInitializeOptions.md)
|
|
139
139
|
- [BraintreeAnalyticTrackerService](interfaces/BraintreeAnalyticTrackerService.md)
|
|
140
|
+
- [BraintreeCreditCardPaymentInitializeOptions](interfaces/BraintreeCreditCardPaymentInitializeOptions.md)
|
|
140
141
|
- [BraintreeFastlaneCustomerInitializeOptions](interfaces/BraintreeFastlaneCustomerInitializeOptions.md)
|
|
141
142
|
- [BraintreeFastlanePaymentInitializeOptions](interfaces/BraintreeFastlanePaymentInitializeOptions.md)
|
|
142
143
|
- [BraintreeFastlaneShippingInitializeOptions](interfaces/BraintreeFastlaneShippingInitializeOptions.md)
|
|
@@ -473,6 +474,7 @@
|
|
|
473
474
|
- [WithBoltCustomerInitializeOptions](interfaces/WithBoltCustomerInitializeOptions.md)
|
|
474
475
|
- [WithBoltPaymentInitializeOptions](interfaces/WithBoltPaymentInitializeOptions.md)
|
|
475
476
|
- [WithBraintreeAchPaymentInitializeOptions](interfaces/WithBraintreeAchPaymentInitializeOptions.md)
|
|
477
|
+
- [WithBraintreeCreditCardPaymentInitializeOptions](interfaces/WithBraintreeCreditCardPaymentInitializeOptions.md)
|
|
476
478
|
- [WithBraintreeFastlaneCustomerInitializeOptions](interfaces/WithBraintreeFastlaneCustomerInitializeOptions.md)
|
|
477
479
|
- [WithBraintreeFastlanePaymentInitializeOptions](interfaces/WithBraintreeFastlanePaymentInitializeOptions.md)
|
|
478
480
|
- [WithBraintreeLocalMethodsPaymentInitializeOptions](interfaces/WithBraintreeLocalMethodsPaymentInitializeOptions.md)
|
|
@@ -851,7 +853,7 @@ ___
|
|
|
851
853
|
|
|
852
854
|
### PaymentInitializeOptions
|
|
853
855
|
|
|
854
|
-
Ƭ **PaymentInitializeOptions**: [`BasePaymentInitializeOptions`](interfaces/BasePaymentInitializeOptions.md) & [`WithAdyenV3PaymentInitializeOptions`](interfaces/WithAdyenV3PaymentInitializeOptions.md) & [`WithAdyenV2PaymentInitializeOptions`](interfaces/WithAdyenV2PaymentInitializeOptions.md) & [`WithAmazonPayV2PaymentInitializeOptions`](interfaces/WithAmazonPayV2PaymentInitializeOptions.md) & [`WithApplePayPaymentInitializeOptions`](interfaces/WithApplePayPaymentInitializeOptions.md) & [`WithBigCommercePaymentsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsFastlanePaymentInitializeOptions`](interfaces/WithBigCommercePaymentsFastlanePaymentInitializeOptions.md) & [`WithBigCommercePaymentsPayLaterPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsPayLaterPaymentInitializeOptions.md) & [`WithBigCommercePaymentsRatePayPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsRatePayPaymentInitializeOptions.md) & [`WithBigCommercePaymentsCreditCardsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsCreditCardsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsVenmoPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsVenmoPaymentInitializeOptions.md) & [`WithBlueSnapDirectAPMPaymentInitializeOptions`](interfaces/WithBlueSnapDirectAPMPaymentInitializeOptions.md) & [`WithBlueSnapV2PaymentInitializeOptions`](interfaces/WithBlueSnapV2PaymentInitializeOptions.md) & [`WithBoltPaymentInitializeOptions`](interfaces/WithBoltPaymentInitializeOptions.md) & [`WithBraintreeAchPaymentInitializeOptions`](interfaces/WithBraintreeAchPaymentInitializeOptions.md) & [`WithBraintreeLocalMethodsPaymentInitializeOptions`](interfaces/WithBraintreeLocalMethodsPaymentInitializeOptions.md) & [`WithBraintreeFastlanePaymentInitializeOptions`](interfaces/WithBraintreeFastlanePaymentInitializeOptions.md) & [`WithCreditCardPaymentInitializeOptions`](interfaces/WithCreditCardPaymentInitializeOptions.md) & [`WithGooglePayPaymentInitializeOptions`](README.md#withgooglepaypaymentinitializeoptions) & [`WithMolliePaymentInitializeOptions`](interfaces/WithMolliePaymentInitializeOptions.md) & [`WithPayPalCommercePaymentInitializeOptions`](interfaces/WithPayPalCommercePaymentInitializeOptions.md) & [`WithPayPalCommerceCreditPaymentInitializeOptions`](interfaces/WithPayPalCommerceCreditPaymentInitializeOptions.md) & [`WithPayPalCommerceVenmoPaymentInitializeOptions`](interfaces/WithPayPalCommerceVenmoPaymentInitializeOptions.md) & [`WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions`](interfaces/WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions.md) & [`WithPayPalCommerceCreditCardsPaymentInitializeOptions`](interfaces/WithPayPalCommerceCreditCardsPaymentInitializeOptions.md) & [`WithPayPalCommerceRatePayPaymentInitializeOptions`](interfaces/WithPayPalCommerceRatePayPaymentInitializeOptions.md) & [`WithPayPalCommerceFastlanePaymentInitializeOptions`](interfaces/WithPayPalCommerceFastlanePaymentInitializeOptions.md) & [`WithPaypalExpressPaymentInitializeOptions`](interfaces/WithPaypalExpressPaymentInitializeOptions.md) & [`WithSquareV2PaymentInitializeOptions`](interfaces/WithSquareV2PaymentInitializeOptions.md) & [`WithStripeV3PaymentInitializeOptions`](interfaces/WithStripeV3PaymentInitializeOptions.md) & [`WithStripeUPEPaymentInitializeOptions`](interfaces/WithStripeUPEPaymentInitializeOptions.md) & [`WithStripeOCSPaymentInitializeOptions`](interfaces/WithStripeOCSPaymentInitializeOptions.md) & [`WithWorldpayAccessPaymentInitializeOptions`](interfaces/WithWorldpayAccessPaymentInitializeOptions.md)
|
|
856
|
+
Ƭ **PaymentInitializeOptions**: [`BasePaymentInitializeOptions`](interfaces/BasePaymentInitializeOptions.md) & [`WithAdyenV3PaymentInitializeOptions`](interfaces/WithAdyenV3PaymentInitializeOptions.md) & [`WithAdyenV2PaymentInitializeOptions`](interfaces/WithAdyenV2PaymentInitializeOptions.md) & [`WithAmazonPayV2PaymentInitializeOptions`](interfaces/WithAmazonPayV2PaymentInitializeOptions.md) & [`WithApplePayPaymentInitializeOptions`](interfaces/WithApplePayPaymentInitializeOptions.md) & [`WithBigCommercePaymentsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsFastlanePaymentInitializeOptions`](interfaces/WithBigCommercePaymentsFastlanePaymentInitializeOptions.md) & [`WithBigCommercePaymentsPayLaterPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsPayLaterPaymentInitializeOptions.md) & [`WithBigCommercePaymentsRatePayPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsRatePayPaymentInitializeOptions.md) & [`WithBigCommercePaymentsCreditCardsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsCreditCardsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsAlternativeMethodsPaymentInitializeOptions.md) & [`WithBigCommercePaymentsVenmoPaymentInitializeOptions`](interfaces/WithBigCommercePaymentsVenmoPaymentInitializeOptions.md) & [`WithBlueSnapDirectAPMPaymentInitializeOptions`](interfaces/WithBlueSnapDirectAPMPaymentInitializeOptions.md) & [`WithBlueSnapV2PaymentInitializeOptions`](interfaces/WithBlueSnapV2PaymentInitializeOptions.md) & [`WithBoltPaymentInitializeOptions`](interfaces/WithBoltPaymentInitializeOptions.md) & [`WithBraintreeAchPaymentInitializeOptions`](interfaces/WithBraintreeAchPaymentInitializeOptions.md) & [`WithBraintreeLocalMethodsPaymentInitializeOptions`](interfaces/WithBraintreeLocalMethodsPaymentInitializeOptions.md) & [`WithBraintreeFastlanePaymentInitializeOptions`](interfaces/WithBraintreeFastlanePaymentInitializeOptions.md) & [`WithBraintreeCreditCardPaymentInitializeOptions`](interfaces/WithBraintreeCreditCardPaymentInitializeOptions.md) & [`WithCreditCardPaymentInitializeOptions`](interfaces/WithCreditCardPaymentInitializeOptions.md) & [`WithGooglePayPaymentInitializeOptions`](README.md#withgooglepaypaymentinitializeoptions) & [`WithMolliePaymentInitializeOptions`](interfaces/WithMolliePaymentInitializeOptions.md) & [`WithPayPalCommercePaymentInitializeOptions`](interfaces/WithPayPalCommercePaymentInitializeOptions.md) & [`WithPayPalCommerceCreditPaymentInitializeOptions`](interfaces/WithPayPalCommerceCreditPaymentInitializeOptions.md) & [`WithPayPalCommerceVenmoPaymentInitializeOptions`](interfaces/WithPayPalCommerceVenmoPaymentInitializeOptions.md) & [`WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions`](interfaces/WithPayPalCommerceAlternativeMethodsPaymentInitializeOptions.md) & [`WithPayPalCommerceCreditCardsPaymentInitializeOptions`](interfaces/WithPayPalCommerceCreditCardsPaymentInitializeOptions.md) & [`WithPayPalCommerceRatePayPaymentInitializeOptions`](interfaces/WithPayPalCommerceRatePayPaymentInitializeOptions.md) & [`WithPayPalCommerceFastlanePaymentInitializeOptions`](interfaces/WithPayPalCommerceFastlanePaymentInitializeOptions.md) & [`WithPaypalExpressPaymentInitializeOptions`](interfaces/WithPaypalExpressPaymentInitializeOptions.md) & [`WithSquareV2PaymentInitializeOptions`](interfaces/WithSquareV2PaymentInitializeOptions.md) & [`WithStripeV3PaymentInitializeOptions`](interfaces/WithStripeV3PaymentInitializeOptions.md) & [`WithStripeUPEPaymentInitializeOptions`](interfaces/WithStripeUPEPaymentInitializeOptions.md) & [`WithStripeOCSPaymentInitializeOptions`](interfaces/WithStripeOCSPaymentInitializeOptions.md) & [`WithWorldpayAccessPaymentInitializeOptions`](interfaces/WithWorldpayAccessPaymentInitializeOptions.md)
|
|
855
857
|
|
|
856
858
|
___
|
|
857
859
|
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
[@bigcommerce/checkout-sdk](../README.md) / BraintreeCreditCardPaymentInitializeOptions
|
|
2
|
+
|
|
3
|
+
# Interface: BraintreeCreditCardPaymentInitializeOptions
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Properties
|
|
8
|
+
|
|
9
|
+
- [bannerContainerId](BraintreeCreditCardPaymentInitializeOptions.md#bannercontainerid)
|
|
10
|
+
- [containerId](BraintreeCreditCardPaymentInitializeOptions.md#containerid)
|
|
11
|
+
- [form](BraintreeCreditCardPaymentInitializeOptions.md#form)
|
|
12
|
+
- [threeDSecure](BraintreeCreditCardPaymentInitializeOptions.md#threedsecure)
|
|
13
|
+
- [unsupportedCardBrands](BraintreeCreditCardPaymentInitializeOptions.md#unsupportedcardbrands)
|
|
14
|
+
|
|
15
|
+
### Methods
|
|
16
|
+
|
|
17
|
+
- [onError](BraintreeCreditCardPaymentInitializeOptions.md#onerror)
|
|
18
|
+
- [onPaymentError](BraintreeCreditCardPaymentInitializeOptions.md#onpaymenterror)
|
|
19
|
+
- [onRenderButton](BraintreeCreditCardPaymentInitializeOptions.md#onrenderbutton)
|
|
20
|
+
- [submitForm](BraintreeCreditCardPaymentInitializeOptions.md#submitform)
|
|
21
|
+
|
|
22
|
+
## Properties
|
|
23
|
+
|
|
24
|
+
### bannerContainerId
|
|
25
|
+
|
|
26
|
+
• `Optional` **bannerContainerId**: `string`
|
|
27
|
+
|
|
28
|
+
The location to insert the Pay Later Messages.
|
|
29
|
+
|
|
30
|
+
___
|
|
31
|
+
|
|
32
|
+
### containerId
|
|
33
|
+
|
|
34
|
+
• `Optional` **containerId**: `string`
|
|
35
|
+
|
|
36
|
+
The CSS selector of a container where the payment widget should be inserted into.
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
### form
|
|
41
|
+
|
|
42
|
+
• `Optional` **form**: `BraintreeFormOptions`
|
|
43
|
+
|
|
44
|
+
**`alpha`**
|
|
45
|
+
Please note that this option is currently in an early stage of
|
|
46
|
+
development. Therefore the API is unstable and not ready for public
|
|
47
|
+
consumption.
|
|
48
|
+
|
|
49
|
+
___
|
|
50
|
+
|
|
51
|
+
### threeDSecure
|
|
52
|
+
|
|
53
|
+
• `Optional` **threeDSecure**: `BraintreeThreeDSecureOptions`
|
|
54
|
+
|
|
55
|
+
___
|
|
56
|
+
|
|
57
|
+
### unsupportedCardBrands
|
|
58
|
+
|
|
59
|
+
• `Optional` **unsupportedCardBrands**: `string`[]
|
|
60
|
+
|
|
61
|
+
A list of card brands that are not supported by the merchant.
|
|
62
|
+
|
|
63
|
+
List of supported brands by braintree can be found here: https://braintree.github.io/braintree-web/current/module-braintree-web_hosted-fields.html#~field
|
|
64
|
+
search for `supportedCardBrands` property.
|
|
65
|
+
|
|
66
|
+
List of credit cards brands:
|
|
67
|
+
'visa',
|
|
68
|
+
'mastercard',
|
|
69
|
+
'american-express',
|
|
70
|
+
'diners-club',
|
|
71
|
+
'discover',
|
|
72
|
+
'jcb',
|
|
73
|
+
'union-pay',
|
|
74
|
+
'maestro',
|
|
75
|
+
'elo',
|
|
76
|
+
'mir',
|
|
77
|
+
'hiper',
|
|
78
|
+
'hipercard'
|
|
79
|
+
|
|
80
|
+
## Methods
|
|
81
|
+
|
|
82
|
+
### onError
|
|
83
|
+
|
|
84
|
+
▸ `Optional` **onError**(`error`): `void`
|
|
85
|
+
|
|
86
|
+
A callback for displaying error popup. This callback requires error object as parameter.
|
|
87
|
+
|
|
88
|
+
#### Parameters
|
|
89
|
+
|
|
90
|
+
| Name | Type |
|
|
91
|
+
| :------ | :------ |
|
|
92
|
+
| `error` | `unknown` |
|
|
93
|
+
|
|
94
|
+
#### Returns
|
|
95
|
+
|
|
96
|
+
`void`
|
|
97
|
+
|
|
98
|
+
___
|
|
99
|
+
|
|
100
|
+
### onPaymentError
|
|
101
|
+
|
|
102
|
+
▸ `Optional` **onPaymentError**(`error`): `void`
|
|
103
|
+
|
|
104
|
+
A callback that gets called if unable to submit payment.
|
|
105
|
+
|
|
106
|
+
#### Parameters
|
|
107
|
+
|
|
108
|
+
| Name | Type | Description |
|
|
109
|
+
| :------ | :------ | :------ |
|
|
110
|
+
| `error` | `default` \| `BraintreeError` | The error object describing the failure. |
|
|
111
|
+
|
|
112
|
+
#### Returns
|
|
113
|
+
|
|
114
|
+
`void`
|
|
115
|
+
|
|
116
|
+
___
|
|
117
|
+
|
|
118
|
+
### onRenderButton
|
|
119
|
+
|
|
120
|
+
▸ `Optional` **onRenderButton**(): `void`
|
|
121
|
+
|
|
122
|
+
A callback right before render Smart Payment Button that gets called when
|
|
123
|
+
Smart Payment Button is eligible. This callback can be used to hide the standard submit button.
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
`void`
|
|
128
|
+
|
|
129
|
+
___
|
|
130
|
+
|
|
131
|
+
### submitForm
|
|
132
|
+
|
|
133
|
+
▸ `Optional` **submitForm**(): `void`
|
|
134
|
+
|
|
135
|
+
A callback for submitting payment form that gets called
|
|
136
|
+
when buyer approved PayPal account.
|
|
137
|
+
|
|
138
|
+
#### Returns
|
|
139
|
+
|
|
140
|
+
`void`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[@bigcommerce/checkout-sdk](../README.md) / WithBraintreeCreditCardPaymentInitializeOptions
|
|
2
|
+
|
|
3
|
+
# Interface: WithBraintreeCreditCardPaymentInitializeOptions
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Properties
|
|
8
|
+
|
|
9
|
+
- [braintree](WithBraintreeCreditCardPaymentInitializeOptions.md#braintree)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
### braintree
|
|
14
|
+
|
|
15
|
+
• `Optional` **braintree**: [`BraintreeCreditCardPaymentInitializeOptions`](BraintreeCreditCardPaymentInitializeOptions.md)
|
|
16
|
+
|
|
17
|
+
The options that are required to initialize Braintree PayPal wallet button on Product and Cart page.
|