@paydock/client-sdk 1.104.9-beta → 1.105.56-beta
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 +1984 -396
- package/bundles/index.cjs +33513 -8908
- package/bundles/index.cjs.d.ts +867 -52
- package/bundles/index.mjs +33507 -8908
- package/bundles/index.mjs.d.ts +867 -52
- package/bundles/types/api/api-base.d.ts +19 -6
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-charge-internal.d.ts +1 -0
- package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +57 -0
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -0
- package/bundles/types/api/api-gateway-internal.d.ts +12 -0
- package/bundles/types/api/api-gateway-internal.d.ts.map +1 -0
- package/bundles/types/api/api-internal.d.ts +4 -0
- package/bundles/types/api/api-internal.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +3 -3
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
- package/bundles/types/checkout/checkout.d.ts +86 -0
- package/bundles/types/checkout/checkout.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-handler.d.ts +23 -0
- package/bundles/types/checkout/helpers/instruction-handler.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-module.d.ts +6 -0
- package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts +6 -0
- package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/instruction.decorator.d.ts +5 -0
- package/bundles/types/checkout/helpers/instruction.decorator.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/resource-helper.d.ts +5 -0
- package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts +5 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -0
- package/bundles/types/checkout/index.d.ts +2 -0
- package/bundles/types/checkout/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/index.d.ts +3 -0
- package/bundles/types/checkout/instructions/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/index.d.ts +4 -0
- package/bundles/types/checkout/instructions/v1/index.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts +20 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts +14 -0
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts +15 -0
- package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts +11 -0
- package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts +19 -0
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts +19 -0
- package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts +26 -0
- package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts +18 -0
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts +21 -0
- package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts +19 -0
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +3 -0
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts +9 -0
- package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/message.d.ts +34 -0
- package/bundles/types/checkout/layout-widgets/message.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts +13 -0
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +52 -0
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -0
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts +3 -0
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -0
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts +2 -0
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +1 -1
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts +4 -0
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +1 -1
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts +2 -1
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +1 -1
- package/bundles/types/checkout-button/runner/popup.runner.d.ts +3 -3
- package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +1 -1
- package/bundles/types/components/http-core.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +2 -0
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +2 -0
- package/bundles/types/components/iframe.d.ts.map +1 -1
- package/bundles/types/components/link.d.ts +1 -0
- package/bundles/types/components/link.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +6 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts +1 -1
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
- package/bundles/types/helper/access-token.d.ts +1 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -1
- package/bundles/types/helper/event-emitter.d.ts +1 -0
- package/bundles/types/helper/event-emitter.d.ts.map +1 -1
- package/bundles/types/helper/spiner.util.d.ts +6 -0
- package/bundles/types/helper/spiner.util.d.ts.map +1 -0
- package/bundles/types/helper/widget-logger.d.ts +9 -0
- package/bundles/types/helper/widget-logger.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +4 -0
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +4 -0
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/paypal-data-collector/index.d.ts +23 -0
- package/bundles/types/paypal-data-collector/index.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +59 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts +21 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts.map +1 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +18 -0
- package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/index.d.ts +61 -0
- package/bundles/types/paypal-save-payment-source/index.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts +86 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +84 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +37 -0
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/index.d.ts +2 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +12 -2
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
- package/bundles/types/shared/http/http-request.d.ts +14 -0
- package/bundles/types/shared/http/http-request.d.ts.map +1 -0
- package/bundles/types/shared/http/index.d.ts +2 -0
- package/bundles/types/shared/http/index.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
- package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
- package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
- package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +4 -0
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +4 -4
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +4 -4
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/{afterpay.wallet-service.d.ts → wallet-services/afterpay.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{apple.wallet-service.d.ts → wallet-services/apple.wallet-service.d.ts} +3 -3
- package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{flypay-v2.wallet-service.d.ts → wallet-services/flypay-v2.wallet-service.d.ts} +3 -3
- package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{flypay.wallet-service.d.ts → wallet-services/flypay.wallet-service.d.ts} +6 -6
- package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{google.wallet-service.d.ts → wallet-services/google.wallet-service.d.ts} +4 -4
- package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{paypal.wallet-service.d.ts → wallet-services/paypal.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{stripe.wallet-service.d.ts → wallet-services/stripe.wallet-service.d.ts} +1 -1
- package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/{wallet-service.d.ts → wallet-services/wallet-service.d.ts} +4 -4
- package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +195 -0
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +10 -0
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/index.d.ts +131 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +5 -0
- package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +14 -0
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +9 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +11 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +22 -0
- package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +50 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +3 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts +6 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +17 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts +2 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts +2 -0
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts +4 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +47 -0
- package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +4 -3
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +33513 -8908
- package/bundles/widget.umd.js.d.ts +867 -52
- package/bundles/widget.umd.js.min.d.ts +867 -52
- package/bundles/widget.umd.min.js +61 -2
- package/docs/click-to-pay-examples.md +36 -0
- package/docs/click-to-pay.md +4 -1
- package/docs/html/layout.html +1 -0
- package/docs/paypal-data-collector-examples.md +58 -0
- package/docs/paypal-data-collector.md +149 -0
- package/docs/paypal-save-payment-source-examples.md +63 -0
- package/docs/paypal-save-payment-source.md +256 -0
- package/docs/wallet-buttons-examples.md +29 -2
- package/docs/wallet-buttons-express-examples.md +201 -0
- package/docs/wallet-buttons-express.md +786 -0
- package/docs/wallet-buttons.md +3 -0
- package/examples/multi-html-widget/simple.html +2 -1
- package/package.json +98 -92
- package/slate.md +65 -2
- package/bundles/index.cjs.map +0 -1
- package/bundles/index.mjs.map +0 -1
- package/bundles/types/wallet-buttons/afterpay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/mastercard.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/stripe.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/wallet-service.d.ts.map +0 -1
- package/bundles/widget.umd.js.map +0 -1
- package/bundles/widget.umd.min.js.map +0 -1
- /package/bundles/types/wallet-buttons/{mastercard.wallet-service.d.ts → wallet-services/mastercard.wallet-service.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -5197,7 +5197,7 @@ var button = new WalletButtons(
|
|
|
5197
5197
|
button.load();
|
|
5198
5198
|
```
|
|
5199
5199
|
|
|
5200
|
-
Flypay
|
|
5200
|
+
Flypay and Paypal wallets do not require any meta sent to the wallet, so the following is enough for initialization:
|
|
5201
5201
|
```javascript
|
|
5202
5202
|
let button = new paydock.WalletButtons(
|
|
5203
5203
|
"#widget",
|
|
@@ -5245,6 +5245,32 @@ var button = new WalletButtons(
|
|
|
5245
5245
|
button.load();
|
|
5246
5246
|
```
|
|
5247
5247
|
|
|
5248
|
+
For Flypay v2 wallet, the client_id is required:
|
|
5249
|
+
```javascript
|
|
5250
|
+
let button = new paydock.WalletButtons(
|
|
5251
|
+
"#widget",
|
|
5252
|
+
token,
|
|
5253
|
+
{
|
|
5254
|
+
client_id: "client_id",
|
|
5255
|
+
}
|
|
5256
|
+
);
|
|
5257
|
+
button.load();
|
|
5258
|
+
```
|
|
5259
|
+
|
|
5260
|
+
```javascript
|
|
5261
|
+
// ES2015 | TypeScript
|
|
5262
|
+
import { WalletButtons } from '@paydock/client-sdk';
|
|
5263
|
+
|
|
5264
|
+
var button = new WalletButtons(
|
|
5265
|
+
'#widget',
|
|
5266
|
+
token,
|
|
5267
|
+
{
|
|
5268
|
+
client_id: "client_id",
|
|
5269
|
+
}
|
|
5270
|
+
);
|
|
5271
|
+
button.load();
|
|
5272
|
+
```
|
|
5273
|
+
|
|
5248
5274
|
### Setting environment
|
|
5249
5275
|
|
|
5250
5276
|
Current method can change environment. By default environment = sandbox.
|
|
@@ -5545,10 +5571,11 @@ _(Required `meta` fields: - . Optional `meta` fields: -)_
|
|
|
5545
5571
|
{
|
|
5546
5572
|
access_token: 'TOKEN',
|
|
5547
5573
|
refresh_token: 'TOKEN',
|
|
5574
|
+
client_id: 'CLIENT_ID',
|
|
5548
5575
|
},
|
|
5549
5576
|
);
|
|
5550
5577
|
button.setEnv('sandbox');
|
|
5551
|
-
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
5578
|
+
button.onUnavailable((data) => console.log("No wallet buttons available"));
|
|
5552
5579
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
5553
5580
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
5554
5581
|
button.onAuthTokensChanged((data) => console.log('Authentication tokens changed'));
|
|
@@ -5891,6 +5918,8 @@ Interface of data from an unavailable event.
|
|
|
5891
5918
|
| Param | Type | Description |
|
|
5892
5919
|
| --- | --- | --- |
|
|
5893
5920
|
| [wallet] | <code>string</code> | For gateways with more than one wallet button available (e.g: MPGS with ApplePay and GooglePay). Possible values for wallet are 'apple' or 'google'. |
|
|
5921
|
+
| [type] | <code>string</code> | Event Code. Value can be 'create_order_id_error' on FlypayV2 order creation failure. Optional for [Flypay V2]. N/A for other wallets. |
|
|
5922
|
+
| [error_code] | <code>string</code> | Event Error Code. Value can be any error code return from Paydock's API. Optional for [Flypay V2]. N/A for other wallets. + |
|
|
5894
5923
|
|
|
5895
5924
|
<a name="IWalletUpdateData" id="IWalletUpdateData" href="#IWalletUpdateData"> </a>
|
|
5896
5925
|
|
|
@@ -5930,6 +5959,7 @@ Interface of data used by the wallet checkout and payment proccess.
|
|
|
5930
5959
|
| [style.button_type] | <code>object</code> | Used to select ApplePay button type (e.g: 'buy','donate', etc), check possible values at https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css. Also select button type for GooglePay (check GooglePayStyles) and Afterpay (check AfterpayStyles). Optional for [ApplePay, GooglePay, Afterpay]. N/A for other wallets. |
|
|
5931
5960
|
| [style.height] | <code>object</code> | Used to select Afterpay button height. Optional for [Afterpay]. N/A for other wallets. |
|
|
5932
5961
|
| [wallets] | <code>array</code> | By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe, ApplePay, GooglePay]. N/A for other wallets. |
|
|
5962
|
+
| [client_id] | <code>string</code> | Client ID to be used in the provider system. Required for [Flypay V2]. N/A for [FlyPay, GooglePay, ApplePay, PayPal, Afterpay]. |
|
|
5933
5963
|
|
|
5934
5964
|
<a name="IApplePayShippingOption" id="IApplePayShippingOption" href="#IApplePayShippingOption"> </a>
|
|
5935
5965
|
|
|
@@ -6378,56 +6408,36 @@ List of available event's name in the wallet button lifecycle
|
|
|
6378
6408
|
| ON_CLICK | <code>string</code> | <code>"onClick"</code> |
|
|
6379
6409
|
|
|
6380
6410
|
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
## Overview
|
|
6384
|
-
|
|
6385
|
-
Integrate with Click To Pay using Paydock's Click To Pay widget.
|
|
6386
|
-
For a full description of the methods and parameters, reference the [README file](https://www.npmjs.com/package/@paydock/client-sdk#ClickToPay).
|
|
6387
|
-
|
|
6388
|
-
## Click To Pay simple example
|
|
6389
|
-
|
|
6390
|
-
The following section provides an example use case and integration for the widget.
|
|
6391
|
-
|
|
6392
|
-
### Create a Container
|
|
6411
|
+
## Express Wallet Buttons
|
|
6393
6412
|
|
|
6394
|
-
|
|
6413
|
+
Express Wallet Buttons allow to integrate with E-Wallets in an "express" operational mode, allowing to show the respective button in product or cart pages.
|
|
6395
6414
|
|
|
6415
|
+
The general flow to use the widgets is:
|
|
6416
|
+
1. Configure your gateway and connect it using Paydock API or Dashboard.
|
|
6417
|
+
2. Create a container in your site
|
|
6396
6418
|
```html
|
|
6397
|
-
<div id="
|
|
6398
|
-
```
|
|
6399
|
-
|
|
6400
|
-
### Initialize the Widget
|
|
6401
|
-
|
|
6402
|
-
Use the following code to initialize your widget:
|
|
6403
|
-
|
|
6404
|
-
```javascript
|
|
6405
|
-
var src = new paydock.ClickToPay(
|
|
6406
|
-
"#checkoutIframe",
|
|
6407
|
-
"service_id",
|
|
6408
|
-
"paydock_public_key_or_access_token",
|
|
6409
|
-
{}, // meta
|
|
6410
|
-
);
|
|
6411
|
-
src.load();
|
|
6419
|
+
<div id="widget"></div>
|
|
6412
6420
|
```
|
|
6413
|
-
|
|
6414
|
-
```
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
"paydock_public_key_or_access_token",
|
|
6421
|
-
{}, // meta
|
|
6421
|
+
3. Initialize the specific WalletButtonExpress, providing your Access Token (preferred) or Public Key, plus required and optional meta parameters for the wallet in use. The general format is:
|
|
6422
|
+
```js
|
|
6423
|
+
new paydock.{Provider}WalletButtonExpress(
|
|
6424
|
+
"#widget",
|
|
6425
|
+
accessTokenOrPublicKey,
|
|
6426
|
+
gatewayId,
|
|
6427
|
+
gatewaySpecificMeta,
|
|
6422
6428
|
);
|
|
6423
|
-
src.load();
|
|
6424
6429
|
```
|
|
6430
|
+
4. (optional) If the screen where the button is rendered allows for cart/amount changes, call `setMeta` method to update the meta information.
|
|
6431
|
+
5. Handle the `onClick` callback, where you should call your server, initialize the wallet charge via `POST v1/charges/wallet` and return the wallet token.
|
|
6432
|
+
6. Handle the `onPaymentSuccessful`, `onPaymentError` and `onPaymentInReview` (if fraud is applicable) for payment results.
|
|
6425
6433
|
|
|
6426
|
-
|
|
6434
|
+
### Supported Providers
|
|
6435
|
+
1. [Apple Pay](#apple-pay-wallet-button-express)
|
|
6436
|
+
2. [Paypal](#paypal-wallet-button-express)
|
|
6427
6437
|
|
|
6428
|
-
###
|
|
6438
|
+
### Apple Pay Wallet Button Express
|
|
6429
6439
|
|
|
6430
|
-
A full
|
|
6440
|
+
A full description of the meta parameters for [ApplePayWalletButtonExpress](#ApplePayWalletButtonExpress) meta parameters can be found [here](#ApplePayWalletMeta). Below you will find a fully working html example.
|
|
6431
6441
|
|
|
6432
6442
|
```html
|
|
6433
6443
|
<!DOCTYPE html>
|
|
@@ -6435,49 +6445,78 @@ A full example of the container and the initialized widget is as follows:
|
|
|
6435
6445
|
<head>
|
|
6436
6446
|
<meta charset="UTF-8">
|
|
6437
6447
|
<title>Title</title>
|
|
6438
|
-
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
6439
6448
|
</head>
|
|
6440
6449
|
<body>
|
|
6441
|
-
<
|
|
6442
|
-
<
|
|
6443
|
-
<script>
|
|
6444
|
-
var src = new paydock.ClickToPay(
|
|
6445
|
-
"#checkoutIframe",
|
|
6446
|
-
"service_id",
|
|
6447
|
-
"paydock_public_key_or_access_token",
|
|
6448
|
-
{},
|
|
6449
|
-
);
|
|
6450
|
-
src.load();
|
|
6451
|
-
</script>
|
|
6450
|
+
<h2>Payment using PayDock ApplePayWalletButtonExpress!</h2>
|
|
6451
|
+
<div id="widget"></div>
|
|
6452
6452
|
</body>
|
|
6453
|
-
|
|
6454
|
-
|
|
6453
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6454
|
+
<script>
|
|
6455
|
+
let button = new paydock.ApplePayWalletButtonExpress(
|
|
6456
|
+
"#widget",
|
|
6457
|
+
accessTokenOrPublicKey,
|
|
6458
|
+
gatewayId,
|
|
6459
|
+
{
|
|
6460
|
+
amount_label: 'TOTAL',
|
|
6461
|
+
country: 'AU',
|
|
6462
|
+
currency: 'AUD',
|
|
6463
|
+
amount: 15.5,
|
|
6464
|
+
// merchant_capabilities: ['supports3DS', 'supportsEMV', 'supportsCredit', 'supportsDebit'],
|
|
6465
|
+
// supported_networks: ['visa', 'masterCard', 'amex', 'chinaUnionPay', 'discover', 'interac', 'jcb', 'privateLabel'],
|
|
6466
|
+
// required_billing_contact_fields: ['email', 'name', 'phone', 'postalAddress'], // phone and email do not work according to relevant testing
|
|
6467
|
+
// required_shipping_contact_fields: ['email', 'phone'], // Workaround to pull phone and email from shipping contact instead - does not require additional shipping address information
|
|
6468
|
+
// supported_countries: ["AU"],
|
|
6469
|
+
// style: {
|
|
6470
|
+
// button_type: "buy",
|
|
6471
|
+
// button_style: "black",
|
|
6472
|
+
// },
|
|
6473
|
+
}
|
|
6474
|
+
);
|
|
6455
6475
|
|
|
6456
|
-
|
|
6476
|
+
button.setEnv('sandbox');
|
|
6457
6477
|
|
|
6458
|
-
|
|
6478
|
+
button.onUnavailable(function() {
|
|
6479
|
+
console.log("Button not available");
|
|
6480
|
+
});
|
|
6459
6481
|
|
|
6460
|
-
|
|
6482
|
+
button.onError(function(error) {
|
|
6483
|
+
console.log("On Error Callback", error);
|
|
6484
|
+
});
|
|
6461
6485
|
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6486
|
+
button.onPaymentSuccessful(function(data) {
|
|
6487
|
+
console.log("Payment successful");
|
|
6488
|
+
console.log(data);
|
|
6489
|
+
});
|
|
6490
|
+
|
|
6491
|
+
button.onPaymentError(function(err) {
|
|
6492
|
+
console.log("Payment error");
|
|
6493
|
+
console.log(err);
|
|
6494
|
+
});
|
|
6495
|
+
|
|
6496
|
+
button.onPaymentInReview(function(data) {
|
|
6497
|
+
console.log("The payment is on fraud review");
|
|
6498
|
+
console.log(data);
|
|
6499
|
+
});
|
|
6500
|
+
|
|
6501
|
+
button.onClick(async (data) => {
|
|
6502
|
+
console.log("Button clicked", data);
|
|
6503
|
+
|
|
6504
|
+
const responseData = await fetch('https://your-server-url/initialize-wallet-charge');
|
|
6505
|
+
const parsedData = await responseData.json();
|
|
6506
|
+
return parsedData.resource.data.token;
|
|
6507
|
+
});
|
|
6508
|
+
|
|
6509
|
+
button.onCheckoutClose(() => {
|
|
6510
|
+
console.log("Checkout closed");
|
|
6511
|
+
});
|
|
6512
|
+
|
|
6513
|
+
button.load();
|
|
6514
|
+
</script>
|
|
6515
|
+
</html>
|
|
6478
6516
|
```
|
|
6479
6517
|
|
|
6480
|
-
###
|
|
6518
|
+
### Paypal Wallet Button Express
|
|
6519
|
+
A full description of the meta parameters for [PaypalWalletButtonExpress](#PaypalWalletButtonExpress) meta parameters can be found [here](#PaypalWalletMeta). Below you will find a fully working html example.
|
|
6481
6520
|
|
|
6482
6521
|
```html
|
|
6483
6522
|
<!DOCTYPE html>
|
|
@@ -6485,345 +6524,394 @@ src.on('checkoutError', (error) => {
|
|
|
6485
6524
|
<head>
|
|
6486
6525
|
<meta charset="UTF-8">
|
|
6487
6526
|
<title>Title</title>
|
|
6488
|
-
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
6489
6527
|
</head>
|
|
6490
6528
|
<body>
|
|
6491
|
-
<
|
|
6492
|
-
<
|
|
6493
|
-
<script>
|
|
6494
|
-
var src = new paydock.ClickToPay(
|
|
6495
|
-
"#checkoutIframe",
|
|
6496
|
-
"service_id",
|
|
6497
|
-
"paydock_public_key_or_access_token",
|
|
6498
|
-
{},
|
|
6499
|
-
);
|
|
6500
|
-
src.on('iframeLoaded', () => {
|
|
6501
|
-
console.log("Initial iframe loaded");
|
|
6502
|
-
});
|
|
6503
|
-
src.on('checkoutReady', () => {
|
|
6504
|
-
console.log("Checkout ready to be used");
|
|
6505
|
-
});
|
|
6506
|
-
src.on('checkoutCompleted', (token) => {
|
|
6507
|
-
console.log(token);
|
|
6508
|
-
});
|
|
6509
|
-
src.on('checkoutError', (error) => {
|
|
6510
|
-
console.log(error);
|
|
6511
|
-
});
|
|
6512
|
-
src.load();
|
|
6513
|
-
</script>
|
|
6529
|
+
<h2>Payment using PayDock PaypalWalletButtonExpress!</h2>
|
|
6530
|
+
<div id="widget"></div>
|
|
6514
6531
|
</body>
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6532
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6533
|
+
<script>
|
|
6534
|
+
let button = new paydock.PaypalWalletButtonExpress(
|
|
6535
|
+
"#widget",
|
|
6536
|
+
accessTokenOrPublicKey,
|
|
6537
|
+
gatewayId,
|
|
6538
|
+
{
|
|
6539
|
+
amount: 15.5,
|
|
6540
|
+
currency: 'AUD',
|
|
6541
|
+
pay_later: false,
|
|
6542
|
+
standalone: false,
|
|
6543
|
+
capture: true,
|
|
6544
|
+
// style: {
|
|
6545
|
+
// layout: 'horizontal', // or 'vertical'
|
|
6546
|
+
// color: 'gold', // or 'blue', 'silver', 'black', 'white'
|
|
6547
|
+
// shape: 'rect', // or 'pill', 'sharp'
|
|
6548
|
+
// borderRadius: 5,
|
|
6549
|
+
// height: 40,
|
|
6550
|
+
// disableMaxWidth: false,
|
|
6551
|
+
// label: 'paypal', // or 'checkout', 'buynow', 'pay', 'installment'
|
|
6552
|
+
// tagline: true,
|
|
6553
|
+
// messages: {
|
|
6554
|
+
// layout: 'text', // or 'flex'
|
|
6555
|
+
// logo: {
|
|
6556
|
+
// type: 'primary', // or 'alternative', 'inline', 'none'
|
|
6557
|
+
// position: 'left', // or 'right', 'top'
|
|
6558
|
+
// },
|
|
6559
|
+
// text: {
|
|
6560
|
+
// color: 'black', // or 'white', 'monochrome', 'grayscale'
|
|
6561
|
+
// size: 10, // or 11, 12, 13, 14, 15, 16
|
|
6562
|
+
// align: 'left', // or 'center', 'right'
|
|
6563
|
+
// },
|
|
6564
|
+
// color: 'blue', // or 'black', 'white', 'white-no-border', 'gray', 'monochrome', 'grayscale'
|
|
6565
|
+
// ratio: '1x1', // or '1x4', '8x1', '20x1'
|
|
6566
|
+
// },
|
|
6567
|
+
// }
|
|
6531
6568
|
}
|
|
6532
|
-
|
|
6533
|
-
);
|
|
6534
|
-
```
|
|
6535
|
-
|
|
6536
|
-
The Click To Pay checkout in the example requires the billing address from the customer, which is then returned as a part of the checkout data. The data is then stored and leveraged in the Paydock charge.
|
|
6537
|
-
You can also provide the billing address at the time of creating the charge. For example, if you have a different method for collecting the billing address, such as outside of the Click To Pay checkout, you can provide it alongside other information at the charge creation step:
|
|
6538
|
-
1. Disable the billing address in Paydock's Click To Pay widget.
|
|
6539
|
-
2. Get your One Time Token from the Click To Pay widget alongside other details that may have been collected outside the Click To Pay checkout as the shipping address.
|
|
6540
|
-
3. Send the billing address when creating the charge.
|
|
6569
|
+
);
|
|
6541
6570
|
|
|
6542
|
-
|
|
6543
|
-
POST v1/charges
|
|
6544
|
-
{
|
|
6545
|
-
"amount": "10.00",
|
|
6546
|
-
"currency": "AUD",
|
|
6547
|
-
"token": "one_time_token",
|
|
6548
|
-
"customer": {
|
|
6549
|
-
"payment_source": {
|
|
6550
|
-
"gateway_id": "gateway_id",
|
|
6551
|
-
"address_line1": "address_line1",
|
|
6552
|
-
"address_line2": "address_line2",
|
|
6553
|
-
"address_city": "address_city",
|
|
6554
|
-
"address_postcode": "address_postcode",
|
|
6555
|
-
"address_state": "address_state",
|
|
6556
|
-
"address_country": "address_country"
|
|
6557
|
-
}
|
|
6558
|
-
},
|
|
6559
|
-
"shipping": {
|
|
6560
|
-
"address_line1": "address_line1",
|
|
6561
|
-
"address_line2": "address_line2",
|
|
6562
|
-
"address_line3": "address_line3",
|
|
6563
|
-
"address_city": "address_city",
|
|
6564
|
-
"address_postcode": "address_postcode",
|
|
6565
|
-
"address_state": "address_state",
|
|
6566
|
-
"address_country": "address_country"
|
|
6567
|
-
}
|
|
6568
|
-
}
|
|
6569
|
-
```
|
|
6571
|
+
button.setEnv('sandbox');
|
|
6570
6572
|
|
|
6571
|
-
|
|
6573
|
+
button.onUnavailable(function() {
|
|
6574
|
+
console.log("Button not available");
|
|
6575
|
+
});
|
|
6572
6576
|
|
|
6573
|
-
|
|
6577
|
+
button.onError(function(error) {
|
|
6578
|
+
console.log("On Error Callback", error);
|
|
6579
|
+
});
|
|
6574
6580
|
|
|
6575
|
-
|
|
6581
|
+
button.onPaymentSuccessful(function(data) {
|
|
6582
|
+
console.log("Payment successful");
|
|
6583
|
+
console.log(data);
|
|
6584
|
+
});
|
|
6576
6585
|
|
|
6577
|
-
|
|
6586
|
+
button.onPaymentError(function(err) {
|
|
6587
|
+
console.log("Payment error");
|
|
6588
|
+
console.log(err);
|
|
6589
|
+
});
|
|
6578
6590
|
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
"paydock_public_key",
|
|
6584
|
-
{
|
|
6585
|
-
unaccepted_card_type: 'DEBIT'
|
|
6586
|
-
},
|
|
6587
|
-
);
|
|
6588
|
-
```
|
|
6591
|
+
button.onPaymentInReview(function(data) {
|
|
6592
|
+
console.log("The payment is on fraud review");
|
|
6593
|
+
console.log(data);
|
|
6594
|
+
});
|
|
6589
6595
|
|
|
6590
|
-
|
|
6596
|
+
button.onClick(async (data) => {
|
|
6597
|
+
console.log("Button clicked", data);
|
|
6591
6598
|
|
|
6592
|
-
|
|
6599
|
+
const responseData = await fetch('https://your-server-url/initialize-wallet-charge');
|
|
6600
|
+
const parsedData = await responseData.json();
|
|
6601
|
+
return parsedData.resource.data.token;
|
|
6602
|
+
});
|
|
6593
6603
|
|
|
6594
|
-
|
|
6604
|
+
button.onCheckoutClose(() => {
|
|
6605
|
+
console.log("Checkout closed");
|
|
6606
|
+
});
|
|
6595
6607
|
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
"service_id",
|
|
6600
|
-
"paydock_public_key",
|
|
6601
|
-
{},
|
|
6602
|
-
);
|
|
6603
|
-
src.setStyles({
|
|
6604
|
-
enable_src_popup: true,
|
|
6605
|
-
primary_button_color: 'red',
|
|
6606
|
-
secondary_button_color: 'red',
|
|
6607
|
-
primary_button_text_color: 'red',
|
|
6608
|
-
secondary_button_text_color: 'red',
|
|
6609
|
-
font_family: 'Arial',
|
|
6610
|
-
});
|
|
6608
|
+
button.load();
|
|
6609
|
+
</script>
|
|
6610
|
+
</html>
|
|
6611
6611
|
```
|
|
6612
6612
|
|
|
6613
6613
|
## Classes
|
|
6614
6614
|
|
|
6615
6615
|
<dl>
|
|
6616
|
-
<dt><a href="#
|
|
6617
|
-
<dd><p>Class
|
|
6616
|
+
<dt><a href="#ApplePayWalletButtonExpress">ApplePayWalletButtonExpress</a> ⇐ <code>BaseWalletButton</code></dt>
|
|
6617
|
+
<dd><p>Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.</p>
|
|
6618
|
+
</dd>
|
|
6619
|
+
<dt><a href="#PaypalWalletButtonExpress">PaypalWalletButtonExpress</a> ⇐ <code>BaseWalletButton</code></dt>
|
|
6620
|
+
<dd><p>Class PaypalWalletButtonExpress to work with Paypal Wallet.</p>
|
|
6621
|
+
</dd>
|
|
6622
|
+
</dl>
|
|
6623
|
+
|
|
6624
|
+
## Constants
|
|
6625
|
+
|
|
6626
|
+
<dl>
|
|
6627
|
+
<dt><a href="#EVENT">EVENT</a> : <code>object</code></dt>
|
|
6628
|
+
<dd><p>List of available event's name in the wallet button lifecycle</p>
|
|
6629
|
+
</dd>
|
|
6630
|
+
</dl>
|
|
6631
|
+
|
|
6632
|
+
## Typedefs
|
|
6633
|
+
|
|
6634
|
+
<dl>
|
|
6635
|
+
<dt><a href="#OnClickCallback">OnClickCallback</a> ⇒ <code>Promise.<string></code></dt>
|
|
6636
|
+
<dd><p>Callback for onClick method.</p>
|
|
6637
|
+
</dd>
|
|
6638
|
+
<dt><a href="#OnPaymentSuccessfulCallback">OnPaymentSuccessfulCallback</a> : <code>function</code></dt>
|
|
6639
|
+
<dd><p>Callback for onPaymentSuccessful method.</p>
|
|
6640
|
+
</dd>
|
|
6641
|
+
<dt><a href="#OnPaymentInReviewCallback">OnPaymentInReviewCallback</a> : <code>function</code></dt>
|
|
6642
|
+
<dd><p>Callback for onPaymentInReview method.</p>
|
|
6643
|
+
</dd>
|
|
6644
|
+
<dt><a href="#OnPaymentErrorCallback">OnPaymentErrorCallback</a> : <code>function</code></dt>
|
|
6645
|
+
<dd><p>Callback for onPaymentError method.</p>
|
|
6646
|
+
</dd>
|
|
6647
|
+
<dt><a href="#OnCheckoutCloseCallback">OnCheckoutCloseCallback</a> : <code>function</code></dt>
|
|
6648
|
+
<dd><p>Callback for onCheckoutClose method.</p>
|
|
6649
|
+
</dd>
|
|
6650
|
+
<dt><a href="#OnUnavailableCallback">OnUnavailableCallback</a> : <code>function</code></dt>
|
|
6651
|
+
<dd><p>Callback for onUnavailable method.</p>
|
|
6652
|
+
</dd>
|
|
6653
|
+
<dt><a href="#OnErrorCallback">OnErrorCallback</a> : <code>function</code></dt>
|
|
6654
|
+
<dd><p>Callback for onError method.</p>
|
|
6618
6655
|
</dd>
|
|
6619
6656
|
</dl>
|
|
6620
6657
|
|
|
6621
6658
|
## Interfaces
|
|
6622
6659
|
|
|
6623
6660
|
<dl>
|
|
6624
|
-
<dt><a href="#
|
|
6625
|
-
<dd><p>Interface
|
|
6661
|
+
<dt><a href="#ApplePayWalletMeta">ApplePayWalletMeta</a> : <code>object</code></dt>
|
|
6662
|
+
<dd><p>Interface for configuration metadata specific to ApplePay integration in the wallet checkout and payment process.</p>
|
|
6626
6663
|
</dd>
|
|
6627
|
-
<dt><a href="#
|
|
6628
|
-
<dd><p>Interface for
|
|
6664
|
+
<dt><a href="#PaypalWalletMeta">PaypalWalletMeta</a> : <code>object</code></dt>
|
|
6665
|
+
<dd><p>Interface for configuration metadata specific to PayPal integration in the wallet checkout and payment process.
|
|
6666
|
+
For in-depth information, please refer to the <a href="https://developer.paypal.com/docs/multiparty/checkout/standard/customize/buttons-style-guide/">Paypal documentation</a>.</p>
|
|
6629
6667
|
</dd>
|
|
6630
|
-
<dt><a href="#
|
|
6631
|
-
<dd><p>
|
|
6632
|
-
When the flow type is src, masked checkoutData available is also returned</p>
|
|
6668
|
+
<dt><a href="#OnClickEventData">OnClickEventData</a> : <code>object</code></dt>
|
|
6669
|
+
<dd><p>Interface for OnClickEventData</p>
|
|
6633
6670
|
</dd>
|
|
6634
|
-
<dt><a href="#
|
|
6635
|
-
<dd><p>Interface for
|
|
6671
|
+
<dt><a href="#OnCloseEventData">OnCloseEventData</a> : <code>object</code></dt>
|
|
6672
|
+
<dd><p>Interface for OnCloseEventData</p>
|
|
6673
|
+
</dd>
|
|
6674
|
+
<dt><a href="#OnPaymentSuccessfulEventData">OnPaymentSuccessfulEventData</a> : <code>object</code></dt>
|
|
6675
|
+
<dd><p>Interface for OnPaymentSuccessfulEventData. For final secure results, fetch backend to backend data.</p>
|
|
6676
|
+
</dd>
|
|
6677
|
+
<dt><a href="#OnPaymentInReviewEventData">OnPaymentInReviewEventData</a> : <code>object</code></dt>
|
|
6678
|
+
<dd><p>Interface for OnPaymentInReviewEventData. For final secure results, fetch backend to backend data.</p>
|
|
6679
|
+
</dd>
|
|
6680
|
+
<dt><a href="#OnPaymentErrorEventData">OnPaymentErrorEventData</a> : <code>object</code></dt>
|
|
6681
|
+
<dd><p>Interface for OnPaymentErrorEventData. For final secure results, fetch backend to backend data.</p>
|
|
6682
|
+
</dd>
|
|
6683
|
+
<dt><a href="#OnUnavailableEventData">OnUnavailableEventData</a> : <code>object</code></dt>
|
|
6684
|
+
<dd><p>Interface for OnUnavailableEventData</p>
|
|
6685
|
+
</dd>
|
|
6686
|
+
<dt><a href="#OnErrorEventData">OnErrorEventData</a> : <code>object</code></dt>
|
|
6687
|
+
<dd><p>Interface for OnErrorEventData</p>
|
|
6636
6688
|
</dd>
|
|
6637
6689
|
</dl>
|
|
6638
6690
|
|
|
6639
|
-
<a name="
|
|
6691
|
+
<a name="ApplePayWalletMeta" id="ApplePayWalletMeta" href="#ApplePayWalletMeta"> </a>
|
|
6640
6692
|
|
|
6641
|
-
##
|
|
6642
|
-
Interface
|
|
6693
|
+
## ApplePayWalletMeta : <code>object</code>
|
|
6694
|
+
Interface for configuration metadata specific to ApplePay integration in the wallet checkout and payment process.
|
|
6643
6695
|
|
|
6644
6696
|
**Kind**: global interface
|
|
6645
6697
|
|
|
6646
6698
|
| Param | Type | Description |
|
|
6647
6699
|
| --- | --- | --- |
|
|
6648
|
-
|
|
|
6649
|
-
|
|
|
6650
|
-
|
|
|
6651
|
-
|
|
|
6652
|
-
| [
|
|
6653
|
-
| [
|
|
6654
|
-
| [
|
|
6655
|
-
| [
|
|
6656
|
-
| [
|
|
6657
|
-
| [
|
|
6658
|
-
| [
|
|
6659
|
-
| [
|
|
6660
|
-
| [dpa_data.dpa_supported_phone_number.country_code] | <code>string</code> | The country code of the phone number. |
|
|
6661
|
-
| [dpa_data.dpa_supported_phone_number.phone_number] | <code>string</code> | The phone number part of the phone number. |
|
|
6662
|
-
| [dpa_data.dpa_support_uri] | <code>string</code> | URI for DPA support. |
|
|
6663
|
-
| [dpa_data.application_type] | <code>string</code> | Application type, either 'WEB_BROWSER' or 'MOBILE_APP'. |
|
|
6664
|
-
| [co_brand_names] | <code>Array.<string></code> | List of co-brand names associated with the Click to Pay experience. |
|
|
6665
|
-
| [checkout_experience] | <code>string</code> | Checkout experience type, either 'WITHIN_CHECKOUT' or 'PAYMENT_SETTINGS'. |
|
|
6666
|
-
| [services] | <code>string</code> | Services offered, such as 'INLINE_CHECKOUT' or 'INLINE_INSTALLMENTS'. |
|
|
6667
|
-
| [dpa_transaction_options] | <code>object</code> | Object that stores options for creating a transaction with DPA. |
|
|
6668
|
-
| [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA’s preferred locale, example en_US. |
|
|
6669
|
-
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array.<string></code> | List of accepted billing countries for DPA in ISO 3166-1 alpha-2 format. |
|
|
6670
|
-
| [dpa_transaction_options.dpa_billing_preference] | <code>string</code> | Billing preferences for DPA, options are 'FULL', 'POSTAL_COUNTRY', 'NONE'. |
|
|
6671
|
-
| [dpa_transaction_options.payment_options] | <code>Array.<object></code> | Payment options included in the transaction. |
|
|
6672
|
-
| [dpa_transaction_options.payment_options.dynamic_data_type] | <code>string</code> | Dynamic data types. |
|
|
6673
|
-
| [dpa_transaction_options.order_type] | <code>string</code> | Type of the order, options are 'SPLIT_SHIPMENT', 'PREFERRED_CARD'. |
|
|
6674
|
-
| [dpa_transaction_options.three_ds_preference] | <code>string</code> | Preference for 3DS usage in the transaction. |
|
|
6675
|
-
| [dpa_transaction_options.confirm_payment] | <code>boolean</code> | Indicates if payment confirmation is required. |
|
|
6676
|
-
| [dpa_transaction_options.consumer_name_requested] | <code>boolean</code> | Indicates if consumer name is requested. |
|
|
6677
|
-
| [dpa_transaction_options.consumer_email_address_requested] | <code>boolean</code> | Indicates if consumer email address is requested. |
|
|
6678
|
-
| [dpa_transaction_options.consumer_phone_number_requested] | <code>boolean</code> | Indicates if consumer phone number is requested. |
|
|
6679
|
-
| [dpa_transaction_options.transaction_amount] | <code>object</code> | Details of the transaction amount. |
|
|
6680
|
-
| [dpa_transaction_options.transaction_amount.transaction_amount] | <code>number</code> | Amount of the transaction. |
|
|
6681
|
-
| [dpa_transaction_options.transaction_amount.transaction_currency_code] | <code>string</code> | Currency code of the transaction in 3 letter ISO code format. |
|
|
6682
|
-
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Merchant's order ID. |
|
|
6683
|
-
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Merchant's category code. |
|
|
6684
|
-
| [dpa_transaction_options.merchant_country_code] | <code>string</code> | Merchant's country code in ISO 3166-1 alpha-2 format. |
|
|
6685
|
-
| [customer] | <code>object</code> | Object where the customer data is stored to prefill in the checkout. |
|
|
6686
|
-
| [customer.email] | <code>string</code> | Customer email. |
|
|
6687
|
-
| [customer.first_name] | <code>string</code> | Customer first name. |
|
|
6688
|
-
| [customer.last_name] | <code>string</code> | Customer last name. |
|
|
6689
|
-
| [customer.phone] | <code>object</code> | Object where the customer phone is stored. |
|
|
6690
|
-
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). // TODO: Confirm if it can be removed! |
|
|
6691
|
-
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
6692
|
-
| [unaccepted_card_type] | <code>string</code> | Used to block a specific card type. Options are 'CREDIT', 'DEBIT'. |
|
|
6700
|
+
| amount_label | <code>string</code> | Label shown next to the total amount to be paid, used in ApplePay popups. |
|
|
6701
|
+
| country | <code>string</code> | Country of the user in 2 letter ISO code format, required for ApplePay. |
|
|
6702
|
+
| currency | <code>string</code> | Currency of the transaction. ISO 4217 currency code format. |
|
|
6703
|
+
| amount | <code>number</code> | Total transaction amount number. **Note:** this amount will be presented in the payment sheet regardless of amount sent in the Wallet Initialization Backend to Backend call. Use `setMeta` method to keep it up to date. |
|
|
6704
|
+
| [merchant_capabilities] | <code>Array.<('supports3DS'\|'supportsEMV'\|'supportsCredit'\|'supportsDebit')></code> | Array of capabilities that the merchant supports, influencing the transaction processing features available. |
|
|
6705
|
+
| [supported_networks] | <code>Array.<('visa'\|'masterCard'\|'amex'\|'chinaUnionPay'\|'discover'\|'interac'\|'jcb'\|'privateLabel')></code> | List of payment networks supported by the merchant for ApplePay transactions. |
|
|
6706
|
+
| [required_billing_contact_fields] | <code>Array.<('email'\|'name'\|'phone'\|'postalAddress')></code> | Contact fields required from the user for billing purposes, improving transaction verification and fraud prevention. Phone and email are currently not returned by Apple. |
|
|
6707
|
+
| [required_shipping_contact_fields] | <code>Array.<('email'\|'phone')></code> | Shipping contact fields that are mandatory to complete the transaction. Use email and phone to collect from customer wallet in the abscense of billing one. |
|
|
6708
|
+
| [supported_countries] | <code>Array.<string></code> | List of countries where ApplePay is supported by the merchant, restricting usage to specified regions. |
|
|
6709
|
+
| [style] | <code>object</code> | Styling configuration for ApplePay buttons displayed during checkout. |
|
|
6710
|
+
| [style.button_type] | <code>ApplePayButtonType</code> | Enum type to select the type of ApplePay button (e.g., 'buy', 'donate', etc.), providing user interface customization. |
|
|
6711
|
+
| [style.button_style] | <code>ApplePayButtonStyle</code> | Style applied to the ApplePay button, which can include color and form factor adjustments according to the brand's visual guidelines. |
|
|
6693
6712
|
|
|
6694
|
-
<a name="
|
|
6713
|
+
<a name="PaypalWalletMeta" id="PaypalWalletMeta" href="#PaypalWalletMeta"> </a>
|
|
6695
6714
|
|
|
6696
|
-
##
|
|
6697
|
-
Interface for
|
|
6715
|
+
## PaypalWalletMeta : <code>object</code>
|
|
6716
|
+
Interface for configuration metadata specific to PayPal integration in the wallet checkout and payment process.
|
|
6717
|
+
For in-depth information, please refer to the [Paypal documentation](https://developer.paypal.com/docs/multiparty/checkout/standard/customize/buttons-style-guide/).
|
|
6698
6718
|
|
|
6699
6719
|
**Kind**: global interface
|
|
6700
6720
|
|
|
6701
6721
|
| Param | Type | Description |
|
|
6702
6722
|
| --- | --- | --- |
|
|
6703
|
-
|
|
|
6704
|
-
|
|
|
6723
|
+
| amount | <code>number</code> | Total amount of the transaction. Represents the money to be charged. |
|
|
6724
|
+
| currency | <code>string</code> | Currency of the transaction in ISO 4217 currency code format. |
|
|
6725
|
+
| [pay_later] | <code>boolean</code> | Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false. |
|
|
6726
|
+
| [standalone] | <code>boolean</code> | Flag to specify if the PayPal standalone button should be used. Default false. |
|
|
6727
|
+
| [capture] | <code>boolean</code> | Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false. |
|
|
6728
|
+
| [style] | <code>object</code> | Styling configurations for the PayPal widget. |
|
|
6729
|
+
| [style.layout] | <code>'vertical'</code> \| <code>'horizontal'</code> | Layout orientation of the PayPal button. |
|
|
6730
|
+
| [style.color] | <code>'gold'</code> \| <code>'blue'</code> \| <code>'silver'</code> \| <code>'black'</code> \| <code>'white'</code> | Color theme of the PayPal button. |
|
|
6731
|
+
| [style.shape] | <code>'rect'</code> \| <code>'pill'</code> \| <code>'sharp'</code> | Shape of the PayPal button. |
|
|
6732
|
+
| [style.borderRadius] | <code>number</code> | Border radius for the button, allowing customization of corner roundness. |
|
|
6733
|
+
| [style.height] | <code>number</code> | Height of the PayPal button, allowing for size customization. |
|
|
6734
|
+
| [style.disableMaxWidth] | <code>boolean</code> | Flag to disable the maximum width constraint of the button. |
|
|
6735
|
+
| [style.label] | <code>'paypal'</code> \| <code>'checkout'</code> \| <code>'buynow'</code> \| <code>'pay'</code> \| <code>'installment'</code> | Label text displayed on the PayPal button. |
|
|
6736
|
+
| [style.tagline] | <code>boolean</code> | Flag to include or exclude a tagline beneath the button text. |
|
|
6737
|
+
| [style.messages] | <code>object</code> | Messaging options related to the PayPal button to enhance user interaction. |
|
|
6738
|
+
| [style.messages.layout] | <code>'text'</code> \| <code>'flex'</code> | Layout type for the messages displayed near the PayPal button. |
|
|
6739
|
+
| [style.messages.logo] | <code>object</code> | Configuration for the logo to be displayed with the PayPal button. |
|
|
6740
|
+
| [style.messages.logo.type] | <code>'primary'</code> \| <code>'alternative'</code> \| <code>'inline'</code> \| <code>'none'</code> | Type of logo to display. |
|
|
6741
|
+
| [style.messages.logo.position] | <code>'left'</code> \| <code>'right'</code> \| <code>'top'</code> | Position of the logo relative to the button or message. |
|
|
6742
|
+
| [style.messages.text] | <code>object</code> | Text styling within the message component. |
|
|
6743
|
+
| [style.messages.text.color] | <code>'black'</code> \| <code>'white'</code> \| <code>'monochrome'</code> \| <code>'grayscale'</code> | Color of the message text. |
|
|
6744
|
+
| [style.messages.text.size] | <code>10</code> \| <code>11</code> \| <code>12</code> \| <code>13</code> \| <code>14</code> \| <code>15</code> \| <code>16</code> | Font size of the message text. |
|
|
6745
|
+
| [style.messages.text.align] | <code>'left'</code> \| <code>'center'</code> \| <code>'right'</code> | Text alignment within the message area. |
|
|
6746
|
+
| [style.messages.color] | <code>'blue'</code> \| <code>'black'</code> \| <code>'white'</code> \| <code>'white-no-border'</code> \| <code>'gray'</code> \| <code>'monochrome'</code> \| <code>'grayscale'</code> | Background color of the message area. |
|
|
6747
|
+
| [style.messages.ratio] | <code>'1x1'</code> \| <code>'1x4'</code> \| <code>'8x1'</code> \| <code>'20x1'</code> | Aspect ratio of the message area, affecting its layout and display. |
|
|
6748
|
+
|
|
6749
|
+
<a name="OnClickEventData" id="OnClickEventData" href="#OnClickEventData"> </a>
|
|
6750
|
+
|
|
6751
|
+
## OnClickEventData : <code>object</code>
|
|
6752
|
+
Interface for OnClickEventData
|
|
6705
6753
|
|
|
6706
|
-
|
|
6754
|
+
**Kind**: global interface
|
|
6707
6755
|
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6756
|
+
| Param | Type | Description |
|
|
6757
|
+
| --- | --- | --- |
|
|
6758
|
+
| event | <code>string</code> | Event Name is 'onClick' |
|
|
6759
|
+
|
|
6760
|
+
<a name="OnCloseEventData" id="OnCloseEventData" href="#OnCloseEventData"> </a>
|
|
6761
|
+
|
|
6762
|
+
## OnCloseEventData : <code>object</code>
|
|
6763
|
+
Interface for OnCloseEventData
|
|
6711
6764
|
|
|
6712
6765
|
**Kind**: global interface
|
|
6713
6766
|
|
|
6714
6767
|
| Param | Type | Description |
|
|
6715
6768
|
| --- | --- | --- |
|
|
6716
|
-
|
|
|
6717
|
-
|
|
|
6718
|
-
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
6719
|
-
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
6720
|
-
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
6721
|
-
| [checkoutData.card_scheme] | <code>string</code> | The card scheme. Values: visa, mastercard, amex, diners, discover. |
|
|
6722
|
-
| [checkoutData.card_type] | <code>string</code> | The type of card. Values: credit, debit, prepaid, combo, flex. |
|
|
6723
|
-
| [checkoutData.address_line1] | <code>string</code> | Address line 1 for billing address. |
|
|
6724
|
-
| [checkoutData.address_line2] | <code>string</code> | Address line 2 for billing address. |
|
|
6725
|
-
| [checkoutData.address_line3] | <code>string</code> | Address line 3 for billing address. |
|
|
6726
|
-
| [checkoutData.address_city] | <code>string</code> | City for billing address. |
|
|
6727
|
-
| [checkoutData.address_postcode] | <code>string</code> | Postal code for billing address. |
|
|
6728
|
-
| [checkoutData.address_state] | <code>string</code> | State or province for billing address. |
|
|
6729
|
-
| [checkoutData.address_country] | <code>string</code> | Country for billing address. |
|
|
6730
|
-
| [checkoutData.shipping] | <code>object</code> | Optional shipping information. |
|
|
6731
|
-
| [checkoutData.shipping.address_line1] | <code>string</code> | Address line 1 for shipping address. |
|
|
6732
|
-
| [checkoutData.shipping.address_line2] | <code>string</code> | Address line 2 for shipping address. |
|
|
6733
|
-
| [checkoutData.shipping.address_line3] | <code>string</code> | Address line 3 for shipping address. |
|
|
6734
|
-
| [checkoutData.shipping.address_city] | <code>string</code> | City for shipping address. |
|
|
6735
|
-
| [checkoutData.shipping.address_postcode] | <code>string</code> | Postal code for shipping address. |
|
|
6736
|
-
| [checkoutData.shipping.address_state] | <code>string</code> | State or province for shipping address. |
|
|
6737
|
-
| [checkoutData.shipping.address_country] | <code>string</code> | Country for shipping address. |
|
|
6769
|
+
| event | <code>string</code> | Event Name is 'onCheckoutClose' |
|
|
6770
|
+
| [chargeId] | <code>string</code> | chargeId in case it's already set after onClick event |
|
|
6738
6771
|
|
|
6739
|
-
<a name="
|
|
6772
|
+
<a name="OnPaymentSuccessfulEventData" id="OnPaymentSuccessfulEventData" href="#OnPaymentSuccessfulEventData"> </a>
|
|
6740
6773
|
|
|
6741
|
-
##
|
|
6742
|
-
Interface for
|
|
6774
|
+
## OnPaymentSuccessfulEventData : <code>object</code>
|
|
6775
|
+
Interface for OnPaymentSuccessfulEventData. For final secure results, fetch backend to backend data.
|
|
6743
6776
|
|
|
6744
6777
|
**Kind**: global interface
|
|
6745
6778
|
|
|
6746
6779
|
| Param | Type | Description |
|
|
6747
6780
|
| --- | --- | --- |
|
|
6748
|
-
|
|
|
6749
|
-
|
|
|
6750
|
-
|
|
|
6751
|
-
|
|
|
6752
|
-
|
|
|
6753
|
-
|
|
|
6781
|
+
| event | <code>string</code> | Event Name is 'paymentSuccessful' |
|
|
6782
|
+
| chargeId | <code>string</code> | chargeId set after onClick event |
|
|
6783
|
+
| data.id | <code>string</code> | Charge ID returned by server |
|
|
6784
|
+
| data.amount | <code>string</code> | Charge amount returned by server |
|
|
6785
|
+
| data.currency | <code>string</code> | Charge currency returned by server |
|
|
6786
|
+
| data.status | <code>string</code> | Charge status returned by server |
|
|
6754
6787
|
|
|
6755
|
-
<a name="
|
|
6788
|
+
<a name="OnPaymentInReviewEventData" id="OnPaymentInReviewEventData" href="#OnPaymentInReviewEventData"> </a>
|
|
6756
6789
|
|
|
6757
|
-
##
|
|
6758
|
-
|
|
6790
|
+
## OnPaymentInReviewEventData : <code>object</code>
|
|
6791
|
+
Interface for OnPaymentInReviewEventData. For final secure results, fetch backend to backend data.
|
|
6792
|
+
|
|
6793
|
+
**Kind**: global interface
|
|
6794
|
+
|
|
6795
|
+
| Param | Type | Description |
|
|
6796
|
+
| --- | --- | --- |
|
|
6797
|
+
| event | <code>string</code> | Event Name is 'paymentInReview' |
|
|
6798
|
+
| chargeId | <code>string</code> | chargeId set after onClick event |
|
|
6799
|
+
| data.id | <code>string</code> | Charge ID returned by server |
|
|
6800
|
+
| data.amount | <code>string</code> | Charge amount returned by server |
|
|
6801
|
+
| data.currency | <code>string</code> | Charge currency returned by server |
|
|
6802
|
+
| data.status | <code>string</code> | Charge status returned by server |
|
|
6803
|
+
|
|
6804
|
+
<a name="OnPaymentErrorEventData" id="OnPaymentErrorEventData" href="#OnPaymentErrorEventData"> </a>
|
|
6805
|
+
|
|
6806
|
+
## OnPaymentErrorEventData : <code>object</code>
|
|
6807
|
+
Interface for OnPaymentErrorEventData. For final secure results, fetch backend to backend data.
|
|
6808
|
+
|
|
6809
|
+
**Kind**: global interface
|
|
6810
|
+
|
|
6811
|
+
| Param | Type | Description |
|
|
6812
|
+
| --- | --- | --- |
|
|
6813
|
+
| event | <code>string</code> | Event Name is 'paymentError' |
|
|
6814
|
+
| chargeId | <code>string</code> | chargeId set after onClick event |
|
|
6815
|
+
| [data.message] | <code>string</code> | Error message |
|
|
6816
|
+
| [data.code] | <code>string</code> | Error code |
|
|
6817
|
+
|
|
6818
|
+
<a name="OnUnavailableEventData" id="OnUnavailableEventData" href="#OnUnavailableEventData"> </a>
|
|
6819
|
+
|
|
6820
|
+
## OnUnavailableEventData : <code>object</code>
|
|
6821
|
+
Interface for OnUnavailableEventData
|
|
6822
|
+
|
|
6823
|
+
**Kind**: global interface
|
|
6824
|
+
|
|
6825
|
+
| Param | Type | Description |
|
|
6826
|
+
| --- | --- | --- |
|
|
6827
|
+
| event | <code>string</code> | Event Name is 'unavailable' |
|
|
6828
|
+
|
|
6829
|
+
<a name="OnErrorEventData" id="OnErrorEventData" href="#OnErrorEventData"> </a>
|
|
6830
|
+
|
|
6831
|
+
## OnErrorEventData : <code>object</code>
|
|
6832
|
+
Interface for OnErrorEventData
|
|
6833
|
+
|
|
6834
|
+
**Kind**: global interface
|
|
6835
|
+
|
|
6836
|
+
| Param | Type | Description |
|
|
6837
|
+
| --- | --- | --- |
|
|
6838
|
+
| event | <code>string</code> | Event Name is 'error' |
|
|
6839
|
+
| [chargeId] | <code>string</code> | chargeId in case it's already set after onClick event |
|
|
6840
|
+
| [data] | <code>Error</code> | Error object if present |
|
|
6841
|
+
|
|
6842
|
+
<a name="ApplePayWalletButtonExpress" id="ApplePayWalletButtonExpress" href="#ApplePayWalletButtonExpress"> </a>
|
|
6843
|
+
|
|
6844
|
+
## ApplePayWalletButtonExpress ⇐ <code>BaseWalletButton</code>
|
|
6845
|
+
Class ApplePayWalletButtonExpress to work with Apple Pay Wallet.
|
|
6759
6846
|
|
|
6760
6847
|
**Kind**: global class
|
|
6761
|
-
**Extends**: <code>
|
|
6848
|
+
**Extends**: <code>BaseWalletButton</code>
|
|
6762
6849
|
|
|
6763
|
-
* [
|
|
6764
|
-
* [new
|
|
6765
|
-
* [.load()](#
|
|
6766
|
-
* [.
|
|
6767
|
-
* [.setEnv(env, [alias])](#
|
|
6768
|
-
* [.
|
|
6769
|
-
* [.
|
|
6770
|
-
* [.
|
|
6771
|
-
* [.
|
|
6772
|
-
* [.
|
|
6773
|
-
* [.
|
|
6850
|
+
* [ApplePayWalletButtonExpress](#ApplePayWalletButtonExpress) ⇐ <code>BaseWalletButton</code>
|
|
6851
|
+
* [new ApplePayWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta)](#new_ApplePayWalletButtonExpress_new)
|
|
6852
|
+
* [.load()](#ApplePayWalletButtonExpress+load)
|
|
6853
|
+
* [.setMeta(meta)](#ApplePayWalletButtonExpress+setMeta)
|
|
6854
|
+
* [.setEnv(env, [alias])](#BaseWalletButton+setEnv)
|
|
6855
|
+
* [.onClick(handler)](#BaseWalletButton+onClick)
|
|
6856
|
+
* [.onPaymentSuccessful([handler])](#BaseWalletButton+onPaymentSuccessful)
|
|
6857
|
+
* [.onPaymentInReview([handler])](#BaseWalletButton+onPaymentInReview)
|
|
6858
|
+
* [.onPaymentError([handler])](#BaseWalletButton+onPaymentError)
|
|
6859
|
+
* [.onCheckoutClose(handler)](#BaseWalletButton+onCheckoutClose)
|
|
6860
|
+
* [.onUnavailable(handler)](#BaseWalletButton+onUnavailable)
|
|
6861
|
+
* [.onError(handler)](#BaseWalletButton+onError)
|
|
6774
6862
|
|
|
6775
|
-
<a name="
|
|
6863
|
+
<a name="new_ApplePayWalletButtonExpress_new" id="new_ApplePayWalletButtonExpress_new" href="#new_ApplePayWalletButtonExpress_new"> </a>
|
|
6776
6864
|
|
|
6777
|
-
### new
|
|
6865
|
+
### new ApplePayWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta)
|
|
6778
6866
|
|
|
6779
6867
|
| Param | Type | Description |
|
|
6780
6868
|
| --- | --- | --- |
|
|
6781
|
-
|
|
|
6782
|
-
|
|
|
6783
|
-
|
|
|
6784
|
-
| meta | <code>
|
|
6869
|
+
| selector | <code>string</code> | Selector of html element. Container for the ApplePayWalletButtonExpress. |
|
|
6870
|
+
| publicKeyOrAccessToken | <code>string</code> | Public key or Access token for the ApplePayWalletButtonExpress. |
|
|
6871
|
+
| gatewayId | <code>string</code> | Gateway ID for the ApplePayWalletButtonExpress. |
|
|
6872
|
+
| meta | [<code>ApplePayWalletMeta</code>](#ApplePayWalletMeta) | data that configures the Apple Pay Wallet. |
|
|
6785
6873
|
|
|
6786
6874
|
**Example**
|
|
6787
6875
|
```js
|
|
6788
|
-
var
|
|
6876
|
+
var button = new ApplePayWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
6789
6877
|
```
|
|
6790
|
-
<a name="
|
|
6878
|
+
<a name="ApplePayWalletButtonExpress+load" id="ApplePayWalletButtonExpress+load" href="#ApplePayWalletButtonExpress+load"> </a>
|
|
6791
6879
|
|
|
6792
|
-
###
|
|
6793
|
-
|
|
6880
|
+
### applePayWalletButtonExpress.load()
|
|
6881
|
+
Initializes the availability checks and inserts the button if possible.
|
|
6882
|
+
Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
6883
|
+
**Important**: Is required to invoke this method to render the wallet button.
|
|
6794
6884
|
|
|
6795
|
-
**Kind**: instance method of [<code>
|
|
6796
|
-
|
|
6885
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6886
|
+
**Example**
|
|
6887
|
+
```js
|
|
6888
|
+
button.load();
|
|
6889
|
+
```
|
|
6890
|
+
<a name="ApplePayWalletButtonExpress+setMeta" id="ApplePayWalletButtonExpress+setMeta" href="#ApplePayWalletButtonExpress+setMeta"> </a>
|
|
6797
6891
|
|
|
6798
|
-
###
|
|
6799
|
-
|
|
6892
|
+
### applePayWalletButtonExpress.setMeta(meta)
|
|
6893
|
+
Call this method if updating the originally-provided meta object after order information changed.
|
|
6894
|
+
For example, if the order amount has changed from the time where the button was originally rendered.
|
|
6800
6895
|
|
|
6801
|
-
**Kind**: instance method of [<code>
|
|
6802
|
-
**Overrides**: [<code>setStyles</code>](#SRC+setStyles)
|
|
6896
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6803
6897
|
|
|
6804
6898
|
| Param | Type | Description |
|
|
6805
6899
|
| --- | --- | --- |
|
|
6806
|
-
|
|
|
6900
|
+
| meta | [<code>ApplePayWalletMeta</code>](#ApplePayWalletMeta) | // data that configures the Apple Pay Wallet. |
|
|
6807
6901
|
|
|
6808
6902
|
**Example**
|
|
6809
6903
|
```js
|
|
6810
|
-
|
|
6811
|
-
enable_src_popup: true
|
|
6812
|
-
primary_button_color: 'red',
|
|
6813
|
-
secondary_button_color: 'blue',
|
|
6814
|
-
primary_button_text_color: 'white',
|
|
6815
|
-
secondary_button_text_color: 'white',
|
|
6816
|
-
font_family: 'Arial',
|
|
6817
|
-
});
|
|
6904
|
+
button.setMeta(meta);
|
|
6818
6905
|
```
|
|
6819
|
-
<a name="
|
|
6906
|
+
<a name="BaseWalletButton+setEnv" id="BaseWalletButton+setEnv" href="#BaseWalletButton+setEnv"> </a>
|
|
6820
6907
|
|
|
6821
|
-
###
|
|
6908
|
+
### applePayWalletButtonExpress.setEnv(env, [alias])
|
|
6822
6909
|
Current method can change environment. By default environment = sandbox.
|
|
6823
6910
|
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
6911
|
+
Bear in mind that you must set an environment before calling `button.load()`.
|
|
6824
6912
|
|
|
6825
|
-
**Kind**: instance method of [<code>
|
|
6826
|
-
**Overrides**: [<code>setEnv</code>](#
|
|
6913
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6914
|
+
**Overrides**: [<code>setEnv</code>](#BaseWalletButton+setEnv)
|
|
6827
6915
|
|
|
6828
6916
|
| Param | Type | Description |
|
|
6829
6917
|
| --- | --- | --- |
|
|
@@ -6832,119 +6920,1619 @@ Also we can change domain alias for this environment. By default domain_alias =
|
|
|
6832
6920
|
|
|
6833
6921
|
**Example**
|
|
6834
6922
|
```js
|
|
6835
|
-
|
|
6923
|
+
button.setEnv('production', 'paydock.com');
|
|
6836
6924
|
```
|
|
6837
|
-
<a name="
|
|
6925
|
+
<a name="BaseWalletButton+onClick" id="BaseWalletButton+onClick" href="#BaseWalletButton+onClick"> </a>
|
|
6838
6926
|
|
|
6839
|
-
###
|
|
6840
|
-
|
|
6927
|
+
### applePayWalletButtonExpress.onClick(handler)
|
|
6928
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
6929
|
+
**Note:** is mandatory to handle this event to perform the wallet initialization (and optionally any validation logic).
|
|
6930
|
+
The event handler needs to return the wallet token string in order for the Wallet charge processing to proceed, or throw an error in case of failure or validation errors.
|
|
6931
|
+
**Note:** this callback may be called multiple times as the customer closes the payment checkout and re-clicks the button.
|
|
6932
|
+
It's the merchant's responsibility to handle this situation and evaluate in each case if generating a new WalletCharge Token is required or the previous one can be used in each case, depending on order data and updates.
|
|
6933
|
+
In case a new one needs to be generated, remember it will need to be preceded by a `setMeta` call.
|
|
6934
|
+
|
|
6935
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6936
|
+
**Overrides**: [<code>onClick</code>](#BaseWalletButton+onClick)
|
|
6937
|
+
|
|
6938
|
+
| Param | Type | Description |
|
|
6939
|
+
| --- | --- | --- |
|
|
6940
|
+
| handler | [<code>OnClickCallback</code>](#OnClickCallback) | Function to be called when the wallet button is clicked. |
|
|
6841
6941
|
|
|
6842
|
-
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
6843
|
-
**Overrides**: [<code>getEnv</code>](#SRC+getEnv)
|
|
6844
6942
|
**Example**
|
|
6845
6943
|
```js
|
|
6846
|
-
|
|
6944
|
+
button.onClick(async (data) => {
|
|
6945
|
+
const responseData = await fetch('https://your-server.com/init-wallet-charge');
|
|
6946
|
+
return responseData.walletToken;
|
|
6947
|
+
});
|
|
6847
6948
|
```
|
|
6848
|
-
<a name="
|
|
6949
|
+
<a name="BaseWalletButton+onPaymentSuccessful" id="BaseWalletButton+onPaymentSuccessful" href="#BaseWalletButton+onPaymentSuccessful"> </a>
|
|
6849
6950
|
|
|
6850
|
-
###
|
|
6851
|
-
|
|
6951
|
+
### applePayWalletButtonExpress.onPaymentSuccessful([handler])
|
|
6952
|
+
If the payment was successful, the function passed as parameter will be called.
|
|
6953
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
6852
6954
|
|
|
6853
|
-
**Kind**: instance method of [<code>
|
|
6854
|
-
**Overrides**: [<code>
|
|
6955
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6956
|
+
**Overrides**: [<code>onPaymentSuccessful</code>](#BaseWalletButton+onPaymentSuccessful)
|
|
6855
6957
|
|
|
6856
6958
|
| Param | Type | Description |
|
|
6857
6959
|
| --- | --- | --- |
|
|
6858
|
-
|
|
|
6859
|
-
| [cb] | <code>listener</code> | The callback to handle the event. When available, it will send back data of type [EventData](#EventData) |
|
|
6960
|
+
| [handler] | [<code>OnPaymentSuccessfulCallback</code>](#OnPaymentSuccessfulCallback) | Function to be called when the payment was successful. |
|
|
6860
6961
|
|
|
6861
6962
|
**Example**
|
|
6862
6963
|
```js
|
|
6863
|
-
|
|
6864
|
-
console.log(
|
|
6865
|
-
});
|
|
6866
|
-
// or
|
|
6867
|
-
SRC.on('checkoutCompleted').then(function (token) {
|
|
6868
|
-
console.log(token);
|
|
6964
|
+
button.onPaymentSuccessful((data) => {
|
|
6965
|
+
console.log('Payment successful!');
|
|
6869
6966
|
});
|
|
6870
6967
|
```
|
|
6871
|
-
|
|
6968
|
+
**Example**
|
|
6969
|
+
```js
|
|
6970
|
+
button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
|
|
6971
|
+
```
|
|
6972
|
+
<a name="BaseWalletButton+onPaymentInReview" id="BaseWalletButton+onPaymentInReview" href="#BaseWalletButton+onPaymentInReview"> </a>
|
|
6872
6973
|
|
|
6873
|
-
###
|
|
6874
|
-
|
|
6974
|
+
### applePayWalletButtonExpress.onPaymentInReview([handler])
|
|
6975
|
+
If the payment was left in fraud review, the function passed as parameter will be called.
|
|
6976
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
6875
6977
|
|
|
6876
|
-
**Kind**: instance method of [<code>
|
|
6877
|
-
**Overrides**: [<code>
|
|
6978
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
6979
|
+
**Overrides**: [<code>onPaymentInReview</code>](#BaseWalletButton+onPaymentInReview)
|
|
6878
6980
|
|
|
6879
|
-
| Param | Type |
|
|
6880
|
-
| --- | --- | --- |
|
|
6881
|
-
| [
|
|
6981
|
+
| Param | Type | Description |
|
|
6982
|
+
| --- | --- | --- |
|
|
6983
|
+
| [handler] | [<code>OnPaymentInReviewCallback</code>](#OnPaymentInReviewCallback) | Function to be called when the payment was left in fraud review status. |
|
|
6882
6984
|
|
|
6883
6985
|
**Example**
|
|
6884
6986
|
```js
|
|
6885
|
-
|
|
6987
|
+
button.onPaymentInReview((data) => {
|
|
6988
|
+
console.log('Payment in fraud review');
|
|
6989
|
+
});
|
|
6886
6990
|
```
|
|
6887
|
-
|
|
6991
|
+
**Example**
|
|
6992
|
+
```js
|
|
6993
|
+
button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
|
|
6994
|
+
```
|
|
6995
|
+
<a name="BaseWalletButton+onPaymentError" id="BaseWalletButton+onPaymentError" href="#BaseWalletButton+onPaymentError"> </a>
|
|
6888
6996
|
|
|
6889
|
-
###
|
|
6890
|
-
|
|
6997
|
+
### applePayWalletButtonExpress.onPaymentError([handler])
|
|
6998
|
+
If the payment was not successful, the function passed as parameter will be called.
|
|
6999
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
7000
|
+
|
|
7001
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
7002
|
+
**Overrides**: [<code>onPaymentError</code>](#BaseWalletButton+onPaymentError)
|
|
7003
|
+
|
|
7004
|
+
| Param | Type | Description |
|
|
7005
|
+
| --- | --- | --- |
|
|
7006
|
+
| [handler] | [<code>OnPaymentErrorCallback</code>](#OnPaymentErrorCallback) | Function to be called when the payment was not successful. |
|
|
6891
7007
|
|
|
6892
|
-
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
6893
|
-
**Overrides**: [<code>showCheckout</code>](#SRC+showCheckout)
|
|
6894
7008
|
**Example**
|
|
6895
7009
|
```js
|
|
6896
|
-
|
|
7010
|
+
button.onPaymentError((err) => {
|
|
7011
|
+
console.log('Payment not successful');
|
|
7012
|
+
});
|
|
6897
7013
|
```
|
|
6898
|
-
|
|
7014
|
+
**Example**
|
|
7015
|
+
```js
|
|
7016
|
+
button.onPaymentError().then((err) => console.log('Payment not successful'));
|
|
7017
|
+
```
|
|
7018
|
+
<a name="BaseWalletButton+onCheckoutClose" id="BaseWalletButton+onCheckoutClose" href="#BaseWalletButton+onCheckoutClose"> </a>
|
|
6899
7019
|
|
|
6900
|
-
###
|
|
6901
|
-
|
|
7020
|
+
### applePayWalletButtonExpress.onCheckoutClose(handler)
|
|
7021
|
+
Registers a callback function to be invoked when the wallet checkout closes.
|
|
7022
|
+
|
|
7023
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
7024
|
+
**Overrides**: [<code>onCheckoutClose</code>](#BaseWalletButton+onCheckoutClose)
|
|
7025
|
+
|
|
7026
|
+
| Param | Type | Description |
|
|
7027
|
+
| --- | --- | --- |
|
|
7028
|
+
| handler | [<code>OnCheckoutCloseCallback</code>](#OnCheckoutCloseCallback) | Function to be called when the wallet checkout closes. |
|
|
6902
7029
|
|
|
6903
|
-
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
6904
|
-
**Overrides**: [<code>reload</code>](#SRC+reload)
|
|
6905
7030
|
**Example**
|
|
6906
7031
|
```js
|
|
6907
|
-
|
|
7032
|
+
button.onCheckoutClose(() => {
|
|
7033
|
+
console.log('Wallet checkout closes');
|
|
7034
|
+
});
|
|
6908
7035
|
```
|
|
6909
|
-
<a name="
|
|
7036
|
+
<a name="BaseWalletButton+onUnavailable" id="BaseWalletButton+onUnavailable" href="#BaseWalletButton+onUnavailable"> </a>
|
|
6910
7037
|
|
|
6911
|
-
###
|
|
6912
|
-
|
|
7038
|
+
### applePayWalletButtonExpress.onUnavailable(handler)
|
|
7039
|
+
Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
7040
|
+
|
|
7041
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
7042
|
+
**Overrides**: [<code>onUnavailable</code>](#BaseWalletButton+onUnavailable)
|
|
7043
|
+
|
|
7044
|
+
| Param | Type | Description |
|
|
7045
|
+
| --- | --- | --- |
|
|
7046
|
+
| handler | [<code>OnUnavailableCallback</code>](#OnUnavailableCallback) | Function to be called when the wallet is not available in the current context. |
|
|
6913
7047
|
|
|
6914
|
-
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
6915
|
-
**Overrides**: [<code>useAutoResize</code>](#SRC+useAutoResize)
|
|
6916
7048
|
**Example**
|
|
6917
7049
|
```js
|
|
6918
|
-
|
|
7050
|
+
button.onUnavailable(() => {
|
|
7051
|
+
console.log('Wallet not available');
|
|
7052
|
+
});
|
|
7053
|
+
```
|
|
7054
|
+
<a name="BaseWalletButton+onError" id="BaseWalletButton+onError" href="#BaseWalletButton+onError"> </a>
|
|
7055
|
+
|
|
7056
|
+
### applePayWalletButtonExpress.onError(handler)
|
|
7057
|
+
Registers a callback function to be invoked when an error that is not related to payment execution occurs.
|
|
7058
|
+
For example, if the amount of the wallet token injected via the `onClick` event handler does not match the amount provided via the initial `meta` or `setMeta` method.
|
|
7059
|
+
|
|
7060
|
+
**Kind**: instance method of [<code>ApplePayWalletButtonExpress</code>](#ApplePayWalletButtonExpress)
|
|
7061
|
+
**Overrides**: [<code>onError</code>](#BaseWalletButton+onError)
|
|
7062
|
+
|
|
7063
|
+
| Param | Type | Description |
|
|
7064
|
+
| --- | --- | --- |
|
|
7065
|
+
| handler | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when the WalletButton has an error. |
|
|
7066
|
+
|
|
7067
|
+
**Example**
|
|
7068
|
+
```js
|
|
7069
|
+
button.onError((error) => {
|
|
7070
|
+
console.log('WalletButtonExpress error', error);
|
|
7071
|
+
});
|
|
7072
|
+
```
|
|
7073
|
+
<a name="PaypalWalletButtonExpress" id="PaypalWalletButtonExpress" href="#PaypalWalletButtonExpress"> </a>
|
|
7074
|
+
|
|
7075
|
+
## PaypalWalletButtonExpress ⇐ <code>BaseWalletButton</code>
|
|
7076
|
+
Class PaypalWalletButtonExpress to work with Paypal Wallet.
|
|
7077
|
+
|
|
7078
|
+
**Kind**: global class
|
|
7079
|
+
**Extends**: <code>BaseWalletButton</code>
|
|
7080
|
+
|
|
7081
|
+
* [PaypalWalletButtonExpress](#PaypalWalletButtonExpress) ⇐ <code>BaseWalletButton</code>
|
|
7082
|
+
* [new PaypalWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta)](#new_PaypalWalletButtonExpress_new)
|
|
7083
|
+
* [.load()](#PaypalWalletButtonExpress+load)
|
|
7084
|
+
* [.setMeta(meta)](#PaypalWalletButtonExpress+setMeta)
|
|
7085
|
+
* [.setEnv(env, [alias])](#BaseWalletButton+setEnv)
|
|
7086
|
+
* [.onClick(handler)](#BaseWalletButton+onClick)
|
|
7087
|
+
* [.onPaymentSuccessful([handler])](#BaseWalletButton+onPaymentSuccessful)
|
|
7088
|
+
* [.onPaymentInReview([handler])](#BaseWalletButton+onPaymentInReview)
|
|
7089
|
+
* [.onPaymentError([handler])](#BaseWalletButton+onPaymentError)
|
|
7090
|
+
* [.onCheckoutClose(handler)](#BaseWalletButton+onCheckoutClose)
|
|
7091
|
+
* [.onUnavailable(handler)](#BaseWalletButton+onUnavailable)
|
|
7092
|
+
* [.onError(handler)](#BaseWalletButton+onError)
|
|
7093
|
+
|
|
7094
|
+
<a name="new_PaypalWalletButtonExpress_new" id="new_PaypalWalletButtonExpress_new" href="#new_PaypalWalletButtonExpress_new"> </a>
|
|
7095
|
+
|
|
7096
|
+
### new PaypalWalletButtonExpress(selector, publicKeyOrAccessToken, gatewayId, meta)
|
|
7097
|
+
|
|
7098
|
+
| Param | Type | Description |
|
|
7099
|
+
| --- | --- | --- |
|
|
7100
|
+
| selector | <code>string</code> | Selector of html element. Container for the PaypalWalletButtonExpress. |
|
|
7101
|
+
| publicKeyOrAccessToken | <code>string</code> | Public key or Access token for the PaypalWalletButtonExpress. |
|
|
7102
|
+
| gatewayId | <code>string</code> | Gateway ID for the PaypalWalletButtonExpress. |
|
|
7103
|
+
| meta | [<code>PaypalWalletMeta</code>](#PaypalWalletMeta) | data that configures the Paypal Wallet. |
|
|
7104
|
+
|
|
7105
|
+
**Example**
|
|
7106
|
+
```js
|
|
7107
|
+
var button = new PaypalWalletButtonExpress('#wallet-buttons', 'publicKeyOrAccessToken', 'gatewayId', meta);
|
|
7108
|
+
```
|
|
7109
|
+
<a name="PaypalWalletButtonExpress+load" id="PaypalWalletButtonExpress+load" href="#PaypalWalletButtonExpress+load"> </a>
|
|
7110
|
+
|
|
7111
|
+
### paypalWalletButtonExpress.load()
|
|
7112
|
+
Initializes the availability checks and inserts the button if possible.
|
|
7113
|
+
Otherwise function onUnavailable(handler: VoidFunction) will be called.
|
|
7114
|
+
**Important**: Is required to invoke this method to render the wallet button.
|
|
7115
|
+
|
|
7116
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7117
|
+
**Example**
|
|
7118
|
+
```js
|
|
7119
|
+
button.load();
|
|
7120
|
+
```
|
|
7121
|
+
<a name="PaypalWalletButtonExpress+setMeta" id="PaypalWalletButtonExpress+setMeta" href="#PaypalWalletButtonExpress+setMeta"> </a>
|
|
7122
|
+
|
|
7123
|
+
### paypalWalletButtonExpress.setMeta(meta)
|
|
7124
|
+
Call this method if updating the originally-provided meta object after order information changed.
|
|
7125
|
+
For example, if the order amount has changed from the time where the button was originally rendered.
|
|
7126
|
+
|
|
7127
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7128
|
+
|
|
7129
|
+
| Param | Type | Description |
|
|
7130
|
+
| --- | --- | --- |
|
|
7131
|
+
| meta | [<code>PaypalWalletMeta</code>](#PaypalWalletMeta) | // data that configures the Paypal Wallet. |
|
|
7132
|
+
|
|
7133
|
+
**Example**
|
|
7134
|
+
```js
|
|
7135
|
+
button.setMeta(meta);
|
|
7136
|
+
```
|
|
7137
|
+
<a name="BaseWalletButton+setEnv" id="BaseWalletButton+setEnv" href="#BaseWalletButton+setEnv"> </a>
|
|
7138
|
+
|
|
7139
|
+
### paypalWalletButtonExpress.setEnv(env, [alias])
|
|
7140
|
+
Current method can change environment. By default environment = sandbox.
|
|
7141
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
7142
|
+
Bear in mind that you must set an environment before calling `button.load()`.
|
|
7143
|
+
|
|
7144
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7145
|
+
**Overrides**: [<code>setEnv</code>](#BaseWalletButton+setEnv)
|
|
7146
|
+
|
|
7147
|
+
| Param | Type | Description |
|
|
7148
|
+
| --- | --- | --- |
|
|
7149
|
+
| env | <code>string</code> | sandbox, production |
|
|
7150
|
+
| [alias] | <code>string</code> | Own domain alias |
|
|
7151
|
+
|
|
7152
|
+
**Example**
|
|
7153
|
+
```js
|
|
7154
|
+
button.setEnv('production', 'paydock.com');
|
|
7155
|
+
```
|
|
7156
|
+
<a name="BaseWalletButton+onClick" id="BaseWalletButton+onClick" href="#BaseWalletButton+onClick"> </a>
|
|
7157
|
+
|
|
7158
|
+
### paypalWalletButtonExpress.onClick(handler)
|
|
7159
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
7160
|
+
**Note:** is mandatory to handle this event to perform the wallet initialization (and optionally any validation logic).
|
|
7161
|
+
The event handler needs to return the wallet token string in order for the Wallet charge processing to proceed, or throw an error in case of failure or validation errors.
|
|
7162
|
+
**Note:** this callback may be called multiple times as the customer closes the payment checkout and re-clicks the button.
|
|
7163
|
+
It's the merchant's responsibility to handle this situation and evaluate in each case if generating a new WalletCharge Token is required or the previous one can be used in each case, depending on order data and updates.
|
|
7164
|
+
In case a new one needs to be generated, remember it will need to be preceded by a `setMeta` call.
|
|
7165
|
+
|
|
7166
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7167
|
+
**Overrides**: [<code>onClick</code>](#BaseWalletButton+onClick)
|
|
7168
|
+
|
|
7169
|
+
| Param | Type | Description |
|
|
7170
|
+
| --- | --- | --- |
|
|
7171
|
+
| handler | [<code>OnClickCallback</code>](#OnClickCallback) | Function to be called when the wallet button is clicked. |
|
|
7172
|
+
|
|
7173
|
+
**Example**
|
|
7174
|
+
```js
|
|
7175
|
+
button.onClick(async (data) => {
|
|
7176
|
+
const responseData = await fetch('https://your-server.com/init-wallet-charge');
|
|
7177
|
+
return responseData.walletToken;
|
|
7178
|
+
});
|
|
7179
|
+
```
|
|
7180
|
+
<a name="BaseWalletButton+onPaymentSuccessful" id="BaseWalletButton+onPaymentSuccessful" href="#BaseWalletButton+onPaymentSuccessful"> </a>
|
|
7181
|
+
|
|
7182
|
+
### paypalWalletButtonExpress.onPaymentSuccessful([handler])
|
|
7183
|
+
If the payment was successful, the function passed as parameter will be called.
|
|
7184
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
7185
|
+
|
|
7186
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7187
|
+
**Overrides**: [<code>onPaymentSuccessful</code>](#BaseWalletButton+onPaymentSuccessful)
|
|
7188
|
+
|
|
7189
|
+
| Param | Type | Description |
|
|
7190
|
+
| --- | --- | --- |
|
|
7191
|
+
| [handler] | [<code>OnPaymentSuccessfulCallback</code>](#OnPaymentSuccessfulCallback) | Function to be called when the payment was successful. |
|
|
7192
|
+
|
|
7193
|
+
**Example**
|
|
7194
|
+
```js
|
|
7195
|
+
button.onPaymentSuccessful((data) => {
|
|
7196
|
+
console.log('Payment successful!');
|
|
7197
|
+
});
|
|
7198
|
+
```
|
|
7199
|
+
**Example**
|
|
7200
|
+
```js
|
|
7201
|
+
button.onPaymentSuccessful().then((data) => console.log('Payment successful!'));
|
|
7202
|
+
```
|
|
7203
|
+
<a name="BaseWalletButton+onPaymentInReview" id="BaseWalletButton+onPaymentInReview" href="#BaseWalletButton+onPaymentInReview"> </a>
|
|
7204
|
+
|
|
7205
|
+
### paypalWalletButtonExpress.onPaymentInReview([handler])
|
|
7206
|
+
If the payment was left in fraud review, the function passed as parameter will be called.
|
|
7207
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
7208
|
+
|
|
7209
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7210
|
+
**Overrides**: [<code>onPaymentInReview</code>](#BaseWalletButton+onPaymentInReview)
|
|
7211
|
+
|
|
7212
|
+
| Param | Type | Description |
|
|
7213
|
+
| --- | --- | --- |
|
|
7214
|
+
| [handler] | [<code>OnPaymentInReviewCallback</code>](#OnPaymentInReviewCallback) | Function to be called when the payment was left in fraud review status. |
|
|
7215
|
+
|
|
7216
|
+
**Example**
|
|
7217
|
+
```js
|
|
7218
|
+
button.onPaymentInReview((data) => {
|
|
7219
|
+
console.log('Payment in fraud review');
|
|
7220
|
+
});
|
|
7221
|
+
```
|
|
7222
|
+
**Example**
|
|
7223
|
+
```js
|
|
7224
|
+
button.onPaymentInReview().then((data) => console.log('Payment in fraud review'));
|
|
7225
|
+
```
|
|
7226
|
+
<a name="BaseWalletButton+onPaymentError" id="BaseWalletButton+onPaymentError" href="#BaseWalletButton+onPaymentError"> </a>
|
|
7227
|
+
|
|
7228
|
+
### paypalWalletButtonExpress.onPaymentError([handler])
|
|
7229
|
+
If the payment was not successful, the function passed as parameter will be called.
|
|
7230
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
7231
|
+
|
|
7232
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7233
|
+
**Overrides**: [<code>onPaymentError</code>](#BaseWalletButton+onPaymentError)
|
|
7234
|
+
|
|
7235
|
+
| Param | Type | Description |
|
|
7236
|
+
| --- | --- | --- |
|
|
7237
|
+
| [handler] | [<code>OnPaymentErrorCallback</code>](#OnPaymentErrorCallback) | Function to be called when the payment was not successful. |
|
|
7238
|
+
|
|
7239
|
+
**Example**
|
|
7240
|
+
```js
|
|
7241
|
+
button.onPaymentError((err) => {
|
|
7242
|
+
console.log('Payment not successful');
|
|
7243
|
+
});
|
|
7244
|
+
```
|
|
7245
|
+
**Example**
|
|
7246
|
+
```js
|
|
7247
|
+
button.onPaymentError().then((err) => console.log('Payment not successful'));
|
|
7248
|
+
```
|
|
7249
|
+
<a name="BaseWalletButton+onCheckoutClose" id="BaseWalletButton+onCheckoutClose" href="#BaseWalletButton+onCheckoutClose"> </a>
|
|
7250
|
+
|
|
7251
|
+
### paypalWalletButtonExpress.onCheckoutClose(handler)
|
|
7252
|
+
Registers a callback function to be invoked when the wallet checkout closes.
|
|
7253
|
+
|
|
7254
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7255
|
+
**Overrides**: [<code>onCheckoutClose</code>](#BaseWalletButton+onCheckoutClose)
|
|
7256
|
+
|
|
7257
|
+
| Param | Type | Description |
|
|
7258
|
+
| --- | --- | --- |
|
|
7259
|
+
| handler | [<code>OnCheckoutCloseCallback</code>](#OnCheckoutCloseCallback) | Function to be called when the wallet checkout closes. |
|
|
7260
|
+
|
|
7261
|
+
**Example**
|
|
7262
|
+
```js
|
|
7263
|
+
button.onCheckoutClose(() => {
|
|
7264
|
+
console.log('Wallet checkout closes');
|
|
7265
|
+
});
|
|
7266
|
+
```
|
|
7267
|
+
<a name="BaseWalletButton+onUnavailable" id="BaseWalletButton+onUnavailable" href="#BaseWalletButton+onUnavailable"> </a>
|
|
7268
|
+
|
|
7269
|
+
### paypalWalletButtonExpress.onUnavailable(handler)
|
|
7270
|
+
Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
7271
|
+
|
|
7272
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7273
|
+
**Overrides**: [<code>onUnavailable</code>](#BaseWalletButton+onUnavailable)
|
|
7274
|
+
|
|
7275
|
+
| Param | Type | Description |
|
|
7276
|
+
| --- | --- | --- |
|
|
7277
|
+
| handler | [<code>OnUnavailableCallback</code>](#OnUnavailableCallback) | Function to be called when the wallet is not available in the current context. |
|
|
7278
|
+
|
|
7279
|
+
**Example**
|
|
7280
|
+
```js
|
|
7281
|
+
button.onUnavailable(() => {
|
|
7282
|
+
console.log('Wallet not available');
|
|
7283
|
+
});
|
|
7284
|
+
```
|
|
7285
|
+
<a name="BaseWalletButton+onError" id="BaseWalletButton+onError" href="#BaseWalletButton+onError"> </a>
|
|
7286
|
+
|
|
7287
|
+
### paypalWalletButtonExpress.onError(handler)
|
|
7288
|
+
Registers a callback function to be invoked when an error that is not related to payment execution occurs.
|
|
7289
|
+
For example, if the amount of the wallet token injected via the `onClick` event handler does not match the amount provided via the initial `meta` or `setMeta` method.
|
|
7290
|
+
|
|
7291
|
+
**Kind**: instance method of [<code>PaypalWalletButtonExpress</code>](#PaypalWalletButtonExpress)
|
|
7292
|
+
**Overrides**: [<code>onError</code>](#BaseWalletButton+onError)
|
|
7293
|
+
|
|
7294
|
+
| Param | Type | Description |
|
|
7295
|
+
| --- | --- | --- |
|
|
7296
|
+
| handler | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when the WalletButton has an error. |
|
|
7297
|
+
|
|
7298
|
+
**Example**
|
|
7299
|
+
```js
|
|
7300
|
+
button.onError((error) => {
|
|
7301
|
+
console.log('WalletButtonExpress error', error);
|
|
7302
|
+
});
|
|
6919
7303
|
```
|
|
6920
7304
|
<a name="EVENT" id="EVENT" href="#EVENT"> </a>
|
|
6921
7305
|
|
|
6922
|
-
## EVENT : <code>
|
|
6923
|
-
List of available event's name in the
|
|
7306
|
+
## EVENT : <code>object</code>
|
|
7307
|
+
List of available event's name in the wallet button lifecycle
|
|
6924
7308
|
|
|
6925
|
-
**Kind**: global
|
|
7309
|
+
**Kind**: global constant
|
|
6926
7310
|
|
|
6927
|
-
| Param | Type | Default |
|
|
6928
|
-
| --- | --- | --- |
|
|
6929
|
-
|
|
|
6930
|
-
|
|
|
6931
|
-
|
|
|
6932
|
-
|
|
|
6933
|
-
|
|
|
6934
|
-
|
|
|
7311
|
+
| Param | Type | Default |
|
|
7312
|
+
| --- | --- | --- |
|
|
7313
|
+
| UNAVAILABLE | <code>string</code> | <code>"unavailable"</code> |
|
|
7314
|
+
| ERROR | <code>string</code> | <code>"error"</code> |
|
|
7315
|
+
| PAYMENT_SUCCESSFUL | <code>string</code> | <code>"paymentSuccessful"</code> |
|
|
7316
|
+
| PAYMENT_ERROR | <code>string</code> | <code>"paymentError"</code> |
|
|
7317
|
+
| PAYMENT_IN_REVIEW | <code>string</code> | <code>"paymentInReview"</code> |
|
|
7318
|
+
| ON_CLICK | <code>string</code> | <code>"onClick"</code> |
|
|
7319
|
+
| ON_CHECKOUT_CLOSE | <code>string</code> | <code>"onCheckoutClose"</code> |
|
|
6935
7320
|
|
|
6936
|
-
<a name="
|
|
7321
|
+
<a name="OnClickCallback" id="OnClickCallback" href="#OnClickCallback"> </a>
|
|
6937
7322
|
|
|
6938
|
-
##
|
|
6939
|
-
|
|
7323
|
+
## OnClickCallback ⇒ <code>Promise.<string></code>
|
|
7324
|
+
Callback for onClick method.
|
|
6940
7325
|
|
|
6941
|
-
**Kind**: global
|
|
7326
|
+
**Kind**: global typedef
|
|
7327
|
+
**Returns**: <code>Promise.<string></code> - walletToken string result
|
|
6942
7328
|
|
|
6943
|
-
| Param | Type |
|
|
6944
|
-
| --- | --- |
|
|
6945
|
-
|
|
|
6946
|
-
|
|
6947
|
-
|
|
7329
|
+
| Param | Type |
|
|
7330
|
+
| --- | --- |
|
|
7331
|
+
| data | [<code>OnClickEventData</code>](#OnClickEventData) |
|
|
7332
|
+
|
|
7333
|
+
<a name="OnPaymentSuccessfulCallback" id="OnPaymentSuccessfulCallback" href="#OnPaymentSuccessfulCallback"> </a>
|
|
7334
|
+
|
|
7335
|
+
## OnPaymentSuccessfulCallback : <code>function</code>
|
|
7336
|
+
Callback for onPaymentSuccessful method.
|
|
7337
|
+
|
|
7338
|
+
**Kind**: global typedef
|
|
7339
|
+
|
|
7340
|
+
| Param | Type |
|
|
7341
|
+
| --- | --- |
|
|
7342
|
+
| data | [<code>OnPaymentSuccessfulEventData</code>](#OnPaymentSuccessfulEventData) |
|
|
7343
|
+
|
|
7344
|
+
<a name="OnPaymentInReviewCallback" id="OnPaymentInReviewCallback" href="#OnPaymentInReviewCallback"> </a>
|
|
7345
|
+
|
|
7346
|
+
## OnPaymentInReviewCallback : <code>function</code>
|
|
7347
|
+
Callback for onPaymentInReview method.
|
|
7348
|
+
|
|
7349
|
+
**Kind**: global typedef
|
|
7350
|
+
|
|
7351
|
+
| Param | Type |
|
|
7352
|
+
| --- | --- |
|
|
7353
|
+
| data | [<code>OnPaymentInReviewEventData</code>](#OnPaymentInReviewEventData) |
|
|
7354
|
+
|
|
7355
|
+
<a name="OnPaymentErrorCallback" id="OnPaymentErrorCallback" href="#OnPaymentErrorCallback"> </a>
|
|
7356
|
+
|
|
7357
|
+
## OnPaymentErrorCallback : <code>function</code>
|
|
7358
|
+
Callback for onPaymentError method.
|
|
7359
|
+
|
|
7360
|
+
**Kind**: global typedef
|
|
7361
|
+
|
|
7362
|
+
| Param | Type |
|
|
7363
|
+
| --- | --- |
|
|
7364
|
+
| data | [<code>OnPaymentErrorEventData</code>](#OnPaymentErrorEventData) |
|
|
7365
|
+
|
|
7366
|
+
<a name="OnCheckoutCloseCallback" id="OnCheckoutCloseCallback" href="#OnCheckoutCloseCallback"> </a>
|
|
7367
|
+
|
|
7368
|
+
## OnCheckoutCloseCallback : <code>function</code>
|
|
7369
|
+
Callback for onCheckoutClose method.
|
|
7370
|
+
|
|
7371
|
+
**Kind**: global typedef
|
|
7372
|
+
|
|
7373
|
+
| Param | Type |
|
|
7374
|
+
| --- | --- |
|
|
7375
|
+
| data | [<code>OnCloseEventData</code>](#OnCloseEventData) |
|
|
7376
|
+
|
|
7377
|
+
<a name="OnUnavailableCallback" id="OnUnavailableCallback" href="#OnUnavailableCallback"> </a>
|
|
7378
|
+
|
|
7379
|
+
## OnUnavailableCallback : <code>function</code>
|
|
7380
|
+
Callback for onUnavailable method.
|
|
7381
|
+
|
|
7382
|
+
**Kind**: global typedef
|
|
7383
|
+
|
|
7384
|
+
| Param | Type |
|
|
7385
|
+
| --- | --- |
|
|
7386
|
+
| data | [<code>OnUnavailableEventData</code>](#OnUnavailableEventData) |
|
|
7387
|
+
|
|
7388
|
+
<a name="OnErrorCallback" id="OnErrorCallback" href="#OnErrorCallback"> </a>
|
|
7389
|
+
|
|
7390
|
+
## OnErrorCallback : <code>function</code>
|
|
7391
|
+
Callback for onError method.
|
|
7392
|
+
|
|
7393
|
+
**Kind**: global typedef
|
|
7394
|
+
|
|
7395
|
+
| Param | Type |
|
|
7396
|
+
| --- | --- |
|
|
7397
|
+
| data | [<code>OnErrorEventData</code>](#OnErrorEventData) |
|
|
7398
|
+
|
|
7399
|
+
|
|
7400
|
+
# Click To Pay
|
|
7401
|
+
|
|
7402
|
+
## Overview
|
|
7403
|
+
|
|
7404
|
+
Integrate with Click To Pay using Paydock's Click To Pay widget.
|
|
7405
|
+
For a full description of the methods and parameters, reference the [README file](https://www.npmjs.com/package/@paydock/client-sdk#ClickToPay).
|
|
7406
|
+
|
|
7407
|
+
## Click To Pay simple example
|
|
7408
|
+
|
|
7409
|
+
The following section provides an example use case and integration for the widget.
|
|
7410
|
+
|
|
7411
|
+
### Create a Container
|
|
7412
|
+
|
|
7413
|
+
To integrate the Click To Pay checkout iFrame, create a container in your HTML code. This container serves as the placeholder for the iFrame.
|
|
7414
|
+
|
|
7415
|
+
```html
|
|
7416
|
+
<div id="checkoutIframe"></div>
|
|
7417
|
+
```
|
|
7418
|
+
|
|
7419
|
+
### Initialize the Widget
|
|
7420
|
+
|
|
7421
|
+
Use the following code to initialize your widget:
|
|
7422
|
+
|
|
7423
|
+
```javascript
|
|
7424
|
+
var src = new paydock.ClickToPay(
|
|
7425
|
+
"#checkoutIframe",
|
|
7426
|
+
"service_id",
|
|
7427
|
+
"paydock_public_key_or_access_token",
|
|
7428
|
+
{}, // meta
|
|
7429
|
+
);
|
|
7430
|
+
src.load();
|
|
7431
|
+
```
|
|
7432
|
+
|
|
7433
|
+
```javascript
|
|
7434
|
+
// ES2015 | TypeScript
|
|
7435
|
+
import { ClickToPay } from '@paydock/client-sdk';
|
|
7436
|
+
var src = new ClickToPay(
|
|
7437
|
+
"#checkoutIframe",
|
|
7438
|
+
"service_id",
|
|
7439
|
+
"paydock_public_key_or_access_token",
|
|
7440
|
+
{}, // meta
|
|
7441
|
+
);
|
|
7442
|
+
src.load();
|
|
7443
|
+
```
|
|
7444
|
+
|
|
7445
|
+
*NOTE:* Paydock recommends that you use a Paydock Access Token instead of a public key for security reasons in production environments. When creating your access token, you must enable the `Secure Remote Commerce` and add a whitelist for the domain of your checkout screen.
|
|
7446
|
+
|
|
7447
|
+
### Full example
|
|
7448
|
+
|
|
7449
|
+
A full example of the container and the initialized widget is as follows:
|
|
7450
|
+
|
|
7451
|
+
```html
|
|
7452
|
+
<!DOCTYPE html>
|
|
7453
|
+
<html lang="en">
|
|
7454
|
+
<head>
|
|
7455
|
+
<meta charset="UTF-8">
|
|
7456
|
+
<title>Title</title>
|
|
7457
|
+
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
7458
|
+
</head>
|
|
7459
|
+
<body>
|
|
7460
|
+
<div id="checkoutIframe"></div>
|
|
7461
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
7462
|
+
<script>
|
|
7463
|
+
var src = new paydock.ClickToPay(
|
|
7464
|
+
"#checkoutIframe",
|
|
7465
|
+
"service_id",
|
|
7466
|
+
"paydock_public_key_or_access_token",
|
|
7467
|
+
{},
|
|
7468
|
+
);
|
|
7469
|
+
src.load();
|
|
7470
|
+
</script>
|
|
7471
|
+
</body>
|
|
7472
|
+
</html>
|
|
7473
|
+
```
|
|
7474
|
+
|
|
7475
|
+
## Customize your Click To Pay Checkout
|
|
7476
|
+
|
|
7477
|
+
The following is an advanced example that includes customization. You can use these methods to enhance your checkout experience.
|
|
7478
|
+
|
|
7479
|
+
### Settings
|
|
7480
|
+
|
|
7481
|
+
```javascript
|
|
7482
|
+
src.setEnv('sandbox'); // set environment
|
|
7483
|
+
src.hideCheckout(); // hide checkout iframe
|
|
7484
|
+
src.showCheckout(); // show checkout iframe
|
|
7485
|
+
src.on('iframeLoaded', () => {
|
|
7486
|
+
console.log("Initial iframe loaded");
|
|
7487
|
+
});
|
|
7488
|
+
src.on('checkoutReady', () => {
|
|
7489
|
+
console.log("Checkout ready to be used");
|
|
7490
|
+
});
|
|
7491
|
+
src.on('checkoutCompleted', (token) => {
|
|
7492
|
+
console.log(token);
|
|
7493
|
+
});
|
|
7494
|
+
src.on('checkoutError', (error) => {
|
|
7495
|
+
console.log(error);
|
|
7496
|
+
});
|
|
7497
|
+
```
|
|
7498
|
+
|
|
7499
|
+
### Full example
|
|
7500
|
+
|
|
7501
|
+
```html
|
|
7502
|
+
<!DOCTYPE html>
|
|
7503
|
+
<html lang="en">
|
|
7504
|
+
<head>
|
|
7505
|
+
<meta charset="UTF-8">
|
|
7506
|
+
<title>Title</title>
|
|
7507
|
+
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
7508
|
+
</head>
|
|
7509
|
+
<body>
|
|
7510
|
+
<div id="checkoutIframe"></div>
|
|
7511
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
7512
|
+
<script>
|
|
7513
|
+
var src = new paydock.ClickToPay(
|
|
7514
|
+
"#checkoutIframe",
|
|
7515
|
+
"service_id",
|
|
7516
|
+
"paydock_public_key_or_access_token",
|
|
7517
|
+
{},
|
|
7518
|
+
);
|
|
7519
|
+
src.on('iframeLoaded', () => {
|
|
7520
|
+
console.log("Initial iframe loaded");
|
|
7521
|
+
});
|
|
7522
|
+
src.on('checkoutReady', () => {
|
|
7523
|
+
console.log("Checkout ready to be used");
|
|
7524
|
+
});
|
|
7525
|
+
src.on('checkoutCompleted', (token) => {
|
|
7526
|
+
console.log(token);
|
|
7527
|
+
});
|
|
7528
|
+
src.on('checkoutError', (error) => {
|
|
7529
|
+
console.log(error);
|
|
7530
|
+
});
|
|
7531
|
+
src.load();
|
|
7532
|
+
</script>
|
|
7533
|
+
</body>
|
|
7534
|
+
</html>
|
|
7535
|
+
```
|
|
7536
|
+
|
|
7537
|
+
## Customize your billing address fields
|
|
7538
|
+
|
|
7539
|
+
To customize your billing address experience, Paydock uses a flag that manages whether a customer's billing address is mandatory.
|
|
7540
|
+
The options for this customization are NONE (default option), and POSTAL_COUNTRY or FULL.
|
|
7541
|
+
|
|
7542
|
+
```
|
|
7543
|
+
var src = new paydock.ClickToPay(
|
|
7544
|
+
"#checkoutIframe",
|
|
7545
|
+
"service_id",
|
|
7546
|
+
"paydock_public_key_or_access_token",
|
|
7547
|
+
{
|
|
7548
|
+
"dpa_transaction_options": {
|
|
7549
|
+
"dpa_billing_preference": "FULL"
|
|
7550
|
+
}
|
|
7551
|
+
},
|
|
7552
|
+
);
|
|
7553
|
+
```
|
|
7554
|
+
|
|
7555
|
+
The Click To Pay checkout in the example requires the billing address from the customer, which is then returned as a part of the checkout data. The data is then stored and leveraged in the Paydock charge.
|
|
7556
|
+
You can also provide the billing address at the time of creating the charge. For example, if you have a different method for collecting the billing address, such as outside of the Click To Pay checkout, you can provide it alongside other information at the charge creation step:
|
|
7557
|
+
1. Disable the billing address in Paydock's Click To Pay widget.
|
|
7558
|
+
2. Get your One Time Token from the Click To Pay widget alongside other details that may have been collected outside the Click To Pay checkout as the shipping address.
|
|
7559
|
+
3. Send the billing address when creating the charge.
|
|
7560
|
+
|
|
7561
|
+
```
|
|
7562
|
+
POST v1/charges
|
|
7563
|
+
{
|
|
7564
|
+
"amount": "10.00",
|
|
7565
|
+
"currency": "AUD",
|
|
7566
|
+
"token": "one_time_token",
|
|
7567
|
+
"customer": {
|
|
7568
|
+
"payment_source": {
|
|
7569
|
+
"gateway_id": "gateway_id",
|
|
7570
|
+
"address_line1": "address_line1",
|
|
7571
|
+
"address_line2": "address_line2",
|
|
7572
|
+
"address_city": "address_city",
|
|
7573
|
+
"address_postcode": "address_postcode",
|
|
7574
|
+
"address_state": "address_state",
|
|
7575
|
+
"address_country": "address_country"
|
|
7576
|
+
}
|
|
7577
|
+
},
|
|
7578
|
+
"shipping": {
|
|
7579
|
+
"address_line1": "address_line1",
|
|
7580
|
+
"address_line2": "address_line2",
|
|
7581
|
+
"address_line3": "address_line3",
|
|
7582
|
+
"address_city": "address_city",
|
|
7583
|
+
"address_postcode": "address_postcode",
|
|
7584
|
+
"address_state": "address_state",
|
|
7585
|
+
"address_country": "address_country"
|
|
7586
|
+
}
|
|
7587
|
+
}
|
|
7588
|
+
```
|
|
7589
|
+
|
|
7590
|
+
## How to customize accepted cards
|
|
7591
|
+
|
|
7592
|
+
You can send a flag `unaccepted_card_type` to block the usage of a specific card type. The available options are 'DEBIT' and 'CREDIT'.
|
|
7593
|
+
|
|
7594
|
+
### Example code
|
|
7595
|
+
|
|
7596
|
+
The following example demonstrates how to block the card:
|
|
7597
|
+
|
|
7598
|
+
```
|
|
7599
|
+
var src = new paydock.ClickToPay(
|
|
7600
|
+
"#checkoutIframe",
|
|
7601
|
+
"service_id",
|
|
7602
|
+
"paydock_public_key",
|
|
7603
|
+
{
|
|
7604
|
+
unaccepted_card_type: 'DEBIT'
|
|
7605
|
+
},
|
|
7606
|
+
);
|
|
7607
|
+
```
|
|
7608
|
+
|
|
7609
|
+
## Personalize the Style
|
|
7610
|
+
|
|
7611
|
+
Customize the look and feel of your UI. The following example demonstrates changes in the styling of the buttons.
|
|
7612
|
+
|
|
7613
|
+
### Example code
|
|
7614
|
+
|
|
7615
|
+
```
|
|
7616
|
+
var src = new paydock.ClickToPay(
|
|
7617
|
+
"#checkoutIframe",
|
|
7618
|
+
"service_id",
|
|
7619
|
+
"paydock_public_key",
|
|
7620
|
+
{},
|
|
7621
|
+
);
|
|
7622
|
+
src.setStyles({
|
|
7623
|
+
enable_src_popup: true,
|
|
7624
|
+
primary_button_color: 'red',
|
|
7625
|
+
secondary_button_color: 'red',
|
|
7626
|
+
primary_button_text_color: 'red',
|
|
7627
|
+
secondary_button_text_color: 'red',
|
|
7628
|
+
font_family: 'Arial',
|
|
7629
|
+
});
|
|
7630
|
+
```
|
|
7631
|
+
|
|
7632
|
+
## Recognition token
|
|
7633
|
+
|
|
7634
|
+
In order to store user information for further payments, click to pay provides a recognition token that is used to load user information.
|
|
7635
|
+
If you already have a recognitionToken stored, you can use it in meta to load the user information.
|
|
7636
|
+
|
|
7637
|
+
### Storage suggestions
|
|
7638
|
+
Merchant can store the tokens by dropping the token as a 1st party cookie in the browser, and must ensure to manage all the security aspects around dropping/storing the cookie by following the security standards:
|
|
7639
|
+
|
|
7640
|
+
- `Expiration Date=` cookie should be set to expire at a max 180 days
|
|
7641
|
+
- `Secure` flag
|
|
7642
|
+
- `httpOnly` flag
|
|
7643
|
+
- `sameSite=` strict
|
|
7644
|
+
- `Value=` recognition token JWT
|
|
7645
|
+
|
|
7646
|
+
### Example code
|
|
7647
|
+
|
|
7648
|
+
```javascript
|
|
7649
|
+
var src = new paydock.ClickToPay(
|
|
7650
|
+
"#checkoutIframe",
|
|
7651
|
+
"service_id",
|
|
7652
|
+
"paydock_public_key",
|
|
7653
|
+
{
|
|
7654
|
+
"recognition_token": "eyJraWQiOiIy...",
|
|
7655
|
+
},
|
|
7656
|
+
);
|
|
7657
|
+
src.on('recognitionTokenRequested', (data) => {
|
|
7658
|
+
console.log('Recognition token was found: ' + data.data.recognitionToken);
|
|
7659
|
+
// Add recognition token to your store
|
|
7660
|
+
});
|
|
7661
|
+
|
|
7662
|
+
src.on('recognitionTokenDropped', () => {
|
|
7663
|
+
console.log('Recognition token was droped');
|
|
7664
|
+
// Delete recognition token from your store
|
|
7665
|
+
});
|
|
7666
|
+
```
|
|
7667
|
+
|
|
7668
|
+
## Classes
|
|
7669
|
+
|
|
7670
|
+
<dl>
|
|
7671
|
+
<dt><a href="#ClickToPay">ClickToPay</a> ⇐ <code>SRC</code></dt>
|
|
7672
|
+
<dd><p>Class ClickToPay include methods for interacting with the ClickToPay checkout and Manual Card option</p>
|
|
7673
|
+
</dd>
|
|
7674
|
+
</dl>
|
|
7675
|
+
|
|
7676
|
+
## Interfaces
|
|
7677
|
+
|
|
7678
|
+
<dl>
|
|
7679
|
+
<dt><a href="#IMastercardSRCMeta">IMastercardSRCMeta</a> : <code>object</code></dt>
|
|
7680
|
+
<dd><p>Interface of data used for the Mastercard Checkout. For further information refer to <a href="https://developer.mastercard.com/unified-checkout-solutions/documentation/sdk-reference/init">the documentation</a>.</p>
|
|
7681
|
+
</dd>
|
|
7682
|
+
<dt><a href="#EventData">EventData</a> : <code>object</code></dt>
|
|
7683
|
+
<dd><p>Interface for data returned in callbacks</p>
|
|
7684
|
+
</dd>
|
|
7685
|
+
<dt><a href="#EventDataCheckoutCompletedData">EventDataCheckoutCompletedData</a> : <code>object</code></dt>
|
|
7686
|
+
<dd><p>Event data returned for checkoutCompleted callback, holding the One Time Token and the flow type completed.
|
|
7687
|
+
When the flow type is src, masked checkoutData available is also returned</p>
|
|
7688
|
+
</dd>
|
|
7689
|
+
<dt><a href="#IStyles">IStyles</a> : <code>object</code></dt>
|
|
7690
|
+
<dd><p>Interface for style configs inyected to the Click to Pay checkout</p>
|
|
7691
|
+
</dd>
|
|
7692
|
+
</dl>
|
|
7693
|
+
|
|
7694
|
+
<a name="IMastercardSRCMeta" id="IMastercardSRCMeta" href="#IMastercardSRCMeta"> </a>
|
|
7695
|
+
|
|
7696
|
+
## IMastercardSRCMeta : <code>object</code>
|
|
7697
|
+
Interface of data used for the Mastercard Checkout. For further information refer to [the documentation](https://developer.mastercard.com/unified-checkout-solutions/documentation/sdk-reference/init).
|
|
7698
|
+
|
|
7699
|
+
**Kind**: global interface
|
|
7700
|
+
|
|
7701
|
+
| Param | Type | Description |
|
|
7702
|
+
| --- | --- | --- |
|
|
7703
|
+
| [disable_summary_screen] | <code>boolean</code> | Boolean flag that controls if a final summary screen is presented in the checkout flow. |
|
|
7704
|
+
| [dpa_data] | <code>object</code> | Object where the DPA creation data is stored. |
|
|
7705
|
+
| [dpa_data.dpa_presentation_name] | <code>string</code> | Name in which the DPA is presented. |
|
|
7706
|
+
| [dpa_data.dpa_uri] | <code>string</code> | Used for indicating the DPA URI. |
|
|
7707
|
+
| [dpa_data.dpa_address] | <code>string</code> | Address associated with the DPA. |
|
|
7708
|
+
| [dpa_data.dpa_email_address] | <code>string</code> | Email address for DPA communication. |
|
|
7709
|
+
| [dpa_data.dpa_phone_number] | <code>object</code> | Phone number structure for DPA communication. |
|
|
7710
|
+
| [dpa_data.dpa_phone_number.country_code] | <code>string</code> | The country code of the phone number. |
|
|
7711
|
+
| [dpa_data.dpa_phone_number.phone_number] | <code>string</code> | The phone number part of the phone number. |
|
|
7712
|
+
| [dpa_data.dpa_logo_uri] | <code>string</code> | URI for the DPA logo. |
|
|
7713
|
+
| [dpa_data.dpa_supported_email_address] | <code>string</code> | Supported email address for DPA support. |
|
|
7714
|
+
| [dpa_data.dpa_supported_phone_number] | <code>object</code> | Supported phone number for DPA support. |
|
|
7715
|
+
| [dpa_data.dpa_supported_phone_number.country_code] | <code>string</code> | The country code of the phone number. |
|
|
7716
|
+
| [dpa_data.dpa_supported_phone_number.phone_number] | <code>string</code> | The phone number part of the phone number. |
|
|
7717
|
+
| [dpa_data.dpa_support_uri] | <code>string</code> | URI for DPA support. |
|
|
7718
|
+
| [dpa_data.application_type] | <code>string</code> | Application type, either 'WEB_BROWSER' or 'MOBILE_APP'. |
|
|
7719
|
+
| [co_brand_names] | <code>Array.<string></code> | List of co-brand names associated with the Click to Pay experience. |
|
|
7720
|
+
| [checkout_experience] | <code>string</code> | Checkout experience type, either 'WITHIN_CHECKOUT' or 'PAYMENT_SETTINGS'. |
|
|
7721
|
+
| [services] | <code>string</code> | Services offered, such as 'INLINE_CHECKOUT' or 'INLINE_INSTALLMENTS'. |
|
|
7722
|
+
| [dpa_transaction_options] | <code>object</code> | Object that stores options for creating a transaction with DPA. |
|
|
7723
|
+
| [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA’s preferred locale, example en_US. |
|
|
7724
|
+
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array.<string></code> | List of accepted billing countries for DPA in ISO 3166-1 alpha-2 format. |
|
|
7725
|
+
| [dpa_transaction_options.dpa_billing_preference] | <code>string</code> | Billing preferences for DPA, options are 'FULL', 'POSTAL_COUNTRY', 'NONE'. |
|
|
7726
|
+
| [dpa_transaction_options.payment_options] | <code>Array.<object></code> | Payment options included in the transaction. |
|
|
7727
|
+
| [dpa_transaction_options.payment_options.dynamic_data_type] | <code>string</code> | Dynamic data types. |
|
|
7728
|
+
| [dpa_transaction_options.order_type] | <code>string</code> | Type of the order, options are 'SPLIT_SHIPMENT', 'PREFERRED_CARD'. |
|
|
7729
|
+
| [dpa_transaction_options.three_ds_preference] | <code>string</code> | Preference for 3DS usage in the transaction. |
|
|
7730
|
+
| [dpa_transaction_options.confirm_payment] | <code>boolean</code> | Indicates if payment confirmation is required. |
|
|
7731
|
+
| [dpa_transaction_options.consumer_name_requested] | <code>boolean</code> | Indicates if consumer name is requested. |
|
|
7732
|
+
| [dpa_transaction_options.consumer_email_address_requested] | <code>boolean</code> | Indicates if consumer email address is requested. |
|
|
7733
|
+
| [dpa_transaction_options.consumer_phone_number_requested] | <code>boolean</code> | Indicates if consumer phone number is requested. |
|
|
7734
|
+
| [dpa_transaction_options.transaction_amount] | <code>object</code> | Details of the transaction amount. |
|
|
7735
|
+
| [dpa_transaction_options.transaction_amount.transaction_amount] | <code>number</code> | Amount of the transaction. |
|
|
7736
|
+
| [dpa_transaction_options.transaction_amount.transaction_currency_code] | <code>string</code> | Currency code of the transaction in 3 letter ISO code format. |
|
|
7737
|
+
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Merchant's order ID. |
|
|
7738
|
+
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Merchant's category code. |
|
|
7739
|
+
| [dpa_transaction_options.merchant_country_code] | <code>string</code> | Merchant's country code in ISO 3166-1 alpha-2 format. |
|
|
7740
|
+
| [customer] | <code>object</code> | Object where the customer data is stored to prefill in the checkout. |
|
|
7741
|
+
| [customer.email] | <code>string</code> | Customer email. |
|
|
7742
|
+
| [customer.first_name] | <code>string</code> | Customer first name. |
|
|
7743
|
+
| [customer.last_name] | <code>string</code> | Customer last name. |
|
|
7744
|
+
| [customer.phone] | <code>object</code> | Object where the customer phone is stored. |
|
|
7745
|
+
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). |
|
|
7746
|
+
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
7747
|
+
| [unaccepted_card_type] | <code>string</code> | Used to block a specific card type. Options are 'CREDIT', 'DEBIT'. |
|
|
7748
|
+
| [recognition_token] | <code>string</code> | Used for Click to Pay to load user information and preferences. |
|
|
7749
|
+
|
|
7750
|
+
<a name="EventData" id="EventData" href="#EventData"> </a>
|
|
7751
|
+
|
|
7752
|
+
## EventData : <code>object</code>
|
|
7753
|
+
Interface for data returned in callbacks
|
|
7754
|
+
|
|
7755
|
+
**Kind**: global interface
|
|
7756
|
+
|
|
7757
|
+
| Param | Type | Description |
|
|
7758
|
+
| --- | --- | --- |
|
|
7759
|
+
| type | [<code>EVENT\_DATA\_TYPE</code>](#EVENT_DATA_TYPE) | Event type of type [EVENT_DATA_TYPE](#EVENT_DATA_TYPE) |
|
|
7760
|
+
| data | <code>string</code> \| [<code>EventDataCheckoutCompletedData</code>](#EventDataCheckoutCompletedData) | optional data returning a string for checkoutError event or [EventDataCheckoutCompletedData](#EventDataCheckoutCompletedData) for checkoutCompleted |
|
|
7761
|
+
|
|
7762
|
+
<a name="EventDataCheckoutCompletedData" id="EventDataCheckoutCompletedData" href="#EventDataCheckoutCompletedData"> </a>
|
|
7763
|
+
|
|
7764
|
+
## EventDataCheckoutCompletedData : <code>object</code>
|
|
7765
|
+
Event data returned for checkoutCompleted callback, holding the One Time Token and the flow type completed.
|
|
7766
|
+
When the flow type is src, masked checkoutData available is also returned
|
|
7767
|
+
|
|
7768
|
+
**Kind**: global interface
|
|
7769
|
+
|
|
7770
|
+
| Param | Type | Description |
|
|
7771
|
+
| --- | --- | --- |
|
|
7772
|
+
| type | <code>string</code> | type of the checkout, can be `src` or `manual`. |
|
|
7773
|
+
| token | <code>string</code> | one time token value. |
|
|
7774
|
+
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
7775
|
+
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
7776
|
+
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
7777
|
+
| [checkoutData.card_scheme] | <code>string</code> | The card scheme. Values: visa, mastercard, amex, diners, discover. |
|
|
7778
|
+
| [checkoutData.card_type] | <code>string</code> | The type of card. Values: credit, debit, prepaid, combo, flex. |
|
|
7779
|
+
| [checkoutData.address_line1] | <code>string</code> | Address line 1 for billing address. |
|
|
7780
|
+
| [checkoutData.address_line2] | <code>string</code> | Address line 2 for billing address. |
|
|
7781
|
+
| [checkoutData.address_line3] | <code>string</code> | Address line 3 for billing address. |
|
|
7782
|
+
| [checkoutData.address_city] | <code>string</code> | City for billing address. |
|
|
7783
|
+
| [checkoutData.address_postcode] | <code>string</code> | Postal code for billing address. |
|
|
7784
|
+
| [checkoutData.address_state] | <code>string</code> | State or province for billing address. |
|
|
7785
|
+
| [checkoutData.address_country] | <code>string</code> | Country for billing address. |
|
|
7786
|
+
| [checkoutData.shipping] | <code>object</code> | Optional shipping information. |
|
|
7787
|
+
| [checkoutData.shipping.address_line1] | <code>string</code> | Address line 1 for shipping address. |
|
|
7788
|
+
| [checkoutData.shipping.address_line2] | <code>string</code> | Address line 2 for shipping address. |
|
|
7789
|
+
| [checkoutData.shipping.address_line3] | <code>string</code> | Address line 3 for shipping address. |
|
|
7790
|
+
| [checkoutData.shipping.address_city] | <code>string</code> | City for shipping address. |
|
|
7791
|
+
| [checkoutData.shipping.address_postcode] | <code>string</code> | Postal code for shipping address. |
|
|
7792
|
+
| [checkoutData.shipping.address_state] | <code>string</code> | State or province for shipping address. |
|
|
7793
|
+
| [checkoutData.shipping.address_country] | <code>string</code> | Country for shipping address. |
|
|
7794
|
+
|
|
7795
|
+
<a name="IStyles" id="IStyles" href="#IStyles"> </a>
|
|
7796
|
+
|
|
7797
|
+
## IStyles : <code>object</code>
|
|
7798
|
+
Interface for style configs inyected to the Click to Pay checkout
|
|
7799
|
+
|
|
7800
|
+
**Kind**: global interface
|
|
7801
|
+
|
|
7802
|
+
| Param | Type | Description |
|
|
7803
|
+
| --- | --- | --- |
|
|
7804
|
+
| [primary_button_color] | <code>string</code> | Color Code for primary button. |
|
|
7805
|
+
| [primary_button_text_color] | <code>string</code> | Color Code for primary button text. |
|
|
7806
|
+
| [secondary_button_color] | <code>string</code> | Color Code for secondary button. |
|
|
7807
|
+
| [secondary_button_text_color] | <code>string</code> | Color Code for secondary button text. |
|
|
7808
|
+
| [font_family] | <code>string</code> | Font family to be used. |
|
|
7809
|
+
| [enable_src_popup] | <code>boolean</code> | Boolean flag to make the Click to Pay checkout show in a popup window instead of embedded in iframe. |
|
|
7810
|
+
|
|
7811
|
+
<a name="ClickToPay" id="ClickToPay" href="#ClickToPay"> </a>
|
|
7812
|
+
|
|
7813
|
+
## ClickToPay ⇐ <code>SRC</code>
|
|
7814
|
+
Class ClickToPay include methods for interacting with the ClickToPay checkout and Manual Card option
|
|
7815
|
+
|
|
7816
|
+
**Kind**: global class
|
|
7817
|
+
**Extends**: <code>SRC</code>
|
|
7818
|
+
|
|
7819
|
+
* [ClickToPay](#ClickToPay) ⇐ <code>SRC</code>
|
|
7820
|
+
* [new ClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)](#new_ClickToPay_new)
|
|
7821
|
+
* [.load()](#ClickToPay+load)
|
|
7822
|
+
* [.setStyles(fields)](#SRC+setStyles)
|
|
7823
|
+
* [.setEnv(env, [alias])](#SRC+setEnv)
|
|
7824
|
+
* [.getEnv()](#SRC+getEnv)
|
|
7825
|
+
* [.on(eventName, [cb])](#SRC+on) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
7826
|
+
* [.hideCheckout([saveSize])](#SRC+hideCheckout)
|
|
7827
|
+
* [.showCheckout()](#SRC+showCheckout)
|
|
7828
|
+
* [.reload()](#SRC+reload)
|
|
7829
|
+
* [.useAutoResize()](#SRC+useAutoResize)
|
|
7830
|
+
|
|
7831
|
+
<a name="new_ClickToPay_new" id="new_ClickToPay_new" href="#new_ClickToPay_new"> </a>
|
|
7832
|
+
|
|
7833
|
+
### new ClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)
|
|
7834
|
+
|
|
7835
|
+
| Param | Type | Description |
|
|
7836
|
+
| --- | --- | --- |
|
|
7837
|
+
| iframe_selector | <code>string</code> | Selector of html element. Container for Click To Pay checkout iFrame. |
|
|
7838
|
+
| service_id | <code>string</code> | Card Scheme Service ID |
|
|
7839
|
+
| public_key_or_access_token | <code>string</code> | Paydock public key or Access Token |
|
|
7840
|
+
| meta | <code>IClickToPayMeta</code> | Data that configures the Click To Pay checkout |
|
|
7841
|
+
|
|
7842
|
+
**Example**
|
|
7843
|
+
```js
|
|
7844
|
+
var mastercardSRC = new ClickToPay('#checkoutIframe', 'service_id', 'public_key', {});
|
|
7845
|
+
```
|
|
7846
|
+
<a name="ClickToPay+load" id="ClickToPay+load" href="#ClickToPay+load"> </a>
|
|
7847
|
+
|
|
7848
|
+
### clickToPay.load()
|
|
7849
|
+
The final method after configuring the SRC to start the load process of Click To Pay checkout
|
|
7850
|
+
|
|
7851
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7852
|
+
<a name="SRC+setStyles" id="SRC+setStyles" href="#SRC+setStyles"> </a>
|
|
7853
|
+
|
|
7854
|
+
### clickToPay.setStyles(fields)
|
|
7855
|
+
Object contain styles for widget - call before `.load()`.
|
|
7856
|
+
|
|
7857
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7858
|
+
**Overrides**: [<code>setStyles</code>](#SRC+setStyles)
|
|
7859
|
+
|
|
7860
|
+
| Param | Type | Description |
|
|
7861
|
+
| --- | --- | --- |
|
|
7862
|
+
| fields | [<code>IStyles</code>](#IStyles) | name of styles which can be shown in widget [STYLE](STYLE) |
|
|
7863
|
+
|
|
7864
|
+
**Example**
|
|
7865
|
+
```js
|
|
7866
|
+
widget.setStyles({
|
|
7867
|
+
enable_src_popup: true
|
|
7868
|
+
primary_button_color: 'red',
|
|
7869
|
+
secondary_button_color: 'blue',
|
|
7870
|
+
primary_button_text_color: 'white',
|
|
7871
|
+
secondary_button_text_color: 'white',
|
|
7872
|
+
font_family: 'Arial',
|
|
7873
|
+
});
|
|
7874
|
+
```
|
|
7875
|
+
<a name="SRC+setEnv" id="SRC+setEnv" href="#SRC+setEnv"> </a>
|
|
7876
|
+
|
|
7877
|
+
### clickToPay.setEnv(env, [alias])
|
|
7878
|
+
Current method can change environment. By default environment = sandbox.
|
|
7879
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
7880
|
+
|
|
7881
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7882
|
+
**Overrides**: [<code>setEnv</code>](#SRC+setEnv)
|
|
7883
|
+
|
|
7884
|
+
| Param | Type | Description |
|
|
7885
|
+
| --- | --- | --- |
|
|
7886
|
+
| env | <code>string</code> | sandbox, production |
|
|
7887
|
+
| [alias] | <code>string</code> | Own domain alias |
|
|
7888
|
+
|
|
7889
|
+
**Example**
|
|
7890
|
+
```js
|
|
7891
|
+
SRC.setEnv('production');
|
|
7892
|
+
```
|
|
7893
|
+
<a name="SRC+getEnv" id="SRC+getEnv" href="#SRC+getEnv"> </a>
|
|
7894
|
+
|
|
7895
|
+
### clickToPay.getEnv()
|
|
7896
|
+
Method to read the current environment
|
|
7897
|
+
|
|
7898
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7899
|
+
**Overrides**: [<code>getEnv</code>](#SRC+getEnv)
|
|
7900
|
+
**Example**
|
|
7901
|
+
```js
|
|
7902
|
+
SRC.getEnv();
|
|
7903
|
+
```
|
|
7904
|
+
<a name="SRC+on" id="SRC+on" href="#SRC+on"> </a>
|
|
7905
|
+
|
|
7906
|
+
### clickToPay.on(eventName, [cb]) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
7907
|
+
Listen to events of SRC
|
|
7908
|
+
|
|
7909
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7910
|
+
**Overrides**: [<code>on</code>](#SRC+on)
|
|
7911
|
+
|
|
7912
|
+
| Param | Type | Description |
|
|
7913
|
+
| --- | --- | --- |
|
|
7914
|
+
| eventName | <code>string</code> | Available event names [EVENT](#EVENT) |
|
|
7915
|
+
| [cb] | <code>listener</code> | The callback to handle the event. When available, it will send back data of type [EventData](#EventData) |
|
|
7916
|
+
|
|
7917
|
+
**Example**
|
|
7918
|
+
```js
|
|
7919
|
+
SRC.on('checkoutCompleted', function (token) {
|
|
7920
|
+
console.log(token);
|
|
7921
|
+
});
|
|
7922
|
+
// or
|
|
7923
|
+
SRC.on('checkoutCompleted').then(function (token) {
|
|
7924
|
+
console.log(token);
|
|
7925
|
+
});
|
|
7926
|
+
```
|
|
7927
|
+
<a name="SRC+hideCheckout" id="SRC+hideCheckout" href="#SRC+hideCheckout"> </a>
|
|
7928
|
+
|
|
7929
|
+
### clickToPay.hideCheckout([saveSize])
|
|
7930
|
+
Using this method you can hide checkout after load and button click
|
|
7931
|
+
|
|
7932
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7933
|
+
**Overrides**: [<code>hideCheckout</code>](#SRC+hideCheckout)
|
|
7934
|
+
|
|
7935
|
+
| Param | Type | Default | Description |
|
|
7936
|
+
| --- | --- | --- | --- |
|
|
7937
|
+
| [saveSize] | <code>boolean</code> | <code>false</code> | using this param you can save iframe's size (if applicable) |
|
|
7938
|
+
|
|
7939
|
+
**Example**
|
|
7940
|
+
```js
|
|
7941
|
+
SRC.hideCheckout();
|
|
7942
|
+
```
|
|
7943
|
+
<a name="SRC+showCheckout" id="SRC+showCheckout" href="#SRC+showCheckout"> </a>
|
|
7944
|
+
|
|
7945
|
+
### clickToPay.showCheckout()
|
|
7946
|
+
Using this method you can show checkout after using hideCheckout method
|
|
7947
|
+
|
|
7948
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7949
|
+
**Overrides**: [<code>showCheckout</code>](#SRC+showCheckout)
|
|
7950
|
+
**Example**
|
|
7951
|
+
```js
|
|
7952
|
+
SRC.showCheckout()
|
|
7953
|
+
```
|
|
7954
|
+
<a name="SRC+reload" id="SRC+reload" href="#SRC+reload"> </a>
|
|
7955
|
+
|
|
7956
|
+
### clickToPay.reload()
|
|
7957
|
+
Using this method you can reload the whole checkout
|
|
7958
|
+
|
|
7959
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7960
|
+
**Overrides**: [<code>reload</code>](#SRC+reload)
|
|
7961
|
+
**Example**
|
|
7962
|
+
```js
|
|
7963
|
+
SRC.reload()
|
|
7964
|
+
```
|
|
7965
|
+
<a name="SRC+useAutoResize" id="SRC+useAutoResize" href="#SRC+useAutoResize"> </a>
|
|
7966
|
+
|
|
7967
|
+
### clickToPay.useAutoResize()
|
|
7968
|
+
Use this method for resize checkout iFrame according to content height, if applicable
|
|
7969
|
+
|
|
7970
|
+
**Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
|
|
7971
|
+
**Overrides**: [<code>useAutoResize</code>](#SRC+useAutoResize)
|
|
7972
|
+
**Example**
|
|
7973
|
+
```js
|
|
7974
|
+
SRC.useAutoResize();
|
|
7975
|
+
```
|
|
7976
|
+
<a name="EVENT" id="EVENT" href="#EVENT"> </a>
|
|
7977
|
+
|
|
7978
|
+
## EVENT : <code>enum</code>
|
|
7979
|
+
List of available event's name in the Click To Pay checkout lifecycle
|
|
7980
|
+
|
|
7981
|
+
**Kind**: global enum
|
|
7982
|
+
|
|
7983
|
+
| Param | Type | Default | Description |
|
|
7984
|
+
| --- | --- | --- | --- |
|
|
7985
|
+
| IFRAME_LOADED | <code>string</code> | <code>"iframeLoaded"</code> | Initial event sent when IFrame is initially loaded. |
|
|
7986
|
+
| CHECKOUT_READY | <code>string</code> | <code>"checkoutReady"</code> | Event sent when checkout is loaded and ready to be used by customer. Leverage alongside [showCheckout](#SRC+showCheckout) and [hideCheckout](#SRC+hideCheckout). |
|
|
7987
|
+
| CHECKOUT_POPUP_OPEN | <code>string</code> | <code>"checkoutPopupOpen"</code> | Event sent when Click To Pay checkout flow is started, regardless of embedded or windowed mode. |
|
|
7988
|
+
| CHECKOUT_POPUP_CLOSE | <code>string</code> | <code>"checkoutPopupClose"</code> | Event sent when Click To Pay checkout flow is closed, regardless of embedded or windowed mode. |
|
|
7989
|
+
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> | Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information. |
|
|
7990
|
+
| CHECKOUT_ERROR | <code>string</code> | <code>"checkoutError"</code> | Event sent on error checkout by customer. Check [data](#EventData) for more information. |
|
|
7991
|
+
| RECOGNITION_TOKEN_REQUESTED | <code>string</code> | <code>"recognitionTokenRequested"</code> | Event sent when a recognition token was found on the mastercard SDK response. |
|
|
7992
|
+
| RECOGNITION_TOKEN_DROPPED | <code>string</code> | <code>"recognitionTokenDropped"</code> | Event sent when a recognition token needs to be dropped for user be no longer remembered. |
|
|
7993
|
+
|
|
7994
|
+
<a name="EVENT_DATA_TYPE" id="EVENT_DATA_TYPE" href="#EVENT_DATA_TYPE"> </a>
|
|
7995
|
+
|
|
7996
|
+
## EVENT\_DATA\_TYPE : <code>enum</code>
|
|
7997
|
+
List of available event data types
|
|
7998
|
+
|
|
7999
|
+
**Kind**: global enum
|
|
8000
|
+
|
|
8001
|
+
| Param | Type | Default | Description |
|
|
8002
|
+
| --- | --- | --- | --- |
|
|
8003
|
+
| CRITICAL_ERROR | <code>string</code> | <code>"CriticalError"</code> | in this error scenario the checkout is understood to be in a non-recoverable state and should be closed by the merchant and give alternate payment options to the user |
|
|
8004
|
+
| USER_ERROR | <code>string</code> | <code>"UserError"</code> | in this error scenario the error in likely a user input error and the checkout is in a recoverable state, so the user will be kept within the checkout and can retry the flow |
|
|
8005
|
+
| SUCCESS | <code>string</code> | <code>"Success"</code> | |
|
|
8006
|
+
|
|
8007
|
+
|
|
8008
|
+
## PayPalSavePaymentSource Widget
|
|
8009
|
+
|
|
8010
|
+
PayPalSavePaymentSource Widget allows to obtain a Paydock one time token linked with a Paypal payment source from the customer.
|
|
8011
|
+
|
|
8012
|
+
The general flow to use the widgets is:
|
|
8013
|
+
1. Configure your PayPal gateway and connect it using Paydock API or Dashboard.
|
|
8014
|
+
2. Create a container in your site
|
|
8015
|
+
```html
|
|
8016
|
+
<div id="widget"></div>
|
|
8017
|
+
```
|
|
8018
|
+
3. Initialize the specific `PayPalSavePaymentSourceWidget`, providing your Access token or Public Key, the Gateway ID that Paydock provides plus required and optional config parameter for the widget in use. The general format is:
|
|
8019
|
+
```js
|
|
8020
|
+
new paydock.PayPalSavePaymentSourceWidget(
|
|
8021
|
+
"#widget",
|
|
8022
|
+
accessTokenOrPublicKey,
|
|
8023
|
+
gatewayId,
|
|
8024
|
+
widgetSpecificConfig,
|
|
8025
|
+
);
|
|
8026
|
+
```
|
|
8027
|
+
4. Handle the `onSuccess`, `onError` and `onCancel` for paypal setup token results.
|
|
8028
|
+
5. If `onSuccess` event is emmited, event data should contain `token` and `email` ready to use.
|
|
8029
|
+
|
|
8030
|
+
### Example
|
|
8031
|
+
|
|
8032
|
+
A full description of the config parameters for [PayPalSavePaymentSourceWidget](#PayPalSavePaymentSourceWidget) meta parameters can be found [here](#PayPalSavePaymentSourceWidgetConfig). Below you will find a fully working html example.
|
|
8033
|
+
|
|
8034
|
+
```html
|
|
8035
|
+
<!DOCTYPE html>
|
|
8036
|
+
<html lang="en">
|
|
8037
|
+
<head>
|
|
8038
|
+
<meta charset="UTF-8">
|
|
8039
|
+
<title>Title</title>
|
|
8040
|
+
</head>
|
|
8041
|
+
<body>
|
|
8042
|
+
<h2>Using PayDock PayPalSavePaymentSourceWidget!</h2>
|
|
8043
|
+
<div id="widget"></div>
|
|
8044
|
+
</body>
|
|
8045
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
8046
|
+
<script>
|
|
8047
|
+
let button = new paydock.PayPalSavePaymentSourceWidget(
|
|
8048
|
+
"#widget",
|
|
8049
|
+
accessTokenOrPublicKey,
|
|
8050
|
+
gatewayId,
|
|
8051
|
+
{
|
|
8052
|
+
style: {
|
|
8053
|
+
layout: 'vertical',
|
|
8054
|
+
color: 'gold',
|
|
8055
|
+
shape: 'pill',
|
|
8056
|
+
label: 'paypal'
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
);
|
|
8060
|
+
|
|
8061
|
+
payPalSavePaymentSourceWidget.onSuccess((data) => console.log('On success: ', data));
|
|
8062
|
+
payPalSavePaymentSourceWidget.onError((data) => console.log('On error: ', data));
|
|
8063
|
+
payPalSavePaymentSourceWidget.onCancel(() => console.log('On cancelled'));
|
|
8064
|
+
|
|
8065
|
+
button.setEnv('sandbox');
|
|
8066
|
+
|
|
8067
|
+
button.load();
|
|
8068
|
+
</script>
|
|
8069
|
+
</html>
|
|
8070
|
+
```
|
|
8071
|
+
|
|
8072
|
+
## Classes
|
|
8073
|
+
|
|
8074
|
+
<dl>
|
|
8075
|
+
<dt><a href="#PayPalSavePaymentSourceWidget">PayPalSavePaymentSourceWidget</a></dt>
|
|
8076
|
+
<dd><p>PayPal Save Payment Source Widget constructor</p>
|
|
8077
|
+
</dd>
|
|
8078
|
+
</dl>
|
|
8079
|
+
|
|
8080
|
+
## Typedefs
|
|
8081
|
+
|
|
8082
|
+
<dl>
|
|
8083
|
+
<dt><a href="#OnSuccessCallback">OnSuccessCallback</a> : <code>function</code></dt>
|
|
8084
|
+
<dd><p>Callback for onSuccess method.</p>
|
|
8085
|
+
</dd>
|
|
8086
|
+
<dt><a href="#OnErrorCallback">OnErrorCallback</a> : <code>function</code></dt>
|
|
8087
|
+
<dd><p>Callback for onError method.</p>
|
|
8088
|
+
</dd>
|
|
8089
|
+
<dt><a href="#OnCancelCallback">OnCancelCallback</a> : <code>function</code></dt>
|
|
8090
|
+
<dd><p>Callback for onCancel method.</p>
|
|
8091
|
+
</dd>
|
|
8092
|
+
</dl>
|
|
8093
|
+
|
|
8094
|
+
## Interfaces
|
|
8095
|
+
|
|
8096
|
+
<dl>
|
|
8097
|
+
<dt><a href="#PayPalSavePaymentSourceWidgetConfig">PayPalSavePaymentSourceWidgetConfig</a> : <code>object</code></dt>
|
|
8098
|
+
<dd><p>Interface of data used for PayPal configuration. For further information refer to <a href="https://developer.paypal.com/sdk/js/reference/#style">the documentation</a>.</p>
|
|
8099
|
+
</dd>
|
|
8100
|
+
<dt><a href="#ErrorCodes">ErrorCodes</a> : <code>object</code></dt>
|
|
8101
|
+
<dd><p>Interface of possible error codes inside onError event data.</p>
|
|
8102
|
+
</dd>
|
|
8103
|
+
<dt><a href="#IOnSuccessEventData">IOnSuccessEventData</a> : <code>object</code></dt>
|
|
8104
|
+
<dd><p>Interface for IOnSuccessEventData</p>
|
|
8105
|
+
</dd>
|
|
8106
|
+
<dt><a href="#IOnErrorEventData">IOnErrorEventData</a> : <code>object</code></dt>
|
|
8107
|
+
<dd><p>Interface for IOnErrorEventData</p>
|
|
8108
|
+
</dd>
|
|
8109
|
+
<dt><a href="#IOnCancelEventData">IOnCancelEventData</a> : <code>object</code></dt>
|
|
8110
|
+
<dd><p>Interface for IOnCancelEventData</p>
|
|
8111
|
+
</dd>
|
|
8112
|
+
</dl>
|
|
8113
|
+
|
|
8114
|
+
<a name="PayPalSavePaymentSourceWidgetConfig" id="PayPalSavePaymentSourceWidgetConfig" href="#PayPalSavePaymentSourceWidgetConfig"> </a>
|
|
8115
|
+
|
|
8116
|
+
## PayPalSavePaymentSourceWidgetConfig : <code>object</code>
|
|
8117
|
+
Interface of data used for PayPal configuration. For further information refer to [the documentation](https://developer.paypal.com/sdk/js/reference/#style).
|
|
8118
|
+
|
|
8119
|
+
**Kind**: global interface
|
|
8120
|
+
|
|
8121
|
+
| Param | Type | Description |
|
|
8122
|
+
| --- | --- | --- |
|
|
8123
|
+
| [style.layout] | <code>'vertical'</code> \| <code>'horizontal'</code> | Used for indicating the PayPal Button layout. |
|
|
8124
|
+
| [style.color] | <code>'blue'</code> \| <code>'gold'</code> \| <code>'silver'</code> \| <code>'black'</code> \| <code>'white'</code> | Used for indicating the main color of the PayPal Button. |
|
|
8125
|
+
| [style.shape] | <code>'rect'</code> \| <code>'sharp'</code> \| <code>'pill'</code> | Used for indicating the shape of the PayPal Button. |
|
|
8126
|
+
| [style.label] | <code>'paypal'</code> \| <code>'checkout'</code> \| <code>'buynow'</code> \| <code>'pay'</code> | Used for indicating the label of the PayPal Button. |
|
|
8127
|
+
| [style.disableMaxWidth] | <code>boolean</code> | Used for indicating if the max width will be disabled. |
|
|
8128
|
+
| [style.disableMaxHeight] | <code>boolean</code> | Used for indicating the max height will be disabled. |
|
|
8129
|
+
| [style.height] | <code>number</code> | Used for indicating the height of the PayPal Button, if disableMaxHeight is true. |
|
|
8130
|
+
| [style.borderRadius] | <code>number</code> | Used for indicating the border radius of the PayPal Button. |
|
|
8131
|
+
| [style.tagline] | <code>boolean</code> | Used for indicating the tagline of the PayPal Button. |
|
|
8132
|
+
| [message.amount] | <code>number</code> | Used for indicating an amount before the payment. |
|
|
8133
|
+
| [message.align] | <code>'center'</code> \| <code>'left'</code> \| <code>'right'</code> | Used for indicating the align of the message. |
|
|
8134
|
+
| [message.color] | <code>'black'</code> \| <code>'white'</code> | Used for indicating the color of the message. |
|
|
8135
|
+
| [message.position] | <code>'top'</code> \| <code>'bottom'</code> | Used for indicating the position of the message. |
|
|
8136
|
+
|
|
8137
|
+
<a name="ErrorCodes" id="ErrorCodes" href="#ErrorCodes"> </a>
|
|
8138
|
+
|
|
8139
|
+
## ErrorCodes : <code>object</code>
|
|
8140
|
+
Interface of possible error codes inside onError event data.
|
|
8141
|
+
|
|
8142
|
+
**Kind**: global interface
|
|
8143
|
+
|
|
8144
|
+
| Param | Type | Description |
|
|
8145
|
+
| --- | --- | --- |
|
|
8146
|
+
| [unavailable] | <code>string</code> | Error code when an error occurs loading the widget. |
|
|
8147
|
+
| [onPaypalVaultSetupTokenError] | <code>string</code> | Error code when an error occrus on PayPal side. |
|
|
8148
|
+
| [onGetIdTokenError] | <code>string</code> | Error code when trying to get ID token from PayPal. |
|
|
8149
|
+
| [onGetWalletConfigError] | <code>string</code> | Error code when trying to get wallet config from Paydock. |
|
|
8150
|
+
| [onGetSetupTokenError] | <code>string</code> | Error code when trying to get the setup token from PayPal. |
|
|
8151
|
+
| [onOneTimeTokenError] | <code>string</code> | Error code when trying to get the one time token from Paydock. |
|
|
8152
|
+
|
|
8153
|
+
<a name="IOnSuccessEventData" id="IOnSuccessEventData" href="#IOnSuccessEventData"> </a>
|
|
8154
|
+
|
|
8155
|
+
## IOnSuccessEventData : <code>object</code>
|
|
8156
|
+
Interface for IOnSuccessEventData
|
|
8157
|
+
|
|
8158
|
+
**Kind**: global interface
|
|
8159
|
+
|
|
8160
|
+
| Param | Type | Description |
|
|
8161
|
+
| --- | --- | --- |
|
|
8162
|
+
| event | <code>EVENTS</code> | Event Name is 'ON_SUCCESS' |
|
|
8163
|
+
| data | <code>object</code> | Data object |
|
|
8164
|
+
| data.token | <code>string</code> | One Time Token to be exchanged for a Paydock Customer. |
|
|
8165
|
+
| [data.email] | <code>string</code> | Paypal account customer email if retrieved from Paypal servers. |
|
|
8166
|
+
|
|
8167
|
+
<a name="IOnErrorEventData" id="IOnErrorEventData" href="#IOnErrorEventData"> </a>
|
|
8168
|
+
|
|
8169
|
+
## IOnErrorEventData : <code>object</code>
|
|
8170
|
+
Interface for IOnErrorEventData
|
|
8171
|
+
|
|
8172
|
+
**Kind**: global interface
|
|
8173
|
+
|
|
8174
|
+
| Param | Type | Description |
|
|
8175
|
+
| --- | --- | --- |
|
|
8176
|
+
| event | <code>EVENTS</code> | Event Name is 'ON_ERROR' |
|
|
8177
|
+
| data | <code>object</code> | Error data object |
|
|
8178
|
+
| data.error_code | [<code>ErrorCodes</code>](#ErrorCodes) | Error code. One of ErrorCodes. |
|
|
8179
|
+
| [data.details] | <code>string</code> | Error details. |
|
|
8180
|
+
| [data.message] | <code>string</code> | Error message. |
|
|
8181
|
+
|
|
8182
|
+
<a name="IOnCancelEventData" id="IOnCancelEventData" href="#IOnCancelEventData"> </a>
|
|
8183
|
+
|
|
8184
|
+
## IOnCancelEventData : <code>object</code>
|
|
8185
|
+
Interface for IOnCancelEventData
|
|
8186
|
+
|
|
8187
|
+
**Kind**: global interface
|
|
8188
|
+
|
|
8189
|
+
| Param | Type | Description |
|
|
8190
|
+
| --- | --- | --- |
|
|
8191
|
+
| event | <code>EVENTS</code> | Event Name is 'ON_CANCEL' |
|
|
8192
|
+
|
|
8193
|
+
<a name="PayPalSavePaymentSourceWidget" id="PayPalSavePaymentSourceWidget" href="#PayPalSavePaymentSourceWidget"> </a>
|
|
8194
|
+
|
|
8195
|
+
## PayPalSavePaymentSourceWidget
|
|
8196
|
+
PayPal Save Payment Source Widget constructor
|
|
8197
|
+
|
|
8198
|
+
**Kind**: global class
|
|
8199
|
+
|
|
8200
|
+
* [PayPalSavePaymentSourceWidget](#PayPalSavePaymentSourceWidget)
|
|
8201
|
+
* [new PayPalSavePaymentSourceWidget(selector, publicKey, gatewayId, config)](#new_PayPalSavePaymentSourceWidget_new)
|
|
8202
|
+
* [.load()](#PayPalSavePaymentSourceWidget+load)
|
|
8203
|
+
* [.setEnv(env, [alias])](#PayPalSavePaymentSourceWidget+setEnv)
|
|
8204
|
+
* [.onSuccess([callback])](#PayPalSavePaymentSourceWidget+onSuccess)
|
|
8205
|
+
* [.onError([callback])](#PayPalSavePaymentSourceWidget+onError)
|
|
8206
|
+
* [.onCancel([callback])](#PayPalSavePaymentSourceWidget+onCancel)
|
|
8207
|
+
|
|
8208
|
+
<a name="new_PayPalSavePaymentSourceWidget_new" id="new_PayPalSavePaymentSourceWidget_new" href="#new_PayPalSavePaymentSourceWidget_new"> </a>
|
|
8209
|
+
|
|
8210
|
+
### new PayPalSavePaymentSourceWidget(selector, publicKey, gatewayId, config)
|
|
8211
|
+
|
|
8212
|
+
| Param | Type | Description |
|
|
8213
|
+
| --- | --- | --- |
|
|
8214
|
+
| selector | <code>string</code> | Selector of html element. Container for PayPal Save Payment Source Widget. |
|
|
8215
|
+
| publicKey | <code>string</code> | PayDock users public key. |
|
|
8216
|
+
| gatewayId | <code>string</code> | PayDock's PayPal gatewayId. |
|
|
8217
|
+
| config | [<code>PayPalSavePaymentSourceWidgetConfig</code>](#PayPalSavePaymentSourceWidgetConfig) | Extra configuration for the widget, like styles. |
|
|
8218
|
+
|
|
8219
|
+
**Example**
|
|
8220
|
+
```js
|
|
8221
|
+
var payPalSavePaymentSourceWidget = new PayPalSavePaymentSourceWidget('#paypalButton', 'public_key', 'gateway_id');
|
|
8222
|
+
```
|
|
8223
|
+
<a name="PayPalSavePaymentSourceWidget+load" id="PayPalSavePaymentSourceWidget+load" href="#PayPalSavePaymentSourceWidget+load"> </a>
|
|
8224
|
+
|
|
8225
|
+
### payPalSavePaymentSourceWidget.load()
|
|
8226
|
+
The final method after configuring the PayPalSavePaymentSource Widget to
|
|
8227
|
+
start the load process.
|
|
8228
|
+
|
|
8229
|
+
**Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
|
|
8230
|
+
<a name="PayPalSavePaymentSourceWidget+setEnv" id="PayPalSavePaymentSourceWidget+setEnv" href="#PayPalSavePaymentSourceWidget+setEnv"> </a>
|
|
8231
|
+
|
|
8232
|
+
### payPalSavePaymentSourceWidget.setEnv(env, [alias])
|
|
8233
|
+
Current method can change environment. By default environment = sandbox.
|
|
8234
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
8235
|
+
|
|
8236
|
+
**Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
|
|
8237
|
+
|
|
8238
|
+
| Param | Type | Description |
|
|
8239
|
+
| --- | --- | --- |
|
|
8240
|
+
| env | <code>string</code> | sandbox, production |
|
|
8241
|
+
| [alias] | <code>string</code> | Own domain alias |
|
|
8242
|
+
|
|
8243
|
+
**Example**
|
|
8244
|
+
```js
|
|
8245
|
+
payPalSavePaymentSourceWidget.setEnv('production');
|
|
8246
|
+
```
|
|
8247
|
+
<a name="PayPalSavePaymentSourceWidget+onSuccess" id="PayPalSavePaymentSourceWidget+onSuccess" href="#PayPalSavePaymentSourceWidget+onSuccess"> </a>
|
|
8248
|
+
|
|
8249
|
+
### payPalSavePaymentSourceWidget.onSuccess([callback])
|
|
8250
|
+
If the setup token was successfully approved and a OTT was generated, the function passed as parameter will be called.
|
|
8251
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
8252
|
+
|
|
8253
|
+
**Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
|
|
8254
|
+
|
|
8255
|
+
| Param | Type | Description |
|
|
8256
|
+
| --- | --- | --- |
|
|
8257
|
+
| [callback] | [<code>OnSuccessCallback</code>](#OnSuccessCallback) | Function to be called when the result is successful. |
|
|
8258
|
+
|
|
8259
|
+
**Example**
|
|
8260
|
+
```js
|
|
8261
|
+
payPalSavePaymentSourceWidget.onSuccess((eventData) => console.log('One time token and email obtained successfully'));
|
|
8262
|
+
```
|
|
8263
|
+
<a name="PayPalSavePaymentSourceWidget+onError" id="PayPalSavePaymentSourceWidget+onError" href="#PayPalSavePaymentSourceWidget+onError"> </a>
|
|
8264
|
+
|
|
8265
|
+
### payPalSavePaymentSourceWidget.onError([callback])
|
|
8266
|
+
If in the process for obtaining the setup token fails, the function passed as parameter will be called.
|
|
8267
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
8268
|
+
|
|
8269
|
+
**Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
|
|
8270
|
+
|
|
8271
|
+
| Param | Type | Description |
|
|
8272
|
+
| --- | --- | --- |
|
|
8273
|
+
| [callback] | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when there is an error in the flow. |
|
|
8274
|
+
|
|
8275
|
+
**Example**
|
|
8276
|
+
```js
|
|
8277
|
+
payPalSavePaymentSourceWidget.onError((eventData) => console.log('Some error occurred'));
|
|
8278
|
+
```
|
|
8279
|
+
<a name="PayPalSavePaymentSourceWidget+onCancel" id="PayPalSavePaymentSourceWidget+onCancel" href="#PayPalSavePaymentSourceWidget+onCancel"> </a>
|
|
8280
|
+
|
|
8281
|
+
### payPalSavePaymentSourceWidget.onCancel([callback])
|
|
8282
|
+
If in the process for obtaining the setup token was cancelled, the function passed as parameter will be called.
|
|
8283
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
8284
|
+
|
|
8285
|
+
**Kind**: instance method of [<code>PayPalSavePaymentSourceWidget</code>](#PayPalSavePaymentSourceWidget)
|
|
8286
|
+
|
|
8287
|
+
| Param | Type | Description |
|
|
8288
|
+
| --- | --- | --- |
|
|
8289
|
+
| [callback] | [<code>OnCancelCallback</code>](#OnCancelCallback) | Function to be called when the operation is cancelled. |
|
|
8290
|
+
|
|
8291
|
+
**Example**
|
|
8292
|
+
```js
|
|
8293
|
+
payPalSavePaymentSourceWidget.onCancel(() => console.log('Operation cancelled'));
|
|
8294
|
+
```
|
|
8295
|
+
<a name="OnSuccessCallback" id="OnSuccessCallback" href="#OnSuccessCallback"> </a>
|
|
8296
|
+
|
|
8297
|
+
## OnSuccessCallback : <code>function</code>
|
|
8298
|
+
Callback for onSuccess method.
|
|
8299
|
+
|
|
8300
|
+
**Kind**: global typedef
|
|
8301
|
+
|
|
8302
|
+
| Param | Type |
|
|
8303
|
+
| --- | --- |
|
|
8304
|
+
| data | [<code>IOnSuccessEventData</code>](#IOnSuccessEventData) |
|
|
8305
|
+
|
|
8306
|
+
<a name="OnErrorCallback" id="OnErrorCallback" href="#OnErrorCallback"> </a>
|
|
8307
|
+
|
|
8308
|
+
## OnErrorCallback : <code>function</code>
|
|
8309
|
+
Callback for onError method.
|
|
8310
|
+
|
|
8311
|
+
**Kind**: global typedef
|
|
8312
|
+
|
|
8313
|
+
| Param | Type |
|
|
8314
|
+
| --- | --- |
|
|
8315
|
+
| data | [<code>IOnErrorEventData</code>](#IOnErrorEventData) |
|
|
8316
|
+
|
|
8317
|
+
<a name="OnCancelCallback" id="OnCancelCallback" href="#OnCancelCallback"> </a>
|
|
8318
|
+
|
|
8319
|
+
## OnCancelCallback : <code>function</code>
|
|
8320
|
+
Callback for onCancel method.
|
|
8321
|
+
|
|
8322
|
+
**Kind**: global typedef
|
|
8323
|
+
|
|
8324
|
+
| Param | Type |
|
|
8325
|
+
| --- | --- |
|
|
8326
|
+
| data | [<code>IOnCancelEventData</code>](#IOnCancelEventData) |
|
|
8327
|
+
|
|
8328
|
+
|
|
8329
|
+
## PayPalDataCollector Widget
|
|
8330
|
+
|
|
8331
|
+
Widget that collect browser-based data to help reduce fraud. Upon checkout, these data elements are sent directly to PayPal Risk Services for fraud and risk assessment.
|
|
8332
|
+
|
|
8333
|
+
The general flow to use the widgets is:
|
|
8334
|
+
1. Initialize the PayPal Data Collector Widget, providing a Source Website Identifier (Flow ID), plus optional config parameters for the widget. The general format is:
|
|
8335
|
+
```js
|
|
8336
|
+
vat paypalDataCollector = new paydock.PayPalDataCollector(
|
|
8337
|
+
sourceWebsiteIdentifier,
|
|
8338
|
+
widgetConfigParams,
|
|
8339
|
+
);
|
|
8340
|
+
```
|
|
8341
|
+
2. Handle the `collectDeviceData` function, that will return the generated correlation ID, like following:
|
|
8342
|
+
```js
|
|
8343
|
+
const collectedDeviceData = await paypalDataCollector.collectDeviceData();
|
|
8344
|
+
const correlationId = collectedDeviceData.correlation_id;
|
|
8345
|
+
```
|
|
8346
|
+
3. Use freely the correlation_id value as is needed.
|
|
8347
|
+
4. Handle the `onError` callback.
|
|
8348
|
+
5. If you are using Content Security Policy (CSP), you must allowlist the paypal fraudnet script URL: `https://c.paypal.com`. See reference [here](https://developer.paypal.com/limited-release/fraudnet/integrate/#link-contentsecuritypolicyintegration).
|
|
8349
|
+
|
|
8350
|
+
### PayPalDataCollector Widget example
|
|
8351
|
+
|
|
8352
|
+
A full description of the config parameters for [PayPalDataCollector](#PayPalDataCollector) meta parameters can be found [here](#PayPalDataCollectorConfig). Below you will find a fully working html example.
|
|
8353
|
+
|
|
8354
|
+
```html
|
|
8355
|
+
<!DOCTYPE html>
|
|
8356
|
+
<html lang="en">
|
|
8357
|
+
<head>
|
|
8358
|
+
<meta charset="UTF-8">
|
|
8359
|
+
<title>Title</title>
|
|
8360
|
+
</head>
|
|
8361
|
+
<body>
|
|
8362
|
+
<h2>Using PayDock PayPalDataCollector Widget!</h2>
|
|
8363
|
+
<div id="widget"></div>
|
|
8364
|
+
</body>
|
|
8365
|
+
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
8366
|
+
<script>
|
|
8367
|
+
let payPalDataCollector = new paydock.PayPalDataCollector(
|
|
8368
|
+
sourceWebsiteIdentifier,
|
|
8369
|
+
{
|
|
8370
|
+
mouse_movement: true
|
|
8371
|
+
}
|
|
8372
|
+
);
|
|
8373
|
+
|
|
8374
|
+
payPalDataCollector.setEnv('test');
|
|
8375
|
+
|
|
8376
|
+
payPalDataCollector.onError(function(error) {
|
|
8377
|
+
console.log("On Error Callback", error);
|
|
8378
|
+
});
|
|
8379
|
+
|
|
8380
|
+
const collectedDeviceData = await payPalDataCollector.collectDeviceData();
|
|
8381
|
+
|
|
8382
|
+
//Here when the promise is resolved, it should be able to see the correlation_id.
|
|
8383
|
+
const correlationId = collectedDeviceData.correlation_id
|
|
8384
|
+
</script>
|
|
8385
|
+
</html>
|
|
8386
|
+
```
|
|
8387
|
+
|
|
8388
|
+
## Classes
|
|
8389
|
+
|
|
8390
|
+
<dl>
|
|
8391
|
+
<dt><a href="#PayPalDataCollector">PayPalDataCollector</a></dt>
|
|
8392
|
+
<dd><p>PayPal Data Collector Widget constructor</p>
|
|
8393
|
+
</dd>
|
|
8394
|
+
</dl>
|
|
8395
|
+
|
|
8396
|
+
## Typedefs
|
|
8397
|
+
|
|
8398
|
+
<dl>
|
|
8399
|
+
<dt><a href="#OnErrorCallback">OnErrorCallback</a> : <code>function</code></dt>
|
|
8400
|
+
<dd><p>Callback for onError method.</p>
|
|
8401
|
+
</dd>
|
|
8402
|
+
</dl>
|
|
8403
|
+
|
|
8404
|
+
## Interfaces
|
|
8405
|
+
|
|
8406
|
+
<dl>
|
|
8407
|
+
<dt><a href="#PayPalDataCollectorConfig">PayPalDataCollectorConfig</a> : <code>object</code></dt>
|
|
8408
|
+
<dd><p>Interface of data used for PayPal configuration. For further information refer to <a href="https://developer.paypal.com/sdk/js/reference/#style">the documentation</a>.</p>
|
|
8409
|
+
</dd>
|
|
8410
|
+
<dt><a href="#CollectedDeviceData">CollectedDeviceData</a> : <code>object</code></dt>
|
|
8411
|
+
<dd><p>Data object with the corresponding <code>correlation_id</code>.</p>
|
|
8412
|
+
</dd>
|
|
8413
|
+
<dt><a href="#IOnErrorEventData">IOnErrorEventData</a> : <code>object</code></dt>
|
|
8414
|
+
<dd><p>Interface for IOnErrorEventData</p>
|
|
8415
|
+
</dd>
|
|
8416
|
+
</dl>
|
|
8417
|
+
|
|
8418
|
+
<a name="PayPalDataCollectorConfig" id="PayPalDataCollectorConfig" href="#PayPalDataCollectorConfig"> </a>
|
|
8419
|
+
|
|
8420
|
+
## PayPalDataCollectorConfig : <code>object</code>
|
|
8421
|
+
Interface of data used for PayPal configuration. For further information refer to [the documentation](https://developer.paypal.com/sdk/js/reference/#style).
|
|
8422
|
+
|
|
8423
|
+
**Kind**: global interface
|
|
8424
|
+
|
|
8425
|
+
| Param | Type | Description |
|
|
8426
|
+
| --- | --- | --- |
|
|
8427
|
+
| [mouse_movement] | <code>boolean</code> | Used for indicating if is enabled mouse movement collection. |
|
|
8428
|
+
|
|
8429
|
+
<a name="CollectedDeviceData" id="CollectedDeviceData" href="#CollectedDeviceData"> </a>
|
|
8430
|
+
|
|
8431
|
+
## CollectedDeviceData : <code>object</code>
|
|
8432
|
+
Data object with the corresponding `correlation_id`.
|
|
8433
|
+
|
|
8434
|
+
**Kind**: global interface
|
|
8435
|
+
|
|
8436
|
+
| Param | Type | Description |
|
|
8437
|
+
| --- | --- | --- |
|
|
8438
|
+
| [correlation_id] | <code>string</code> | The correlation ID that was used on the subsecuent requests. |
|
|
8439
|
+
|
|
8440
|
+
<a name="IOnErrorEventData" id="IOnErrorEventData" href="#IOnErrorEventData"> </a>
|
|
8441
|
+
|
|
8442
|
+
## IOnErrorEventData : <code>object</code>
|
|
8443
|
+
Interface for IOnErrorEventData
|
|
8444
|
+
|
|
8445
|
+
**Kind**: global interface
|
|
8446
|
+
|
|
8447
|
+
| Param | Type | Description |
|
|
8448
|
+
| --- | --- | --- |
|
|
8449
|
+
| error_code | <code>string</code> | Error code. One of 'promise_not_enabled' or 'script_error'. |
|
|
8450
|
+
|
|
8451
|
+
<a name="PayPalDataCollector" id="PayPalDataCollector" href="#PayPalDataCollector"> </a>
|
|
8452
|
+
|
|
8453
|
+
## PayPalDataCollector
|
|
8454
|
+
PayPal Data Collector Widget constructor
|
|
8455
|
+
|
|
8456
|
+
**Kind**: global class
|
|
8457
|
+
|
|
8458
|
+
* [PayPalDataCollector](#PayPalDataCollector)
|
|
8459
|
+
* [new PayPalDataCollector(flowId, config)](#new_PayPalDataCollector_new)
|
|
8460
|
+
* [.collectDeviceData()](#PayPalDataCollector+collectDeviceData) ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8461
|
+
* [.onError([callback])](#PayPalDataCollector+onError)
|
|
8462
|
+
* [.setEnv(env)](#PayPalDataCollector+setEnv)
|
|
8463
|
+
|
|
8464
|
+
<a name="new_PayPalDataCollector_new" id="new_PayPalDataCollector_new" href="#new_PayPalDataCollector_new"> </a>
|
|
8465
|
+
|
|
8466
|
+
### new PayPalDataCollector(flowId, config)
|
|
8467
|
+
|
|
8468
|
+
| Param | Type | Description |
|
|
8469
|
+
| --- | --- | --- |
|
|
8470
|
+
| flowId | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
8471
|
+
| config | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
8472
|
+
|
|
8473
|
+
**Example**
|
|
8474
|
+
```js
|
|
8475
|
+
var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
8476
|
+
```
|
|
8477
|
+
<a name="PayPalDataCollector+collectDeviceData" id="PayPalDataCollector+collectDeviceData" href="#PayPalDataCollector+collectDeviceData"> </a>
|
|
8478
|
+
|
|
8479
|
+
### payPalDataCollector.collectDeviceData() ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8480
|
+
After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
8481
|
+
the correlation id used among the requests.
|
|
8482
|
+
|
|
8483
|
+
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
8484
|
+
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved, returnsa an object
|
|
8485
|
+
that contains the `correlation_id` key.
|
|
8486
|
+
**Example**
|
|
8487
|
+
```js
|
|
8488
|
+
const collectedDeviceData = await payPalDataCollectorWidget.collectDeviceData();
|
|
8489
|
+
console.log(collectedDeviceData.correlation_id)
|
|
8490
|
+
```
|
|
8491
|
+
<a name="PayPalDataCollector+onError" id="PayPalDataCollector+onError" href="#PayPalDataCollector+onError"> </a>
|
|
8492
|
+
|
|
8493
|
+
### payPalDataCollector.onError([callback])
|
|
8494
|
+
If the process fails, the function passed as parameter will be called.
|
|
8495
|
+
Important: Do not perform thread blocking operations in callback such as window.alert() calls.
|
|
8496
|
+
|
|
8497
|
+
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
8498
|
+
|
|
8499
|
+
| Param | Type | Description |
|
|
8500
|
+
| --- | --- | --- |
|
|
8501
|
+
| [callback] | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when there is an error in the flow. |
|
|
8502
|
+
|
|
8503
|
+
**Example**
|
|
8504
|
+
```js
|
|
8505
|
+
PayPalDataCollector.onError((eventData) => console.log('Some error occur'));
|
|
8506
|
+
```
|
|
8507
|
+
<a name="PayPalDataCollector+setEnv" id="PayPalDataCollector+setEnv" href="#PayPalDataCollector+setEnv"> </a>
|
|
8508
|
+
|
|
8509
|
+
### payPalDataCollector.setEnv(env)
|
|
8510
|
+
Current method can change environment. By default environment = test.
|
|
8511
|
+
This method does not affect Paydock's API calls or environments, is only for PayPal Data Collector
|
|
8512
|
+
script, in order to know if the script is injected on a live server or is a testing
|
|
8513
|
+
environment. The available values are `test` and `live`. This should match with the used
|
|
8514
|
+
`gateway.mode` in Paydock to process the transaction.
|
|
8515
|
+
|
|
8516
|
+
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
8517
|
+
|
|
8518
|
+
| Param | Type | Description |
|
|
8519
|
+
| --- | --- | --- |
|
|
8520
|
+
| env | <code>string</code> | test, live |
|
|
8521
|
+
|
|
8522
|
+
**Example**
|
|
8523
|
+
```js
|
|
8524
|
+
PayPalDataCollector.setEnv('live');
|
|
8525
|
+
```
|
|
8526
|
+
<a name="OnErrorCallback" id="OnErrorCallback" href="#OnErrorCallback"> </a>
|
|
8527
|
+
|
|
8528
|
+
## OnErrorCallback : <code>function</code>
|
|
8529
|
+
Callback for onError method.
|
|
8530
|
+
|
|
8531
|
+
**Kind**: global typedef
|
|
8532
|
+
|
|
8533
|
+
| Param | Type |
|
|
8534
|
+
| --- | --- |
|
|
8535
|
+
| data | [<code>IOnErrorEventData</code>](#IOnErrorEventData) \| <code>null</code> |
|
|
6948
8536
|
|
|
6949
8537
|
|
|
6950
8538
|
## License
|