@paydock/client-sdk 0.1.0 → 0.1.2-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.
Files changed (537) hide show
  1. package/README.md +9050 -52
  2. package/bundles/index.cjs +38558 -0
  3. package/bundles/index.cjs.d.ts +4777 -0
  4. package/bundles/index.mjs +38519 -0
  5. package/bundles/index.mjs.d.ts +4777 -0
  6. package/bundles/types/api/api-base.d.ts +54 -0
  7. package/bundles/types/api/api-base.d.ts.map +1 -0
  8. package/bundles/types/api/api-charge-internal.d.ts +99 -0
  9. package/bundles/types/api/api-charge-internal.d.ts.map +1 -0
  10. package/bundles/types/api/api-charge.d.ts +36 -0
  11. package/bundles/types/api/api-charge.d.ts.map +1 -0
  12. package/bundles/types/api/api-checkout-internal.d.ts +58 -0
  13. package/bundles/types/api/api-checkout-internal.d.ts.map +1 -0
  14. package/bundles/types/api/api-gateway-internal.d.ts +12 -0
  15. package/bundles/types/api/api-gateway-internal.d.ts.map +1 -0
  16. package/bundles/types/api/api-internal.d.ts +13 -0
  17. package/bundles/types/api/api-internal.d.ts.map +1 -0
  18. package/bundles/types/api/api-service-internal.d.ts +19 -0
  19. package/bundles/types/api/api-service-internal.d.ts.map +1 -0
  20. package/bundles/types/api/api.d.ts +55 -0
  21. package/bundles/types/api/api.d.ts.map +1 -0
  22. package/bundles/types/api/index.d.ts +2 -0
  23. package/bundles/types/api/index.d.ts.map +1 -0
  24. package/bundles/types/canvas-3ds/canvas-3ds.d.ts +109 -0
  25. package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -0
  26. package/bundles/types/canvas-3ds/index.d.ts +2 -0
  27. package/bundles/types/canvas-3ds/index.d.ts.map +1 -0
  28. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +43 -0
  29. package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -0
  30. package/bundles/types/canvas-3ds/services/index.d.ts +2 -0
  31. package/bundles/types/canvas-3ds/services/index.d.ts.map +1 -0
  32. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +22 -0
  33. package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -0
  34. package/bundles/types/checkout/checkout.d.ts +107 -0
  35. package/bundles/types/checkout/checkout.d.ts.map +1 -0
  36. package/bundles/types/checkout/helpers/instruction-handler.d.ts +25 -0
  37. package/bundles/types/checkout/helpers/instruction-handler.d.ts.map +1 -0
  38. package/bundles/types/checkout/helpers/instruction-module.d.ts +6 -0
  39. package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -0
  40. package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts +6 -0
  41. package/bundles/types/checkout/helpers/instruction-module.decorator.d.ts.map +1 -0
  42. package/bundles/types/checkout/helpers/instruction.decorator.d.ts +5 -0
  43. package/bundles/types/checkout/helpers/instruction.decorator.d.ts.map +1 -0
  44. package/bundles/types/checkout/helpers/resource-helper.d.ts +6 -0
  45. package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -0
  46. package/bundles/types/checkout/helpers/session-helper.d.ts +8 -0
  47. package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -0
  48. package/bundles/types/checkout/index.d.ts +2 -0
  49. package/bundles/types/checkout/index.d.ts.map +1 -0
  50. package/bundles/types/checkout/instructions/index.d.ts +3 -0
  51. package/bundles/types/checkout/instructions/index.d.ts.map +1 -0
  52. package/bundles/types/checkout/instructions/v1/index.d.ts +4 -0
  53. package/bundles/types/checkout/instructions/v1/index.d.ts.map +1 -0
  54. package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts +20 -0
  55. package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -0
  56. package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts +14 -0
  57. package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts.map +1 -0
  58. package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts +18 -0
  59. package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +1 -0
  60. package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts +15 -0
  61. package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts.map +1 -0
  62. package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts +11 -0
  63. package/bundles/types/checkout/instructions/v1/instruction.canvas_3ds.show.d.ts.map +1 -0
  64. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts +19 -0
  65. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -0
  66. package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts +20 -0
  67. package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts.map +1 -0
  68. package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts +21 -0
  69. package/bundles/types/checkout/instructions/v1/instruction.fraud_service.show.d.ts.map +1 -0
  70. package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts +26 -0
  71. package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +1 -0
  72. package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts +18 -0
  73. package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +1 -0
  74. package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts +18 -0
  75. package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts.map +1 -0
  76. package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts +18 -0
  77. package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -0
  78. package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts +21 -0
  79. package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +1 -0
  80. package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts +19 -0
  81. package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -0
  82. package/bundles/types/checkout/layout-widgets/additionals.d.ts +3 -0
  83. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -0
  84. package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts +9 -0
  85. package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts.map +1 -0
  86. package/bundles/types/checkout/layout-widgets/message.d.ts +34 -0
  87. package/bundles/types/checkout/layout-widgets/message.d.ts.map +1 -0
  88. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts +13 -0
  89. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -0
  90. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +55 -0
  91. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -0
  92. package/bundles/types/checkout/layout-widgets/payment-template.d.ts +3 -0
  93. package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -0
  94. package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts +36 -0
  95. package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts.map +1 -0
  96. package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts +13 -0
  97. package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +1 -0
  98. package/bundles/types/checkout-button/checkout-button.d.ts +139 -0
  99. package/bundles/types/checkout-button/checkout-button.d.ts.map +1 -0
  100. package/bundles/types/checkout-button/checkout-button.interface.d.ts +49 -0
  101. package/bundles/types/checkout-button/checkout-button.interface.d.ts.map +1 -0
  102. package/bundles/types/checkout-button/checkout-contextual-handler.d.ts +27 -0
  103. package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +1 -0
  104. package/bundles/types/checkout-button/index.d.ts +85 -0
  105. package/bundles/types/checkout-button/index.d.ts.map +1 -0
  106. package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts +21 -0
  107. package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts.map +1 -0
  108. package/bundles/types/checkout-button/paypal/paypal.runner.d.ts +6 -0
  109. package/bundles/types/checkout-button/paypal/paypal.runner.d.ts.map +1 -0
  110. package/bundles/types/checkout-button/runner/base.runner.d.ts +18 -0
  111. package/bundles/types/checkout-button/runner/base.runner.d.ts.map +1 -0
  112. package/bundles/types/checkout-button/runner/contextual.runner.d.ts +39 -0
  113. package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +1 -0
  114. package/bundles/types/checkout-button/runner/index.d.ts +9 -0
  115. package/bundles/types/checkout-button/runner/index.d.ts.map +1 -0
  116. package/bundles/types/checkout-button/runner/popup.runner.d.ts +35 -0
  117. package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +1 -0
  118. package/bundles/types/checkout-button/runner/redirect.runner.d.ts +17 -0
  119. package/bundles/types/checkout-button/runner/redirect.runner.d.ts.map +1 -0
  120. package/bundles/types/checkout-button/zipmoney/index.d.ts +4 -0
  121. package/bundles/types/checkout-button/zipmoney/index.d.ts.map +1 -0
  122. package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +49 -0
  123. package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts.map +1 -0
  124. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +39 -0
  125. package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -0
  126. package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts +26 -0
  127. package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts.map +1 -0
  128. package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts +4 -0
  129. package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts.map +1 -0
  130. package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts +10 -0
  131. package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts.map +1 -0
  132. package/bundles/types/checkout-button/zipmoney/zipmoney.types.d.ts +12 -0
  133. package/bundles/types/checkout-button/zipmoney/zipmoney.types.d.ts.map +1 -0
  134. package/bundles/types/components/ability-guard.d.ts +12 -0
  135. package/bundles/types/components/ability-guard.d.ts.map +1 -0
  136. package/bundles/types/components/background.d.ts +43 -0
  137. package/bundles/types/components/background.d.ts.map +1 -0
  138. package/bundles/types/components/container.d.ts +12 -0
  139. package/bundles/types/components/container.d.ts.map +1 -0
  140. package/bundles/types/components/dispatcher.d.ts +14 -0
  141. package/bundles/types/components/dispatcher.d.ts.map +1 -0
  142. package/bundles/types/components/element-style.d.ts +17 -0
  143. package/bundles/types/components/element-style.d.ts.map +1 -0
  144. package/bundles/types/components/flypay-iframe-event.d.ts +15 -0
  145. package/bundles/types/components/flypay-iframe-event.d.ts.map +1 -0
  146. package/{lib/widget/components/form-Interceptor.d.ts → bundles/types/components/form-interceptor.d.ts} +2 -1
  147. package/bundles/types/components/form-interceptor.d.ts.map +1 -0
  148. package/bundles/types/components/http-core.d.ts +14 -0
  149. package/bundles/types/components/http-core.d.ts.map +1 -0
  150. package/bundles/types/components/iframe-event.d.ts +72 -0
  151. package/bundles/types/components/iframe-event.d.ts.map +1 -0
  152. package/bundles/types/components/iframe.d.ts +20 -0
  153. package/bundles/types/components/iframe.d.ts.map +1 -0
  154. package/bundles/types/components/link.d.ts +27 -0
  155. package/bundles/types/components/link.d.ts.map +1 -0
  156. package/bundles/types/components/loader.d.ts +5 -0
  157. package/bundles/types/components/loader.d.ts.map +1 -0
  158. package/bundles/types/components/param.d.ts +430 -0
  159. package/bundles/types/components/param.d.ts.map +1 -0
  160. package/bundles/types/components/popup.d.ts +30 -0
  161. package/bundles/types/components/popup.d.ts.map +1 -0
  162. package/bundles/types/components/storage-dispatcher.d.ts +31 -0
  163. package/bundles/types/components/storage-dispatcher.d.ts.map +1 -0
  164. package/bundles/types/components/trigger.d.ts +48 -0
  165. package/bundles/types/components/trigger.d.ts.map +1 -0
  166. package/bundles/types/components/vault-display-iframe-event.d.ts +5 -0
  167. package/bundles/types/components/vault-display-iframe-event.d.ts.map +1 -0
  168. package/bundles/types/components/wallet-background.d.ts +13 -0
  169. package/bundles/types/components/wallet-background.d.ts.map +1 -0
  170. package/bundles/types/components/wallet-trigger.d.ts +19 -0
  171. package/bundles/types/components/wallet-trigger.d.ts.map +1 -0
  172. package/bundles/types/configs/env/environment.cba.d.ts +30 -0
  173. package/bundles/types/configs/env/environment.cba.d.ts.map +1 -0
  174. package/bundles/types/configs/env/environment.interface.d.ts +12 -0
  175. package/bundles/types/configs/env/environment.interface.d.ts.map +1 -0
  176. package/bundles/types/configs/env/environment.paydock.d.ts +49 -0
  177. package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -0
  178. package/bundles/types/configs/env/index.d.ts +3 -0
  179. package/bundles/types/configs/env/index.d.ts.map +1 -0
  180. package/bundles/types/configs/sdk.d.ts +10 -0
  181. package/bundles/types/configs/sdk.d.ts.map +1 -0
  182. package/bundles/types/constants/validators.d.ts +45 -0
  183. package/bundles/types/constants/validators.d.ts.map +1 -0
  184. package/bundles/types/external-checkout/builder.d.ts +29 -0
  185. package/bundles/types/external-checkout/builder.d.ts.map +1 -0
  186. package/bundles/types/external-checkout/checker.d.ts +14 -0
  187. package/bundles/types/external-checkout/checker.d.ts.map +1 -0
  188. package/bundles/types/external-checkout/index.d.ts +3 -0
  189. package/bundles/types/external-checkout/index.d.ts.map +1 -0
  190. package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts +9 -0
  191. package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts.map +1 -0
  192. package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts +42 -0
  193. package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts.map +1 -0
  194. package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +163 -0
  195. package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
  196. package/bundles/types/fraud-prevention/index.d.ts +3 -0
  197. package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
  198. package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +79 -0
  199. package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
  200. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts +2 -0
  201. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +1 -0
  202. package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts +20 -0
  203. package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts.map +1 -0
  204. package/bundles/types/helper/access-token.d.ts +26 -0
  205. package/bundles/types/helper/access-token.d.ts.map +1 -0
  206. package/bundles/types/helper/browser.d.ts +17 -0
  207. package/bundles/types/helper/browser.d.ts.map +1 -0
  208. package/bundles/types/helper/deep-clone.d.ts +13 -0
  209. package/bundles/types/helper/deep-clone.d.ts.map +1 -0
  210. package/bundles/types/helper/element-id.d.ts +5 -0
  211. package/bundles/types/helper/element-id.d.ts.map +1 -0
  212. package/bundles/types/helper/event-emitter.d.ts +7 -0
  213. package/bundles/types/helper/event-emitter.d.ts.map +1 -0
  214. package/bundles/types/helper/event-error.d.ts +55 -0
  215. package/bundles/types/helper/event-error.d.ts.map +1 -0
  216. package/bundles/types/helper/event.d.ts +10 -0
  217. package/bundles/types/helper/event.d.ts.map +1 -0
  218. package/bundles/types/helper/ms.d.ts +6 -0
  219. package/bundles/types/helper/ms.d.ts.map +1 -0
  220. package/{lib/widget → bundles/types}/helper/object.d.ts +1 -0
  221. package/bundles/types/helper/object.d.ts.map +1 -0
  222. package/bundles/types/helper/process-event-error.d.ts +9 -0
  223. package/bundles/types/helper/process-event-error.d.ts.map +1 -0
  224. package/bundles/types/helper/spiner.util.d.ts +6 -0
  225. package/bundles/types/helper/spiner.util.d.ts.map +1 -0
  226. package/bundles/types/helper/url.d.ts +5 -0
  227. package/bundles/types/helper/url.d.ts.map +1 -0
  228. package/bundles/types/helper/uuid.d.ts +6 -0
  229. package/bundles/types/helper/uuid.d.ts.map +1 -0
  230. package/bundles/types/index-cba.d.ts +52 -0
  231. package/bundles/types/index-cba.d.ts.map +1 -0
  232. package/bundles/types/index.d.ts +52 -0
  233. package/bundles/types/index.d.ts.map +1 -0
  234. package/bundles/types/payment-source/builder.d.ts +23 -0
  235. package/bundles/types/payment-source/builder.d.ts.map +1 -0
  236. package/bundles/types/payment-source/index.d.ts +2 -0
  237. package/bundles/types/payment-source/index.d.ts.map +1 -0
  238. package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts +181 -0
  239. package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts.map +1 -0
  240. package/bundles/types/payment-source-widget/index.d.ts +35 -0
  241. package/bundles/types/payment-source-widget/index.d.ts.map +1 -0
  242. package/bundles/types/payment-source-widget/interfaces.d.ts +12 -0
  243. package/bundles/types/payment-source-widget/interfaces.d.ts.map +1 -0
  244. package/bundles/types/payment-source-widget/payment-source-widget.d.ts +93 -0
  245. package/bundles/types/payment-source-widget/payment-source-widget.d.ts.map +1 -0
  246. package/bundles/types/paypal-data-collector/index.d.ts +23 -0
  247. package/bundles/types/paypal-data-collector/index.d.ts.map +1 -0
  248. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +58 -0
  249. package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts.map +1 -0
  250. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts +21 -0
  251. package/bundles/types/paypal-data-collector/paypal-data-collector.interfaces.d.ts.map +1 -0
  252. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts +17 -0
  253. package/bundles/types/paypal-data-collector/paypal-data-collector.service.d.ts.map +1 -0
  254. package/bundles/types/paypal-save-payment-source/index.d.ts +61 -0
  255. package/bundles/types/paypal-save-payment-source/index.d.ts.map +1 -0
  256. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts +85 -0
  257. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.d.ts.map +1 -0
  258. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +83 -0
  259. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -0
  260. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +35 -0
  261. package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -0
  262. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +31 -0
  263. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -0
  264. package/bundles/types/secure-remote-commerce/index.d.ts +105 -0
  265. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -0
  266. package/bundles/types/secure-remote-commerce/interfaces.d.ts +156 -0
  267. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -0
  268. package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts +2 -0
  269. package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts.map +1 -0
  270. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +25 -0
  271. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -0
  272. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +11 -0
  273. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -0
  274. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts +86 -0
  275. package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -0
  276. package/bundles/types/shared/device/device-info.service.d.ts +13 -0
  277. package/bundles/types/shared/device/device-info.service.d.ts.map +1 -0
  278. package/bundles/types/shared/http/authorization-strategy.d.ts +41 -0
  279. package/bundles/types/shared/http/authorization-strategy.d.ts.map +1 -0
  280. package/bundles/types/shared/http/http-fetcher.d.ts +29 -0
  281. package/bundles/types/shared/http/http-fetcher.d.ts.map +1 -0
  282. package/bundles/types/shared/http/http-fetcher.factory.d.ts +17 -0
  283. package/bundles/types/shared/http/http-fetcher.factory.d.ts.map +1 -0
  284. package/bundles/types/shared/http/http-request.d.ts +14 -0
  285. package/bundles/types/shared/http/http-request.d.ts.map +1 -0
  286. package/bundles/types/shared/http/http-response.dto.d.ts +19 -0
  287. package/bundles/types/shared/http/http-response.dto.d.ts.map +1 -0
  288. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
  289. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
  290. package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
  291. package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
  292. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts +15 -0
  293. package/bundles/types/shared/services/instrumentation/instrumentation.agent.d.ts.map +1 -0
  294. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts +66 -0
  295. package/bundles/types/shared/services/instrumentation/instrumentation.config.d.ts.map +1 -0
  296. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +14 -0
  297. package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -0
  298. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts +15 -0
  299. package/bundles/types/shared/services/instrumentation/repositories/action.repository.d.ts.map +1 -0
  300. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts +23 -0
  301. package/bundles/types/shared/services/instrumentation/repositories/error.repository.d.ts.map +1 -0
  302. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts +15 -0
  303. package/bundles/types/shared/services/instrumentation/repositories/event.repository.d.ts.map +1 -0
  304. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts +4 -0
  305. package/bundles/types/shared/services/instrumentation/repositories/index.d.ts.map +1 -0
  306. package/bundles/types/shared/shared.constants.d.ts +6 -0
  307. package/bundles/types/shared/shared.constants.d.ts.map +1 -0
  308. package/bundles/types/vault-display-widget/index.d.ts +14 -0
  309. package/bundles/types/vault-display-widget/index.d.ts.map +1 -0
  310. package/bundles/types/vault-display-widget/vault-display-widget.d.ts +69 -0
  311. package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -0
  312. package/bundles/types/wallet-buttons/enums.d.ts +12 -0
  313. package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
  314. package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts +6 -0
  315. package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts.map +1 -0
  316. package/bundles/types/wallet-buttons/index-cba.d.ts +2 -0
  317. package/bundles/types/wallet-buttons/index-cba.d.ts.map +1 -0
  318. package/bundles/types/wallet-buttons/index.d.ts +138 -0
  319. package/bundles/types/wallet-buttons/index.d.ts.map +1 -0
  320. package/bundles/types/wallet-buttons/interfaces.d.ts +128 -0
  321. package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -0
  322. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +321 -0
  323. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -0
  324. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +330 -0
  325. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -0
  326. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +24 -0
  327. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
  328. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +49 -0
  329. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
  330. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts +28 -0
  331. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
  332. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts +26 -0
  333. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
  334. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts +35 -0
  335. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -0
  336. package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts +8 -0
  337. package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts.map +1 -0
  338. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts +26 -0
  339. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
  340. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts +19 -0
  341. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
  342. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +131 -0
  343. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -0
  344. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +252 -0
  345. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -0
  346. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +12 -0
  347. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
  348. package/bundles/types/wallet-buttons-express/index.d.ts +245 -0
  349. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -0
  350. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts +6 -0
  351. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts.map +1 -0
  352. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts +6 -0
  353. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts.map +1 -0
  354. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +5 -0
  355. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
  356. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +44 -0
  357. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -0
  358. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +6 -0
  359. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -0
  360. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +6 -0
  361. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -0
  362. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +6 -0
  363. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -0
  364. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +9 -0
  365. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -0
  366. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +6 -0
  367. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -0
  368. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +11 -0
  369. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -0
  370. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts +21 -0
  371. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -0
  372. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts +9 -0
  373. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -0
  374. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts +13 -0
  375. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -0
  376. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts +9 -0
  377. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-response.interface.d.ts.map +1 -0
  378. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +6 -0
  379. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -0
  380. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +22 -0
  381. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -0
  382. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +58 -0
  383. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -0
  384. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +2 -0
  385. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -0
  386. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts +5 -0
  387. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-events.constant.d.ts.map +1 -0
  388. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts +6 -0
  389. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts.map +1 -0
  390. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +22 -0
  391. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -0
  392. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts +2 -0
  393. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts.map +1 -0
  394. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts +2 -0
  395. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts.map +1 -0
  396. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts +5 -0
  397. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-contact-editing-mode.type.d.ts.map +1 -0
  398. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts +21 -0
  399. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -0
  400. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts +21 -0
  401. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -0
  402. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts +4 -0
  403. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts.map +1 -0
  404. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts +164 -0
  405. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-sdk.interface.d.ts.map +1 -0
  406. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +32 -0
  407. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -0
  408. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +53 -0
  409. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
  410. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +6 -0
  411. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -0
  412. package/bundles/types/widget/configuration.d.ts +165 -0
  413. package/bundles/types/widget/configuration.d.ts.map +1 -0
  414. package/bundles/types/widget/html-multi-widget.d.ts +337 -0
  415. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -0
  416. package/bundles/types/widget/html-widget.d.ts +107 -0
  417. package/bundles/types/widget/html-widget.d.ts.map +1 -0
  418. package/bundles/types/widget/index.d.ts +132 -0
  419. package/bundles/types/widget/index.d.ts.map +1 -0
  420. package/bundles/types/widget/meta.d.ts +8 -0
  421. package/bundles/types/widget/meta.d.ts.map +1 -0
  422. package/bundles/types/widget/multi-widget.d.ts +241 -0
  423. package/bundles/types/widget/multi-widget.d.ts.map +1 -0
  424. package/bundles/types/widget/style.d.ts +177 -0
  425. package/bundles/types/widget/style.d.ts.map +1 -0
  426. package/bundles/widget.umd.js +38429 -767
  427. package/bundles/widget.umd.js.d.ts +4777 -0
  428. package/bundles/widget.umd.js.min.d.ts +4777 -0
  429. package/bundles/widget.umd.min.js +1 -0
  430. package/docs/api-canvas3ds.md +158 -0
  431. package/docs/api-checkout-button.md +912 -0
  432. package/docs/api-examples.md +65 -0
  433. package/docs/api-ps-widget.md +585 -0
  434. package/docs/api-vault-display.md +94 -0
  435. package/docs/api-widget.md +2542 -0
  436. package/docs/api-wrapper.md +45 -0
  437. package/docs/canvas3ds-examples.md +242 -0
  438. package/docs/cba-header.md +13 -0
  439. package/docs/cba-license.md +2 -0
  440. package/docs/checkout-examples.md +248 -0
  441. package/docs/click-to-pay-examples.md +231 -0
  442. package/docs/click-to-pay.md +337 -0
  443. package/docs/fraud-prevention-examples.md +154 -0
  444. package/docs/fraud-prevention.md +0 -0
  445. package/docs/header.md +15 -0
  446. package/docs/html/layout.html +79 -0
  447. package/docs/html/marked.js +23 -0
  448. package/docs/html/style.css +365 -0
  449. package/docs/install/npm.content.md +16 -0
  450. package/docs/install/npm.example.md +24 -0
  451. package/docs/install/umd.content.md +20 -0
  452. package/docs/install/umd.example.md +6 -0
  453. package/docs/install.md +43 -0
  454. package/docs/install.readme.t.md +17 -0
  455. package/docs/install.slate.t.md +17 -0
  456. package/docs/license.md +2 -0
  457. package/docs/partials/header.hbs +3 -0
  458. package/docs/paypal-data-collector-examples.md +59 -0
  459. package/docs/paypal-data-collector.md +149 -0
  460. package/docs/paypal-save-payment-source-examples.md +63 -0
  461. package/docs/paypal-save-payment-source.md +256 -0
  462. package/docs/ps-examples.md +129 -0
  463. package/docs/vault-display-example.md +132 -0
  464. package/docs/wallet-buttons-examples.md +638 -0
  465. package/docs/wallet-buttons-express-examples.md +201 -0
  466. package/docs/wallet-buttons-express.md +1076 -0
  467. package/docs/wallet-buttons.md +625 -0
  468. package/docs/wallet-cba-buttons-examples.md +388 -0
  469. package/docs/widget-examples.md +271 -0
  470. package/examples/html-widget/actions.html +47 -0
  471. package/examples/html-widget/events.html +2 -2
  472. package/examples/html-widget/form.html +2 -3
  473. package/examples/html-widget/html-styles.html +29 -0
  474. package/examples/html-widget/insert-input.html +2 -2
  475. package/examples/html-widget/optional-settings.html +30 -0
  476. package/examples/html-widget/simple.html +3 -3
  477. package/examples/html-widget/styles.html +3 -3
  478. package/examples/multi-html-widget/extend.html +7 -2
  479. package/examples/multi-html-widget/simple.html +6 -8
  480. package/package.json +225 -55
  481. package/slate.md +2218 -0
  482. package/.idea/client-sdk-3.iml +0 -12
  483. package/.idea/jsLibraryMappings.xml +0 -7
  484. package/.idea/misc.xml +0 -16
  485. package/.idea/modules.xml +0 -8
  486. package/.idea/vcs.xml +0 -6
  487. package/.idea/workspace.xml +0 -639
  488. package/.npmignore +0 -14
  489. package/lib/index.d.ts +0 -2
  490. package/lib/index.js +0 -3
  491. package/lib/index.js.map +0 -1
  492. package/lib/widget/components/container.d.ts +0 -9
  493. package/lib/widget/components/container.js +0 -18
  494. package/lib/widget/components/container.js.map +0 -1
  495. package/lib/widget/components/env.d.ts +0 -19
  496. package/lib/widget/components/env.js +0 -33
  497. package/lib/widget/components/env.js.map +0 -1
  498. package/lib/widget/components/event.d.ts +0 -26
  499. package/lib/widget/components/event.js +0 -49
  500. package/lib/widget/components/event.js.map +0 -1
  501. package/lib/widget/components/form-Interceptor.js +0 -38
  502. package/lib/widget/components/form-Interceptor.js.map +0 -1
  503. package/lib/widget/components/iframe.d.ts +0 -11
  504. package/lib/widget/components/iframe.js +0 -31
  505. package/lib/widget/components/iframe.js.map +0 -1
  506. package/lib/widget/components/link.d.ts +0 -13
  507. package/lib/widget/components/link.js +0 -37
  508. package/lib/widget/components/link.js.map +0 -1
  509. package/lib/widget/components/param.d.ts +0 -39
  510. package/lib/widget/components/param.js +0 -21
  511. package/lib/widget/components/param.js.map +0 -1
  512. package/lib/widget/components/trigger.d.ts +0 -19
  513. package/lib/widget/components/trigger.js +0 -22
  514. package/lib/widget/components/trigger.js.map +0 -1
  515. package/lib/widget/configuration.d.ts +0 -59
  516. package/lib/widget/configuration.js +0 -134
  517. package/lib/widget/configuration.js.map +0 -1
  518. package/lib/widget/helper/event.d.ts +0 -8
  519. package/lib/widget/helper/event.js +0 -15
  520. package/lib/widget/helper/event.js.map +0 -1
  521. package/lib/widget/helper/object.js +0 -6
  522. package/lib/widget/helper/object.js.map +0 -1
  523. package/lib/widget/helper/url.d.ts +0 -3
  524. package/lib/widget/helper/url.js +0 -8
  525. package/lib/widget/helper/url.js.map +0 -1
  526. package/lib/widget/html-multi-widget.d.ts +0 -56
  527. package/lib/widget/html-multi-widget.js +0 -89
  528. package/lib/widget/html-multi-widget.js.map +0 -1
  529. package/lib/widget/html-widget.d.ts +0 -37
  530. package/lib/widget/html-widget.js +0 -50
  531. package/lib/widget/html-widget.js.map +0 -1
  532. package/lib/widget/index.d.ts +0 -5
  533. package/lib/widget/index.js +0 -6
  534. package/lib/widget/index.js.map +0 -1
  535. package/lib/widget/multi-widget.d.ts +0 -22
  536. package/lib/widget/multi-widget.js +0 -83
  537. package/lib/widget/multi-widget.js.map +0 -1
package/slate.md ADDED
@@ -0,0 +1,2218 @@
1
+ # Client-sdk
2
+
3
+ It is a solution for collecting and handling payment sources in secure way.
4
+
5
+ With SDK you can create a payment form widget as an independent part or insert use inside your form.
6
+
7
+ The SDK supports methods for customization of widget by your needs (styling, form fields, etc)
8
+
9
+ ## Other information
10
+
11
+ To work with the widget you will need public_key or access_token ([see Authentication](https://docs.paydock.com/#authentication))
12
+
13
+ Also you will need added gateway ([see API Reference by gateway](https://docs.paydock.com/#gateways))
14
+
15
+
16
+
17
+ ## Get started
18
+
19
+ The Client SDK ships in JavaScript ES6 (EcmaScript 2015) in three different
20
+ formats (CJS, ESM and UMD) along with respective TypeScript declarations. Below,
21
+ we exemplify how to import each format.
22
+
23
+ ### Download from CDN
24
+
25
+ ```html
26
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
27
+ <script>
28
+ var widget = new paydock.HtmlWidget('#tag', 'publicKey', 'gatewayId');
29
+ </script>
30
+ ```
31
+
32
+
33
+ For browser environments, you can import the Client SDK directly from our CDN to
34
+ your project's HTML. To accomplish this, include the Client SDK in your page
35
+ using one and only of the two script tags below. After this step you will be
36
+ able to access the Client SDK features via the global variable `paydock`.
37
+
38
+ For production we recommend using the compressed version (`.min.js`) since
39
+ it will result in faster loading times for your end users.
40
+
41
+ - *Compressed version for production: `https://widget.paydock.com/sdk/latest/widget.umd.min.js`*
42
+
43
+ - *Full version for development and debug: `https://widget.paydock.com/sdk/latest/widget.umd.js`*
44
+
45
+ You may download the production version of the Client SDK scripts [here][min],
46
+ and, the development version [here][max].
47
+
48
+ [min]: https://widget.paydock.com/sdk/latest/widget.umd.min.js
49
+ [max]: https://widget.paydock.com/sdk/latest/widget.umd.js
50
+
51
+ For more advanced use-cases, the library has [UMD](https://github.com/umdjs/umd)
52
+ format that can be used in RequireJS, Webpack, etc.
53
+
54
+
55
+ ### With package manager
56
+
57
+ ```cjs
58
+ // module import - CommonJS/Node projects ✅
59
+ const paydock = require('@paydock/client-sdk')
60
+ const api = new paydock.Api('publicKey');
61
+ ```
62
+
63
+ ```mjs
64
+ // named import - ESM projects or TypeScript projects ✅
65
+ import { HtmlWidget } from '@paydock/client-sdk'
66
+ const widget = new HtmlWidget('#selector', 'publicKey', 'gatewayId');
67
+ ```
68
+
69
+ ```mjs
70
+ // namespaced import - ESM projects or TypeScript projects ✅
71
+ import * as Paydock from '@paydock/client-sdk'
72
+ const widget = new Paydock.HtmlWidget('#selector', 'publicKey', 'gatewayId');
73
+ ```
74
+
75
+ ```js
76
+ // default import - Not officially supported . They are handled differently by different tools / settings!
77
+
78
+ import paydock from '@paydock/client-sdk'
79
+ >>> "Uncaught SyntaxError: The requested module does not provide an export named 'default'"
80
+ ```
81
+
82
+
83
+ Our NPM package is compatible with all package managers (e.g., `npm`, `yarn`,
84
+ `pnpm`, `bun`). Using `npm` the following command would add the Client SDK as a
85
+ production dependency.
86
+
87
+ ```bash
88
+ npm install @paydock/client-sdk
89
+ ```
90
+
91
+ After installation is complete, if you are developing in NodeJS environments or
92
+ using tools that expect your JavaScript code to be in CJS format (e.g., Jest,
93
+ Karma, RequireJS, Webpack), you can import the Client SDK using CommonJS modules.
94
+ For these environments the UMD format (`@paydock/client-sdk/bundles/widget.umd.js`)
95
+ can also be used as a fallback. Alternatively, in case you are developing in
96
+ projects that have access to modern bundlers such as Vite or others (e.g., SPA
97
+ libs or SSR Metaframeworks), you can import the Client SDK features using ESM
98
+ through named imports or namespaced imports.
99
+
100
+
101
+ ## Widget
102
+
103
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#widget-simple-example)
104
+
105
+ A payment form where it is possible to enter card data/bank accounts and then receive a one-time
106
+ token for charges, subscriptions etc. This form can be customized, you can customize the fields and set styles.
107
+ It is possible in real-time to monitor the actions of user with widget and get information about payment-source using events.
108
+
109
+ ## Widget simple example
110
+
111
+ ### Container
112
+
113
+ ```html
114
+ <div id="widget"></div>
115
+ ```
116
+
117
+ You must create a container for the widget. Inside this tag, the widget will be initialized
118
+
119
+ ### Initialization
120
+
121
+ ```javascript
122
+ var widget = new paydock.HtmlWidget('#widget', 'publicKey');
123
+ widget.load();
124
+ ```
125
+
126
+ ```javascript
127
+ // ES2015 | TypeScript
128
+
129
+ import { HtmlWidget } from '@paydock/client-sdk';
130
+
131
+ var widget = new HtmlWidget('#widget', 'publicKey');
132
+ widget.load();
133
+ ```
134
+
135
+ Then write only need 2 lines of code in js to initialize widget
136
+
137
+ ### Full example
138
+
139
+ ```html
140
+ <!DOCTYPE html>
141
+ <html lang="en">
142
+ <head>
143
+ <meta charset="UTF-8">
144
+ <title>Title</title>
145
+ <style>iframe {border: 0;width: 100%;height: 300px;}</style>
146
+ </head>
147
+ <body>
148
+ <form id="paymentForm">
149
+ <div id="widget"></div>
150
+ <input name="payment_source_token" id="payment_source_token" type="hidden">
151
+ </form>
152
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
153
+ <script>
154
+ var widget = new paydock.HtmlWidget('#widget', 'publicKey');
155
+ widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
156
+ widget.load();
157
+ </script>
158
+ </body>
159
+ </html>
160
+ ```
161
+
162
+ ## Widget advanced example
163
+
164
+ ### Customization
165
+
166
+ ```javascript
167
+ widget.setStyles({
168
+ background_color: 'rgb(0, 0, 0)',
169
+ border_color: 'yellow',
170
+ text_color: '#FFFFAA',
171
+ button_color: 'rgba(255, 255, 255, 0.9)',
172
+ font_size: '20px'
173
+ });
174
+ ```
175
+
176
+ This example shows how you can customize to your needs and design
177
+
178
+ ### Customization from html
179
+
180
+ ```html
181
+ <div id="widget"
182
+ widget-style="text-color: #FFFFAA; border-color: #yellow"
183
+ title="Payment form"
184
+ finish-text="Payment resource was successfully accepted"></div>
185
+ ```
186
+
187
+ This example shows how you can set style and texts from html
188
+
189
+ ### Settings
190
+
191
+ ```javascript
192
+ widget.setRefId('id'); // your unique identifier to identify the data
193
+
194
+ widget.setFormFields(['phone', 'email']); // add additional fields for form of widget
195
+
196
+ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported card types
197
+ ```
198
+
199
+ This example shows how you can use a lot of other methods to settings your form
200
+
201
+ ### Error handling
202
+
203
+ ## Overview
204
+
205
+ Error events are emitted when an error occurs during widget operations. These events provide detailed information about the error, including its category, cause, and contextual details.
206
+
207
+ ## Error Event Structure
208
+
209
+ ### Base Properties
210
+
211
+ | Property | Type | Description |
212
+ |----------|------|-------------|
213
+ | `event` | `string` | Always set to `"error"` |
214
+ | `purpose` | `string` | Indicates the purpose of the action that triggered the error event (e.g., `"payment_source"`) |
215
+ | `message_source` | `string` | Source of the message (e.g., `"widget.paydock"`) |
216
+ | `ref_id` | `string` | Reference ID for the operation |
217
+ | `widget_id` | `string` | Unique identifier of the widget instance |
218
+ | `error` | `object` | Error object containing error information |
219
+
220
+ ### Error Object Properties
221
+
222
+ The `error` object contains detailed information about the error:
223
+
224
+ | Property | Type | Description |
225
+ |----------|------|-------------|
226
+ | `category` | `string` | High-level error classification |
227
+ | `cause` | `string` | Specific error cause |
228
+ | `retryable` | `boolean` | Indicates if the operation can be retried |
229
+ | `details` | `object` | Additional error context |
230
+
231
+ ## Error Categories
232
+
233
+ | Category | Description |
234
+ |----------|-------------|
235
+ | `configuration` | Configuration-related errors |
236
+ | `identity_access_management` | Authentication and authorization errors |
237
+ | `internal` | Internal system errors |
238
+ | `process` | Process and operation errors |
239
+ | `resource` | Resource-related errors |
240
+ | `validation` | Input validation errors |
241
+
242
+ ## Error Causes
243
+
244
+ | Cause | Category | Description |
245
+ |-------|----------|-------------|
246
+ | `aborted` | `process` | Operation was aborted |
247
+ | `access_forbidden` | `identity` | Access to resource is forbidden |
248
+ | `already_exists` | `validation` | Resource already exists |
249
+ | `canceled` | `process` | Operation was canceled |
250
+ | `invalid_configuration` | `configuration` | Invalid widget configuration |
251
+ | `invalid_input` | `validation` | Invalid input provided |
252
+ | `not_found` | `resource` | Requested resource not found |
253
+ | `not_implemented` | `process` | Requested feature not implemented |
254
+ | `rate_limited` | `process` | Too many requests |
255
+ | `server_busy` | `process` | Server is too busy to handle request |
256
+ | `service_unreachable` | `process` | Unable to reach required service |
257
+ | `unauthorized` | `identity` | Authentication required |
258
+ | `unknown_error` | `internal` | Unexpected error occurred |
259
+ | `unprocessable_entity` | `validation` | Valid input but cannot be processed |
260
+
261
+ ## Error Details Object
262
+
263
+ | Property | Type | Description |
264
+ |----------|------|-------------|
265
+ | `cause` | `string` | Matches the top-level error cause |
266
+ | `contextId` | `string` | Context identifier (usually matches widget_id) |
267
+ | `message` | `string` | Human-readable error message |
268
+ | `timestamp` | `string` | ISO 8601 timestamp of when the error occurred |
269
+
270
+ ## Example
271
+
272
+ ```javascript
273
+ widget.hideUiErrors(); // hide default UI errors and handle errors by listening to error events with widget.on('error')
274
+
275
+ widget.on('error', (error) => {
276
+ console.log(error);
277
+ // {
278
+ // "event": "error",
279
+ // "purpose": "payment_source",
280
+ // "message_source": "widget.paydock",
281
+ // "ref_id": "",
282
+ // "widget_id": "d4744f30-dcf5-168e-7f78-c8273a3401d4",
283
+ // "error": {
284
+ // "category": "process",
285
+ // "cause": "service_unreachable",
286
+ // "details": {
287
+ // "cause": "service_unreachable",
288
+ // "contextId": "d4744f30-dcf5-168e-7f78-c8273a3401d4",
289
+ // "message": "The service is not availabe",
290
+ // "timestamp": "2025-02-13T09:30:21.157Z"
291
+ // },
292
+ // "retryable": false
293
+ // }
294
+ // }
295
+ });
296
+ ```
297
+
298
+ ## Handling Errors (Tips)
299
+
300
+ When handling errors, consider:
301
+
302
+ 1. Check the `retryable` flag to determine if the operation can be retried
303
+ 2. Use the `category` for high-level error handling logic
304
+ 3. Use the `cause` for specific error handling cases
305
+ 4. The `contextId` can be used for error tracking and debugging
306
+ 5. The `timestamp` helps with error logging and debugging
307
+
308
+ ### Full example
309
+
310
+ ```html
311
+ <!DOCTYPE html>
312
+ <html lang="en">
313
+ <head>
314
+ <meta charset="UTF-8">
315
+ <title>Title</title>
316
+ <style>iframe {border: 0;width: 100%;height: 400px;}</style>
317
+ </head>
318
+ <body>
319
+ <form id="paymentForm">
320
+ <div id="widget"
321
+ widget-style="text-color: #FFFFAA; border-color: #yellow"
322
+ title="Payment form"
323
+ finish-text="Payment resource was successfully accepted">
324
+ </div>
325
+
326
+ <div
327
+ id="error"
328
+ style="
329
+ display: none;
330
+ max-width: 600px;
331
+ margin: 16px auto;
332
+ padding: 16px 20px;
333
+ border-radius: 8px;
334
+ background-color: #FEF2F2;
335
+ border: 1px solid #FEE2E2;
336
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
337
+ font-family: system-ui, -apple-system, sans-serif;
338
+ color: #991B1B;
339
+ line-height: 1.5;
340
+ font-size: 14px;
341
+ "
342
+ title="error"
343
+ >
344
+ <div style="display: flex; align-items: flex-start; gap: 12px;">
345
+ <div>
346
+ <h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
347
+ <div id="error-message"></div>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ </form>
352
+
353
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
354
+ <script>
355
+ var widget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');
356
+
357
+ widget.setSupportedCardIcons(['mastercard', 'visa']);
358
+ widget.setFormFields(['phone', 'email']);
359
+ widget.setRefId('custom-ref-id');
360
+ widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
361
+
362
+ widget.on('error', ({ error }) => {
363
+ document.getElementById('error-message').textContent = error.details.message;
364
+ document.getElementById('error').style.display = 'block';
365
+ });
366
+ widget.load();
367
+ </script>
368
+
369
+ </body>
370
+ </html>
371
+ ```
372
+
373
+ ## Payment sources widget
374
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#payment-sources-simple-example)
375
+
376
+ This widget provides a list of previously added (saved) payment-sources by customer_id or reference.
377
+ The widget provides an opportunity to use events to track the process of selecting payment-sources and provide meta information about the payment-sources.
378
+
379
+ Payment-source requires a query_token that represents a pre-generated and secure token for limiting the list
380
+ payment-sources, for a specific user or reference.
381
+
382
+ In order to generate this token, you need to send a GET request to [getCustomerList](#get-customer-list-with-parameters)
383
+ where required query parameter must be id or reference. In response you get response.query_token which you can use in the widget.
384
+
385
+ ## Payment sources simple example
386
+
387
+ ### Container
388
+
389
+ ```html
390
+ <div id="list"></div>
391
+ ```
392
+
393
+ You must create a container for the widget. Inside this tag, the widget will be initialized
394
+
395
+
396
+ ### Initialization
397
+ ```javascript
398
+ var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
399
+ list.load();
400
+ ```
401
+
402
+ ```javascript
403
+ // ES2015 | TypeScript
404
+
405
+ import { HtmlPaymentSourceWidget } from '@paydock/client-sdk';
406
+
407
+ var list = new HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
408
+ list.load();
409
+ ```
410
+
411
+ Then write only need 2 lines of code in js to initialize widget
412
+
413
+
414
+ ### Full example
415
+
416
+ ```html
417
+ <!DOCTYPE html>
418
+ <html lang="en">
419
+ <head>
420
+ <meta charset="UTF-8">
421
+ <title>Title</title>
422
+ <style>iframe {border: 0;width: 40%;height: 300px;}</style>
423
+ </head>
424
+ <body>
425
+ <div id="list"></div>
426
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
427
+ <script>
428
+ var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
429
+ list.load();
430
+ </script>
431
+ </body>
432
+ </html>
433
+ ```
434
+
435
+
436
+ ## Payment sources advanced example
437
+
438
+ ### Customization
439
+
440
+ ```javascript
441
+ list.setStyles({
442
+ icon_size: 'small'
443
+ });
444
+ ```
445
+
446
+ This example shows how you can customize to your needs and design
447
+
448
+ ### Settings
449
+
450
+ ```javascript
451
+
452
+ list.filterByTypes(['card', 'checkout']); // filter by any payment source types
453
+ list.filterByGatewayIds(['gateway1']); // also other filters
454
+
455
+ list.setRefId('id'); // your unique identifier to identify the data
456
+
457
+ list.setLimit(4); // Pagination elements will show if count of elements more then argument passed
458
+
459
+ list.onSelectInsert('input[name="ps_id"]', 'payment_source_id'); // insert one-time-token to your input after finish checkout
460
+
461
+ list.on('select', function(data) {
462
+ console.log(data);
463
+ });
464
+ ```
465
+
466
+ This example shows how you can use a lot of other methods to settings your form
467
+
468
+ ### Full example
469
+
470
+ ```html
471
+ <!DOCTYPE html>
472
+ <html lang="en">
473
+ <head>
474
+ <meta charset="UTF-8">
475
+ <title>Title</title>
476
+ <style>iframe {border: 0;width: 40%;height: 300px;}</style>
477
+ </head>
478
+ <body>
479
+ <div id="list"></div>
480
+ <input type="text" name="ps_id" />
481
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
482
+ <script>
483
+ var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
484
+ list.filterByTypes(['card', 'checkout']);
485
+ list.filterByGatewayIds(['gateway1']);
486
+ list.setRefId('id');
487
+ list.setLimit(4);
488
+ list.setStyles({
489
+ icon_size: 'small'
490
+ });
491
+
492
+ list.load();
493
+
494
+ list.onSelectInsert('input[name="ps_id"]', 'payment_source_id');
495
+ list.on('select', function(data) {
496
+ console.log(data);
497
+ });
498
+ </script>
499
+ </body>
500
+ </html>
501
+ ```
502
+
503
+ ## Checkout button
504
+
505
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#cb_CheckoutButton)
506
+ PayPal meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#ipaypalmeta)
507
+ Zipmoney meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#izipmoneymeta)
508
+
509
+ This widget allows you to turn your button into a full Checkout Button.
510
+ As a result, you will be able to receive a one-time token for charges, subscriptions etc. And other data given to the user by the payment gateway.
511
+
512
+
513
+
514
+ ## Checkout button simple example
515
+
516
+ ### Container
517
+
518
+ ```html
519
+ <button type="button" id="button">
520
+ checkout
521
+ </button>
522
+ ```
523
+
524
+ You must create a button to turn it into checkout-button
525
+
526
+
527
+ ### Initialization
528
+ ```javascript
529
+ var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId');
530
+ ```
531
+
532
+ ```javascript
533
+ // ES2015 | TypeScript
534
+
535
+
536
+ var button = new PaypalCheckoutButton('#button', 'publicKey');
537
+ ```
538
+
539
+ Then write only need 1 line of code in js to initialize widget
540
+
541
+
542
+ ### Full example
543
+
544
+ ```html
545
+ <!DOCTYPE html>
546
+ <html lang="en">
547
+ <head>
548
+ <meta charset="UTF-8">
549
+ <title>Title</title>
550
+ </head>
551
+ <body>
552
+ <button type="button" id="button">checkout</button>
553
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
554
+ <script>
555
+ var button = new paydock.PaypalCheckoutButton('#button', 'publicKey');
556
+ </script>
557
+ </body>
558
+ </html>
559
+ ```
560
+
561
+
562
+ ## Checkout button advanced example
563
+
564
+ ### Optional methods
565
+
566
+ ```javascript
567
+ button.onFinishInsert('input[name="pst"]', 'payment_source_token'); // insert one-time-token to your input after finish checkout
568
+
569
+ button.setMeta({
570
+ brand_name: 'Paydock',
571
+ reference: '15',
572
+ first_name: 'receiver-name',
573
+ last_name: 'receiver-last-name',
574
+ phone: '9379992'}); // settings for checkout pages
575
+
576
+ button.on('finish', function (data) { // Add handler of event
577
+ console.log('on:finish', data);
578
+ });
579
+ ```
580
+
581
+ This example shows how you can use a lot of other methods to settings your button
582
+
583
+ ### Full Paypal example
584
+
585
+ ```html
586
+ <!DOCTYPE html>
587
+ <html lang="en">
588
+ <head>
589
+ <meta charset="UTF-8">
590
+ <title>Title</title>
591
+ </head>
592
+ <body>
593
+ <form id="paymentForm">
594
+ <button type="button" id="button">
595
+ <img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;">
596
+ </button>
597
+ </form>
598
+
599
+ <input type="text" name="pst" />
600
+
601
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
602
+ <script>
603
+ var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId');
604
+ button.onFinishInsert('input[name="pst"]', 'payment_source_token');
605
+ button.setMeta({
606
+ brand_name: 'Paydock',
607
+ reference: '15',
608
+ first_name: 'Joshua',
609
+ last_name: 'Wood',
610
+ phone: '0231049872'});
611
+
612
+ button.on('finish', function (data) {
613
+ console.log('on:finish', data);
614
+ });
615
+ </script>
616
+ </body>
617
+ </html>
618
+ ```
619
+ ### Full ZipMoney example
620
+
621
+ ```html
622
+ <!DOCTYPE html>
623
+ <html lang="en">
624
+ <head>
625
+ <meta charset="UTF-8">
626
+ <title>Title</title>
627
+ </head>
628
+ <body>
629
+ <form id="paymentForm">
630
+ <button type="button" id="button">
631
+ <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTVrrEYxDmq4WXv7hfHygKD9ltnOqv0K6soSAhmbKNllPNYWiLiJA" align="left" style="margin-right:7px;">
632
+ </button>
633
+ </form>
634
+
635
+ <input type="text" name="pst" />
636
+
637
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
638
+ <script>
639
+ var button = new paydock.ZipmoneyCheckoutButton('#button', 'publicKey', 'gatewayId');
640
+ button.onFinishInsert('input[name="pst"]', 'payment_source_token');
641
+ button.setMeta("first_name": "Joshua",
642
+ "tokenize": true,
643
+ "last_name": "Wood",
644
+ "email":"joshuawood@hotmail.com.au",
645
+ "gender": "male",
646
+ "charge": {
647
+ "amount": "4",
648
+ "currency":"AUD",
649
+ "shipping_type": "delivery",
650
+ "shipping_address": {
651
+ "first_name": "Joshua",
652
+ "last_name": "Wood",
653
+ "line1": "Suite 660",
654
+ "line2": "822 Ruiz Square",
655
+ "country": "AU",
656
+ "postcode": "3223",
657
+ "city": "Sydney",
658
+ "state": "LA"
659
+ },
660
+ "billing_address": {
661
+ "first_name": "Joshua",
662
+ "last_name": "Wood",
663
+ "line1": "Suite 660",
664
+ "line2": "test",
665
+ "country": "AU",
666
+ "postcode": "3223",
667
+ "city": "Sydney",
668
+ "state": "LA"
669
+ },
670
+ "items": [
671
+ {
672
+ "name":"ACME Toolbox",
673
+ "amount":"2",
674
+ "quantity": 1,
675
+ "reference":"Fuga consequuntur sint ab magnam"
676
+ },
677
+ {
678
+ "name":"Device 42",
679
+ "amount":"2",
680
+ "quantity": 1,
681
+ "reference":"Fuga consequuntur sint ab magnam"
682
+ }
683
+ ]
684
+ },
685
+
686
+ "statistics": {
687
+ "account_created": "2017-05-05",
688
+ "sales_total_number": "5",
689
+ "sales_total_amount": "4",
690
+ "sales_avg_value": "45",
691
+ "sales_max_value": "400",
692
+ "refunds_total_amount": "21",
693
+ "previous_chargeback": "true",
694
+ "currency": "AUD",
695
+ "last_login": "2017-06-01"
696
+ });
697
+
698
+ button.on('finish', function (data) {
699
+ console.log('on:finish', data);
700
+ });
701
+ </script>
702
+ </body>
703
+ </html>
704
+ ```
705
+
706
+ ### Full Aftepay example
707
+
708
+ ```html
709
+ <!DOCTYPE html>
710
+ <html lang="en">
711
+ <head>
712
+ <meta charset="UTF-8">
713
+ <title>Title</title>
714
+ </head>
715
+ <body>
716
+ <button type="button" id="button">
717
+ <img src="https://daepxvbfwwgd0.cloudfront.net/assets/logo_scroll-0c43312c5845a0dcd7a3373325da6402bc1d635d3415af28ed40d6c1b48e3d5c.png" align="left" style="margin-right:7px;">
718
+ </button>
719
+
720
+ <input type="text" name="pst" />
721
+
722
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
723
+ <script>
724
+ var button = new paydock.AfterpayCheckoutButton('#button', 'publicKey', 'gatewayId');
725
+
726
+ button.onFinishInsert('input[name="pst"]', 'payment_source_token');
727
+ button.showEnhancedTrackingProtectionPopup(true);
728
+ button.setMeta({
729
+ amount: "100",
730
+ currency: "AUD",
731
+ reference: 'Vitae commodi provident assumenda',
732
+ email: 'wanda.mertz@example.com',
733
+ first_name: 'Wanda',
734
+ last_name: 'Mertz',
735
+ address_line: '61426 Osvaldo Plains',
736
+ address_line2: 'Apt. 276',
737
+ address_city: 'Lake Robyn',
738
+ address_state: 'WY',
739
+ address_postcode: '07396',
740
+ address_country: 'Australia',
741
+ phone: '0412345678',
742
+ });
743
+
744
+ button.on('finish', function (data) {
745
+ console.log('on:finish', data);
746
+ });
747
+ </script>
748
+ </body>
749
+ </html>
750
+ ```
751
+
752
+ ## Api
753
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#api)
754
+
755
+ This wrapper helps you to work with paydock api emdpoints
756
+
757
+ ### Get browser details
758
+ ```javascript
759
+ var browserDetails = await new paydock.Api('publicKey').setEnv('env').getBrowserDetails();
760
+ ```
761
+
762
+ ```javascript
763
+ // ES2015 | TypeScript
764
+
765
+ import { Api } from '@paydock/client-sdk';
766
+
767
+ var browserDetails = await new paydock.Api('publicKey').setEnv('env').getBrowserDetails();
768
+ ```
769
+
770
+ ### Initialization
771
+ ```javascript
772
+ var response = await new paydock.Api('publicKey').setEnv('env').charge().preAuth({
773
+ amount: 100,
774
+ currency: 'AUD',
775
+ token: 'token',
776
+ });
777
+ ```
778
+
779
+ ```javascript
780
+ // ES2015 | TypeScript
781
+
782
+ import { Api } from '@paydock/client-sdk';
783
+
784
+ var response = await new Api('publicKey').setEnv('env').charge().preAuth({
785
+ amount: 100,
786
+ currency: 'AUD',
787
+ token: 'token',
788
+ });
789
+ ```
790
+
791
+ Then write only need 2 lines of code in js to make request
792
+
793
+ ### Initialization full example
794
+
795
+ ```html
796
+ <!DOCTYPE html>
797
+ <html lang="en">
798
+ <head>
799
+ <meta charset="UTF-8">
800
+ <title>Title</title>
801
+ <style></style>
802
+ </head>
803
+ <body>
804
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
805
+ <script>
806
+ (async function() {
807
+ var response = await new Api('publicKey').setEnv('env').charge().preAuth({
808
+ amount: 100,
809
+ currency: 'AUD',
810
+ token: 'token',
811
+ });
812
+ })();
813
+ </script>
814
+ </body>
815
+ </html>
816
+ ```
817
+
818
+ ## Canvas3ds
819
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#canvas3d)
820
+
821
+ This widget provides you to integrate 3d Secure
822
+
823
+ ## Canvas3ds simple example
824
+
825
+ ### Container
826
+
827
+ ```html
828
+ <div id="widget"></div>
829
+ ```
830
+
831
+ You must create a container for the widget. Inside this tag, the widget will be initialized
832
+
833
+
834
+ ### Initialization
835
+ ```javascript
836
+ var canvas3ds = new paydock.Canvas3ds('#widget', 'token');
837
+ canvas3ds.load();
838
+ ```
839
+
840
+ ```javascript
841
+ // ES2015 | TypeScript
842
+
843
+ import { Canvas3ds } from '@paydock/client-sdk';
844
+
845
+ var list = new Canvas3ds('#widget', 'token');
846
+ list.load();
847
+ ```
848
+
849
+ Then write only need 2 lines of code in js to initialize widget
850
+
851
+
852
+ ### Full example
853
+
854
+ ```html
855
+ <!DOCTYPE html>
856
+ <html lang="en">
857
+ <head>
858
+ <meta charset="UTF-8">
859
+ <title>Title</title>
860
+ <style>iframe {border: 0;width: 40%;height: 300px;}</style>
861
+ </head>
862
+ <body>
863
+ <div id="widget"></div>
864
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
865
+ <script>
866
+ var canvas3ds = new paydock.Canvas3ds('#widget', 'token');
867
+ canvas3ds.load();
868
+ </script>
869
+ </body>
870
+ </html>
871
+ ```
872
+
873
+
874
+ ## Canvas3ds advanced example
875
+
876
+ ### Settings
877
+
878
+ ```javascript
879
+
880
+ canvas3ds.setEnv('sandbox'); // set enviroment
881
+
882
+ canvas3ds.hide(); // hide widget
883
+
884
+ canvas3ds.show(); // show widget
885
+
886
+ canvas3ds.on('chargeAuthSuccess', function (data) {
887
+ console.log(data);
888
+ });
889
+ canvas3ds.on('chargeAuthReject', function (data) {
890
+ console.log(data);
891
+ });
892
+ canvas3ds.on('chargeAuthCancelled', function (data) {
893
+ console.log(data);
894
+ });
895
+ canvas3ds.on('additionalDataCollectSuccess', function (data) {
896
+ console.log(data);
897
+ });
898
+ canvas3ds.on('additionalDataCollectReject', function (data) {
899
+ console.log(data);
900
+ });
901
+ canvas3ds.on('chargeAuth', function (data) {
902
+ console.log(data);
903
+ });
904
+ ```
905
+
906
+ This example shows how you can use a lot of other methods to settings your form
907
+
908
+ ### Full example
909
+
910
+ ```html
911
+ <!DOCTYPE html>
912
+ <html lang="en">
913
+ <head>
914
+ <meta charset="UTF-8">
915
+ <title>Title</title>
916
+ <style>iframe {border: 0;width: 40%;height: 450px;}</style>
917
+ </head>
918
+ <body>
919
+ <div id="widget3ds"></div>
920
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
921
+ <script>
922
+ var canvas3ds = new paydock.Canvas3ds('#widget3ds', 'token');
923
+ canvas3ds.on('chargeAuthSuccess', function (data) {
924
+ console.log('chargeAuthSuccess', data);
925
+ });
926
+ canvas3ds.on('chargeAuthReject', function (data) {
927
+ console.log('chargeAuthReject', data);
928
+ });
929
+ canvas3ds.load();
930
+ </script>
931
+ </body>
932
+ </html>
933
+ ```
934
+
935
+ ### Full example with pre authorization
936
+
937
+ ```html
938
+ <!DOCTYPE html>
939
+ <html lang="en">
940
+ <head>
941
+ <meta charset="UTF-8">
942
+ <title>Title</title>
943
+ <style>iframe {border: 0;width: 40%;height: 450px;}</style>
944
+ </head>
945
+ <body>
946
+ <div id="widget"></div>
947
+ <div id="widget3ds"></div>
948
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
949
+ <script>
950
+ (async function () {
951
+ var htmlWidget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');
952
+ htmlWidget.load();
953
+ var {payment_source} = await htmlWidget.on('finish');
954
+ var preAuthResp = await new paydock.Api('publicKey').setEnv('sandbox').charge().preAuth({
955
+ amount: 100,
956
+ currency: 'AUD',
957
+ token: payment_source,
958
+ });
959
+ var canvas = new paydock.Canvas3ds('#widget3ds', preAuthResp._3ds.token);
960
+ canvas.load();
961
+ var chargeAuthEvent = await canvas.on('chargeAuth');
962
+ console.log('chargeAuthEvent', chargeAuthEvent);
963
+ })()
964
+ </script>
965
+ </body>
966
+ </html>
967
+ ```
968
+
969
+ ## Canvas 3ds for Standalone 3ds charges
970
+
971
+ After you initialized the standalone 3ds charge via `v1/charges/standalone-3ds` API endpoint, you get a token used to initialize the Canvas3ds. All above information regarding setup, loading and initialization still apply.
972
+
973
+ ### Full example
974
+
975
+ ```html
976
+ <!DOCTYPE html>
977
+ <html lang="en">
978
+ <head>
979
+ <meta charset="UTF-8" />
980
+ <title>Title</title>
981
+ <style>
982
+ iframe {
983
+ border: 0;
984
+ width: 40%;
985
+ height: 450px;
986
+ }
987
+ </style>
988
+ </head>
989
+ <body>
990
+ <div id="widget3ds"></div>
991
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
992
+ <script>
993
+ var canvas3ds = new paydock.Canvas3ds("#widget3ds", "token");
994
+ canvas3ds.on("chargeAuthSuccess", function (data) {
995
+ console.log(data);
996
+ });
997
+ canvas3ds.on("chargeAuthReject", function (data) {
998
+ console.log(data);
999
+ });
1000
+ canvas3ds.on("chargeAuthChallenge", function (data) {
1001
+ console.log(data);
1002
+ });
1003
+ canvas3ds.on("chargeAuthDecoupled", function (data) {
1004
+ console.log(data.result.description);
1005
+ });
1006
+ canvas3ds.on("chargeAuthInfo", function (data) {
1007
+ console.log(data.info);
1008
+ });
1009
+ canvas3ds.on("error", function ({ charge_3ds_id, error }) {
1010
+ console.log(error);
1011
+ });
1012
+ canvas3ds.load();
1013
+ </script>
1014
+ </body>
1015
+ </html>
1016
+ ```
1017
+
1018
+ - The `chargeAuthSuccess` event is executed both for frictionless flow, or for challenge flow after the customer has correctly authenticated with the bank using whatever challenge imposed.
1019
+ - The `chargeAuthReject` event is executed when the authorization was rejected or when a timeout was received by the underlying system:
1020
+ - A `data.status` of `AuthTimedOut` will be received for timeouts.
1021
+ - A `data.status` of `rejected` will be received when the authorization was rejected.
1022
+ - A `data.status` of `invalid_event` will be received for unhandled situations.
1023
+ - The `chargeAuthChallenge` event is sent before starting a challenge flow (i.e. opening an IFrame for the customer to complete a challenge with ther bank). Once the end customer performs the challenge, the Canvas3ds will be able to identify the challenge result and will either produce a `chargeAuthSuccess` or `chargeAuthReject` event.
1024
+ - The `chargeAuthDecoupled` event is sent when the flow is a decoupled challenge, alongside a `data.result.description` field that you must show to the customer, indicating the method the user must use to authenticate. For example this may happen by having the cardholder authenticating directly with their banking app through biometrics. Once the end customer does this, the Canvas3ds will be able to recognize the challenge result is ready and will either produce a `chargeAuthSuccess` or `chargeAuthReject` event.
1025
+ - The `error` event is sent if an unexpected issue with the client library occurs. In such scenarios, you should consider the autentication process as interrupted:
1026
+ - When getting this event, you will get on `data.error` the full error object.
1027
+
1028
+ ### Events and Values
1029
+
1030
+ | Event Value | Type | Description |
1031
+ | ------------------- | ------------------- | -------------------------------------------------------------- |
1032
+ | <code>chargeAuthSuccess</code> | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
1033
+ | <code>chargeAuthReject</code> | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
1034
+ | <code>chargeAuthChallenge</code> | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
1035
+ | <code>chargeAuthDecoupled</code> | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
1036
+ | <code>chargeAuthInfo</code> | <code>object</code> | Instance of [ChargeEventResponse](#cb_chargeEventResponse) |
1037
+ | <code>error</code> | <code>object</code> | Instance of [chargeError](#cb_chargeError) |
1038
+
1039
+ ## Response Values
1040
+
1041
+ <a name="cb_chargeEventResponse" id="cb_chargeEventResponse"></a>
1042
+
1043
+ ### ChargeEventResponse
1044
+
1045
+ | Param | Type | Description |
1046
+ | ------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------- |
1047
+ | <code>status</code> | <code>string</code> | status for the event transaction |
1048
+ | <code>charge_3ds_id</code> | <code>string</code> | Universal unique transaction identifier to identify the transaction |
1049
+ | <code>info</code> | <code>string</code> | info field for `chargeAuthInfo` event |
1050
+ | <code>result.description</code> | <code>string</code> [Optional] | field that you must show to the customer, indicating the method the user must use to authenticate during the decoupled challenge flow. |
1051
+
1052
+ ### ChargeError
1053
+
1054
+ <a name="cb_chargeError" id="cb_chargeError"></a>
1055
+
1056
+ | Param | Type | Description |
1057
+ | ------------- | ------------------- | ------------------------------------------------------------------- |
1058
+ | <code>error</code> | <code>object</code> | error response |
1059
+ | <code>charge_3ds_id</code> | <code>string</code> | Universal unique transaction identifier to identify the transaction |
1060
+
1061
+ ## Vault Display Widget
1062
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#vault-display-widget)
1063
+
1064
+ The vault display form allows viewing card number and CVV. The form can be customised according to your needs.
1065
+ You can set styles as well as subscribe to widget events that help monitor user’s actions in real time.
1066
+
1067
+ ## Vault Display Widget simple example
1068
+
1069
+ ### Container
1070
+
1071
+ ```html
1072
+ <div id="widget"></div>
1073
+ ```
1074
+
1075
+ You must create a container for the widget. Inside this tag, the widget will be initialized
1076
+
1077
+
1078
+ ### Initialization
1079
+ ```javascript
1080
+ var widget = new paydock.VaultDisplayWidget('#widget', 'token');
1081
+ widget.load();
1082
+ ```
1083
+
1084
+ ```javascript
1085
+ // ES2015 | TypeScript
1086
+
1087
+ import { VaultDisplayWidget } from '@paydock/client-sdk';
1088
+
1089
+ var widget = new VaultDisplayWidget('#widget', 'token');
1090
+ widget.load();
1091
+ ```
1092
+
1093
+ Then write only need 2 lines of code in js to initialize widget
1094
+
1095
+ ### Full example
1096
+
1097
+ ```html
1098
+ <!DOCTYPE html>
1099
+ <html lang="en">
1100
+ <head>
1101
+ <meta charset="UTF-8">
1102
+ <title>Title</title>
1103
+ <style>iframe {border: 0;width: 100%;height: 300px;}</style>
1104
+ </head>
1105
+ <body>
1106
+
1107
+ <div id="widget"></div>
1108
+
1109
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1110
+ <script>
1111
+ var widget = new paydock.VaultDisplayWidget('#widget', 'token');
1112
+ widget.load();
1113
+ </script>
1114
+ </body>
1115
+ </html>
1116
+ ```
1117
+
1118
+ ## Widget advanced example
1119
+
1120
+ ### Customization
1121
+
1122
+ ```javascript
1123
+ widget.setEnv('sandbox');
1124
+
1125
+ widget.on('after_load', function (data) {
1126
+ console.log(data);
1127
+ });
1128
+
1129
+ widget.on('cvv_secure_code_requested', function (data) {
1130
+ console.log(data);
1131
+ });
1132
+
1133
+ widget.on('card_number_secure_code_requested', function (data) {
1134
+ console.log(data);
1135
+ });
1136
+
1137
+ widget.setStyles({
1138
+ background_color: 'rgb(0, 0, 0)',
1139
+ border_color: 'yellow',
1140
+ text_color: '#FFFFAA',
1141
+ button_color: 'rgba(255, 255, 255, 0.9)',
1142
+ font_size: '20px'
1143
+ });
1144
+ ```
1145
+
1146
+ This example shows how you can use a lot of other methods to settings your form
1147
+
1148
+ ### Full example
1149
+
1150
+ ```html
1151
+ <!DOCTYPE html>
1152
+ <html lang="en">
1153
+ <head>
1154
+ <meta charset="UTF-8">
1155
+ <title>Title</title>
1156
+ <style>iframe {border: 0;width: 40%;height: 450px;}</style>
1157
+ </head>
1158
+ <body>
1159
+
1160
+ <div id="widget"></div>
1161
+
1162
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1163
+ <script>
1164
+ var widget = new paydock.VaultDisplayWidget('#widget', 'token');
1165
+
1166
+ widget.setEnv('sandbox');
1167
+
1168
+ widget.on('after_load', function (data) {
1169
+ console.log(data);
1170
+ });
1171
+
1172
+ widget.on('cvv_secure_code_requested', function (data) {
1173
+ console.log(data);
1174
+ });
1175
+
1176
+ widget.on('card_number_secure_code_requested', function (data) {
1177
+ console.log(data);
1178
+ });
1179
+
1180
+ widget.setStyles({
1181
+ background_color: 'rgb(0, 0, 0)',
1182
+ border_color: 'yellow',
1183
+ text_color: '#FFFFAA',
1184
+ button_color: 'rgba(255, 255, 255, 0.9)',
1185
+ font_size: '20px'
1186
+ });
1187
+
1188
+ widget.load();
1189
+ </script>
1190
+ </body>
1191
+ </html>
1192
+ ```
1193
+
1194
+ ## Wallet Buttons
1195
+ You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#wallet-buttons-simple-example)
1196
+
1197
+ Wallet Buttons allow you to easily integrate different E-Wallets into your checkout.
1198
+ Currently supports ApplePay, Google Pay, Google Pay and Apple Pay via Stripe, Flypay and Flypay V2 checkout, Paypal Smart Buttons Checkout and Afterpay.
1199
+
1200
+ If available in your client environment, you will display a simple button that upon clicking it the user will follow the standard flow for the appropriate Wallet. If not available an event will be raised and no button will be displayed.
1201
+
1202
+ ## Wallet Buttons simple example
1203
+
1204
+ ### Container
1205
+
1206
+ ```html
1207
+ <div id="widget"></div>
1208
+ ```
1209
+
1210
+ You must create a container for the Wallet Buttons. Inside this tag, the button will be initialized.
1211
+
1212
+ Before initializing the button, you must perform a POST request to `charges/wallet` from a secure environment like your server. This call will return a token that is required to load the button and securely complete the payment. You can find the documentation to this call in the PayDock API documentation.
1213
+
1214
+ ### Initialization
1215
+ The following is the minimum required initialization parameters for Apple Pay and Google Pay via Stripe:
1216
+ ```javascript
1217
+ let button = new paydock.WalletButtons(
1218
+ "#widget",
1219
+ token,
1220
+ {
1221
+ amount_label: "Total",
1222
+ country: "DE",
1223
+ }
1224
+ );
1225
+ button.load();
1226
+ ```
1227
+
1228
+ ```javascript
1229
+ // ES2015 | TypeScript
1230
+ import { WalletButtons } from '@paydock/client-sdk';
1231
+
1232
+ var button = new WalletButtons(
1233
+ '#widget',
1234
+ token,
1235
+ {
1236
+ amount_label: 'Total',
1237
+ country: 'DE',
1238
+ }
1239
+ );
1240
+ button.load();
1241
+ ```
1242
+
1243
+ Flypay and Paypal wallets do not require any meta sent to the wallet, so the following is enough for initialization:
1244
+ ```javascript
1245
+ let button = new paydock.WalletButtons(
1246
+ "#widget",
1247
+ token,
1248
+ {}
1249
+ );
1250
+ button.load();
1251
+ ```
1252
+
1253
+ ```javascript
1254
+ // ES2015 | TypeScript
1255
+ import { WalletButtons } from '@paydock/client-sdk';
1256
+
1257
+ var button = new WalletButtons(
1258
+ '#widget',
1259
+ token,
1260
+ {}
1261
+ );
1262
+ button.load();
1263
+ ```
1264
+
1265
+ For Afterpay wallet, the country code is required:
1266
+ ```javascript
1267
+ let button = new paydock.WalletButtons(
1268
+ "#widget",
1269
+ token,
1270
+ {
1271
+ country: "AU",
1272
+ }
1273
+ );
1274
+ button.load();
1275
+ ```
1276
+
1277
+ ```javascript
1278
+ // ES2015 | TypeScript
1279
+ import { WalletButtons } from '@paydock/client-sdk';
1280
+
1281
+ var button = new WalletButtons(
1282
+ '#widget',
1283
+ token,
1284
+ {
1285
+ country: 'AU',
1286
+ }
1287
+ );
1288
+ button.load();
1289
+ ```
1290
+
1291
+ For Flypay v2 wallet, the client_id is required:
1292
+ ```javascript
1293
+ let button = new paydock.WalletButtons(
1294
+ "#widget",
1295
+ token,
1296
+ {
1297
+ client_id: "client_id",
1298
+ }
1299
+ );
1300
+ button.load();
1301
+ ```
1302
+
1303
+ ```javascript
1304
+ // ES2015 | TypeScript
1305
+ import { WalletButtons } from '@paydock/client-sdk';
1306
+
1307
+ var button = new WalletButtons(
1308
+ '#widget',
1309
+ token,
1310
+ {
1311
+ client_id: "client_id",
1312
+ }
1313
+ );
1314
+ button.load();
1315
+ ```
1316
+
1317
+ ### Setting environment
1318
+
1319
+ Current method can change environment. By default environment = sandbox.
1320
+ Bear in mind that you must set an environment before calling `button.load()`.
1321
+
1322
+ ```javascript
1323
+ button.setEnv('sandbox');
1324
+ ```
1325
+
1326
+ ### Full example
1327
+
1328
+ ```html
1329
+ <!DOCTYPE html>
1330
+ <html lang="en">
1331
+ <head>
1332
+ <meta charset="UTF-8">
1333
+ <title>Title</title>
1334
+ </head>
1335
+ <body>
1336
+ <h2>Payment using PayDock Wallet Button!</h2>
1337
+ <div id="widget"></div>
1338
+ </body>
1339
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1340
+ <script>
1341
+ let button = new paydock.WalletButtons(
1342
+ "#widget",
1343
+ token,
1344
+ {
1345
+ amount_label: "Total",
1346
+ country: "DE",
1347
+ }
1348
+ );
1349
+ button.load();
1350
+ </script>
1351
+ </html>
1352
+ ```
1353
+
1354
+ ## Wallet Buttons advanced example
1355
+
1356
+ ### Checking for button availability
1357
+
1358
+ If the customer's browser is not supported, or the customer does not have any card added to their Google Pay or Apple Pay wallets, the button will not load. In this case the callback onUnavailable() will be called. You can define the behavior of this function before loading the button.
1359
+
1360
+ ```javascript
1361
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1362
+ ```
1363
+
1364
+ ### Forcibly closing the checkout
1365
+
1366
+ In some situations you may want to forcibly close the checkout so that your user is back in your checkout screen, fow which you can use this method. Currently supported by Flypay wallet only.
1367
+
1368
+ ```javascript
1369
+ button.close();
1370
+ ```
1371
+
1372
+ ### Performing actions when the wallet button is clicked
1373
+
1374
+ In some situations you may want to perform some validations or actions when the user clicks on the wallet button, for which you can use this method. Currently supported by Paypal, ApplePay and GooglePay wallets.
1375
+
1376
+ ```javascript
1377
+ button.onClick(() => console.log("Perform actions on button click"));
1378
+ ```
1379
+
1380
+ ### Performing actions when shipping info is updated
1381
+
1382
+ In Flypay, Paypal, ApplePay via MPGS and GooglePay via MPGS integrations after each shipping info update the `onUpdate(data)` will be called with the selected shipping address information, plus selected shipping method when applicable for Paypal, ApplePay and GooglePay. Merchants should handle this callback, recalculate shipping costs in their server by analyzing the new data, and submit a backend to backend request to `POST charges/:id` with the new total amount and shipping amount (you can find the documentation of this call in the PayDock API documentation).
1383
+
1384
+ For Paypal integration specifically, if shipping is enabled for the wallet button and different shipping methods were provided in the create wallet charge call, Merchants must ensure that the posted `shipping.amount` to `POST charges/:id` matches the selected shipping option amount (value sent in when initializing the wallet charge). In other words, when providing shipping methods the shipping amount is bound to being one of the provided shipping method amount necessarily. Bear in mind that the total charge amount must include the `shipping.amount`, since it represents the full amount to be charged to the customer.
1385
+
1386
+ After analyzing the new shipping information, and making the post with the updated charge and shipping amounts if necessary, the `button.update({ success: true/false })` wallet button method needs to be called to resume the interactions with the customer. Not calling this will result in unexpected behavior.
1387
+
1388
+ ```javascript
1389
+ button.onUpdate((data) => {
1390
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1391
+ // call `POST charges/:id` to modify charge
1392
+ button.update({ success: true });
1393
+ });
1394
+ ```
1395
+
1396
+ For ApplePay via MPGS and GooglePay via MPGS integrations, you can also return a new `amount` and new `shipping_options` in case new options are needed based on the updated shipping data. Before the user authorizes the transaction, you receive redacted address information (address_country, address_city, address_state, address_postcode), and this data can be used to recalculate the new amount and new shipping options.
1397
+
1398
+ ```javascript
1399
+ button.onUpdate((data) => {
1400
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1401
+ // call `POST charges/:id` to modify charge
1402
+ button.update({
1403
+ success: true,
1404
+ body: {
1405
+ amount: 15,
1406
+ shipping_options: [
1407
+ {
1408
+ id: "NEW-FreeShip",
1409
+ label: "NEW - Free Shipping",
1410
+ detail: "Arrives in 3 to 5 days",
1411
+ amount: "0.00"
1412
+ },
1413
+ {
1414
+ id: "NEW-FastShip",
1415
+ label: "NEW - Fast Shipping",
1416
+ detail: "Arrives in less than 1 day",
1417
+ amount: "10.00"
1418
+ }
1419
+ ]
1420
+ }
1421
+ });
1422
+ });
1423
+ ```
1424
+
1425
+ ### Performing actions after the payment is completed
1426
+
1427
+ After the payment is completed, the onPaymentSuccessful(data) will be called if the payment was successful. If the payment was not successful, the function onPaymentError(data) will be called. If fraud check is active for the gateway, a fraud body was sent in the wallet charge initialize call and the fraud service left the charge in review, then the onPaymentInReview(data) will be called.
1428
+ All three callbacks return relevant data according to each one of the scenarios.
1429
+
1430
+ >*Note that these callbacks will not be triggered for the Afterpay wallet when Redirect mode is used, that is when the charge is initialized with the success_url and error_url parameters, since the payment completion is done through the Redirect method, and therefore this SDK will not be loaded once the payment is completed at checkout.*
1431
+
1432
+ ```javascript
1433
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1434
+ ```
1435
+
1436
+ ```javascript
1437
+ button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
1438
+ ```
1439
+
1440
+ ```javascript
1441
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1442
+ ```
1443
+ ### Events
1444
+ The above events can be used in a more generic way via de `on` function, and making use
1445
+ of the corresponding event names.
1446
+
1447
+ ```javascript
1448
+ button.on(EVENT.UNAVAILABLE, () => console.log("No wallet buttons available"));
1449
+ button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id");
1450
+ button.on(EVENT.PAYMENT_SUCCESSFUL, (data) => console.log("The payment was successful"));
1451
+ button.on(EVENT.PAYMENT_ERROR, (data) => console.log("The payment was not successful"));
1452
+ ```
1453
+
1454
+ This example shows how to use these functions for **Apple and Google Pay via Stripe**:
1455
+ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `wallets`)_
1456
+ ### Apple and Google Pay via Stripe Full example
1457
+
1458
+ ```html
1459
+ <!DOCTYPE html>
1460
+ <html lang="en">
1461
+ <head>
1462
+ <meta charset="UTF-8">
1463
+ <title>Title</title>
1464
+ </head>
1465
+ <body>
1466
+ <h2>Payment using PayDock Wallet Button!</h2>
1467
+ <div id="widget"></div>
1468
+ </body>
1469
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1470
+ <script>
1471
+ let button = new paydock.WalletButtons(
1472
+ "#widget",
1473
+ charge_token,
1474
+ {
1475
+ amount_label: "Total",
1476
+ country: "DE",
1477
+ wallets: ["google", "apple"],
1478
+ }
1479
+ );
1480
+ button.setEnv('sandbox');
1481
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1482
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1483
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1484
+ button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
1485
+ button.load();
1486
+ </script>
1487
+ </html>
1488
+ ```
1489
+
1490
+ This example shows how to use these functions for **Paypal Smart Checkout Buttons**:
1491
+ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `standalone`, `style`)_
1492
+ ### Paypal Smart Checkout Buttons Full example
1493
+ ```html
1494
+ <!DOCTYPE html>
1495
+ <html lang="en">
1496
+ <head>
1497
+ <meta charset="UTF-8">
1498
+ <title>Title</title>
1499
+ </head>
1500
+ <body>
1501
+ <h2>Payment using PayDock Wallet Button!</h2>
1502
+ <div id="widget"></div>
1503
+ </body>
1504
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1505
+ <script>
1506
+ let button = new paydock.WalletButtons(
1507
+ "#widget",
1508
+ charge_token,
1509
+ {
1510
+ request_shipping: true,
1511
+ pay_later: true,
1512
+ standalone: false,
1513
+ style: {
1514
+ layout: 'horizontal',
1515
+ color: 'blue',
1516
+ shape: 'rect',
1517
+ label: 'paypal',
1518
+ },
1519
+ }
1520
+ );
1521
+ button.setEnv('sandbox');
1522
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1523
+ button.onUpdate((data) => {
1524
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1525
+ // call `POST charges/:id` to modify charge
1526
+ button.update({ success: true });
1527
+ });
1528
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1529
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1530
+ button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
1531
+
1532
+ // Example 1: Asynchronous onClick handler
1533
+ const asyncLogic = async () => {
1534
+ // Perform asynchronous logic. Expectation is that a Promise is returned and attached to response via `attachResult`,
1535
+ // and resolve or reject of it will dictate how wallet behaves.
1536
+ }
1537
+
1538
+ button.onClick(({ data: { attachResult } }) => {
1539
+ // Promise is attached to the result. On Paypal, when promise is resolved, the user Journey will continue.
1540
+ // If no promise is attached then the Paypal journey will not depend on the promise being resolved or rejected
1541
+ attachResult(asyncLogic());
1542
+ });
1543
+
1544
+ // Example 2: Synchronous onClick handler
1545
+ // button.onClick(({ data: { attachResult } }) => {
1546
+ // // Perform synchronous logic
1547
+ // console.log("Synchronous onClick: Button clicked");
1548
+ // // Optionally return a boolean flag to halt the operation
1549
+ // attachResult(false);
1550
+ // });
1551
+
1552
+ button.load();
1553
+ </script>
1554
+ </html>
1555
+ ```
1556
+
1557
+ This example shows how to use these functions for **Flypay v1 Wallet**.
1558
+ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `style`)_
1559
+ ### Flypay Full example
1560
+ ```html
1561
+ <!DOCTYPE html>
1562
+ <html lang="en">
1563
+ <head>
1564
+ <meta charset="UTF-8">
1565
+ <title>Title</title>
1566
+ </head>
1567
+ <body>
1568
+ <h2>Payment using PayDock Wallet Button!</h2>
1569
+ <div id="widget"></div>
1570
+ </body>
1571
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1572
+ <script>
1573
+ let button = new paydock.WalletButtons(
1574
+ "#widget",
1575
+ charge_token,
1576
+ {
1577
+ request_shipping: true
1578
+ }
1579
+ );
1580
+ button.setEnv('sandbox');
1581
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1582
+ button.onUpdate((data) => {
1583
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1584
+ // call `POST charges/:id` to modify charge
1585
+ button.update({ success: true });
1586
+ });
1587
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1588
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1589
+ button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
1590
+ button.load();
1591
+ </script>
1592
+ </html>
1593
+ ```
1594
+
1595
+ This example shows how to use these functions for **Flypay v2 Wallet**.
1596
+ _(Required `meta` fields: - . Optional `meta` fields: -)_
1597
+ ### Flypay V2 Full example
1598
+ ```html
1599
+ <!DOCTYPE html>
1600
+ <html lang="en">
1601
+ <head>
1602
+ <meta charset="UTF-8">
1603
+ <title>Title</title>
1604
+ </head>
1605
+ <body>
1606
+ <h2>Payment using PayDock Wallet Button!</h2>
1607
+ <div id="widget"></div>
1608
+ </body>
1609
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1610
+ <script>
1611
+ let button = new paydock.WalletButtons(
1612
+ "#widget",
1613
+ charge_token,
1614
+ {
1615
+ access_token: 'TOKEN',
1616
+ refresh_token: 'TOKEN',
1617
+ client_id: 'CLIENT_ID',
1618
+ },
1619
+ );
1620
+ button.setEnv('sandbox');
1621
+ button.onUnavailable((data) => console.log("No wallet buttons available"));
1622
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1623
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1624
+ button.onAuthTokensChanged((data) => console.log('Authentication tokens changed'));
1625
+ button.load();
1626
+ </script>
1627
+ </html>
1628
+ ```
1629
+
1630
+ This example shows how to use these functions for **ApplePay via MPGS** and **GooglePay via MPGS**:
1631
+
1632
+ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `raw_data_initialization`, `request_shipping`, `style.button_type`, `style.button_style`)_
1633
+ ### ApplePay and GooglePay via MPGS Full example
1634
+
1635
+ ```html
1636
+ <!DOCTYPE html>
1637
+ <html lang="en">
1638
+ <head>
1639
+ <meta charset="UTF-8">
1640
+ <title>Title</title>
1641
+ </head>
1642
+ <body>
1643
+ <h2>Payment using PayDock Wallet Button!</h2>
1644
+ <div id="widget"></div>
1645
+ </body>
1646
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1647
+ <script>
1648
+ let button = new paydock.WalletButtons(
1649
+ "#widget",
1650
+ charge_token,
1651
+ {
1652
+ amount_label: "Total",
1653
+ country: 'DE',
1654
+ request_shipping: true,
1655
+ show_billing_address: true,
1656
+ style: {
1657
+ google: {
1658
+ button_type: 'buy',
1659
+ button_size_mode: 'static',
1660
+ button_color: 'white',
1661
+ },
1662
+ apple: {
1663
+ button_type: 'buy',
1664
+ button_style: 'black',
1665
+ },
1666
+ },
1667
+ shipping_options: [
1668
+ {
1669
+ id: "FreeShip",
1670
+ label: "Free Shipping",
1671
+ detail: "Arrives in 5 to 7 days",
1672
+ amount: "0.00"
1673
+ },
1674
+ {
1675
+ id: "FastShip",
1676
+ label: "Fast Shipping",
1677
+ detail: "Arrives in 1 day",
1678
+ amount: "10.00"
1679
+ }
1680
+ ]
1681
+ }
1682
+ );
1683
+ button.setEnv('sandbox');
1684
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1685
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1686
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1687
+ button.onClick(() => console.log("On WalletButton Click"));
1688
+ button.onUpdate((data) => {
1689
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1690
+ // call `POST charges/:id` to modify charge
1691
+ button.update({
1692
+ success: true,
1693
+ body: {
1694
+ amount: 15,
1695
+ shipping_options: [
1696
+ {
1697
+ id: "NEW-FreeShip",
1698
+ label: "NEW - Free Shipping",
1699
+ detail: "Arrives in 3 to 5 days",
1700
+ amount: "0.00"
1701
+ },
1702
+ {
1703
+ id: "NEW-FastShip",
1704
+ label: "NEW - Fast Shipping",
1705
+ detail: "Arrives in less than 1 day",
1706
+ amount: "10.00"
1707
+ }
1708
+ ]
1709
+ }
1710
+ });
1711
+ });
1712
+ button.load();
1713
+ </script>
1714
+ </html>
1715
+ ```
1716
+
1717
+ Also, for **ApplePay via MPGS** you can initialize the `ApplePayPaymentRequest` with your own values instead of using the default ones. Below you can see an example on how to initialize the `ApplePayPaymentRequest` with the `raw_data_initialization` meta field.
1718
+
1719
+ Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpecification` with your own values instead of using the default ones. Below you can see an example on how to initialize the `PaymentMethodSpecification` with the `raw_data_initialization` meta field.
1720
+ ### ApplePay and GooglePay via MPGS Raw data initialization example
1721
+
1722
+ ```html
1723
+ <!DOCTYPE html>
1724
+ <html lang="en">
1725
+ <head>
1726
+ <meta charset="UTF-8">
1727
+ <title>Title</title>
1728
+ </head>
1729
+ <body>
1730
+ <h2>Payment using PayDock Wallet Button!</h2>
1731
+ <div id="widget"></div>
1732
+ </body>
1733
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1734
+ <script>
1735
+ let button = new paydock.WalletButtons(
1736
+ "#widget",
1737
+ charge_token,
1738
+ {
1739
+ raw_data_initialization: {
1740
+ apple: {
1741
+ countryCode: "AU",
1742
+ currencyCode: "AUD",
1743
+ merchantCapabilities: ["supports3DS","supportsCredit","supportsDebit"],
1744
+ supportedNetworks: ["visa","masterCard","amex","discover"],
1745
+ requiredBillingContactFields: ["name","postalAddress"],
1746
+ requiredShippingContactFields:["postalAddress","name","phone","email" ],
1747
+ total: {
1748
+ label: "Total",
1749
+ amount: "10",
1750
+ type: "final",
1751
+ }
1752
+ },
1753
+ google: {
1754
+ type: "CARD",
1755
+ parameters: {
1756
+ allowedAuthMethods: ["PAN_ONLY", "CRYPTOGRAM_3DS"],
1757
+ allowedCardNetworks: [
1758
+ "AMEX",
1759
+ "DISCOVER",
1760
+ "INTERAC",
1761
+ "JCB",
1762
+ "MASTERCARD",
1763
+ "VISA",
1764
+ ],
1765
+ billingAddressRequired: true,
1766
+ },
1767
+ },
1768
+ },
1769
+ amount_label: "Total",
1770
+ country: 'DE',
1771
+ request_shipping: true,
1772
+ show_billing_address: true,
1773
+ style: {
1774
+ google: {
1775
+ button_type: 'buy',
1776
+ button_size_mode: 'static',
1777
+ button_color: 'white',
1778
+ },
1779
+ apple: {
1780
+ button_type: 'buy',
1781
+ button_style: 'black',
1782
+ },
1783
+ },
1784
+ shipping_options: [
1785
+ {
1786
+ id: "FreeShip",
1787
+ label: "Free Shipping",
1788
+ detail: "Arrives in 5 to 7 days",
1789
+ amount: "0.00"
1790
+ },
1791
+ {
1792
+ id: "FastShip",
1793
+ label: "Fast Shipping",
1794
+ detail: "Arrives in 1 day",
1795
+ amount: "10.00"
1796
+ }
1797
+ ]
1798
+ }
1799
+ );
1800
+ button.setEnv('sandbox');
1801
+ button.onUnavailable(() => console.log("No wallet buttons available"));
1802
+ button.onPaymentSuccessful((data) => console.log("The payment was successful"));
1803
+ button.onPaymentError((data) => console.log("The payment was not successful"));
1804
+ button.onUpdate((data) => {
1805
+ console.log("Updating amount via a backend to backend call to POST charges/:id");
1806
+ // call `POST charges/:id` to modify charge
1807
+ button.update({
1808
+ success: true,
1809
+ body: {
1810
+ amount: 15,
1811
+ shipping_options: [
1812
+ {
1813
+ id: "NEW-FreeShip",
1814
+ label: "NEW - Free Shipping",
1815
+ detail: "Arrives in 3 to 5 days",
1816
+ amount: "0.00"
1817
+ },
1818
+ {
1819
+ id: "NEW-FastShip",
1820
+ label: "NEW - Fast Shipping",
1821
+ detail: "Arrives in less than 1 day",
1822
+ amount: "10.00"
1823
+ }
1824
+ ]
1825
+ }
1826
+ });
1827
+ });
1828
+ button.load();
1829
+ </script>
1830
+ </html>
1831
+ ```
1832
+
1833
+ # Click To Pay
1834
+
1835
+ ## Overview
1836
+
1837
+ Integrate with Click To Pay using Paydock's Click To Pay widget.
1838
+ For a full description of the methods and parameters, reference the [README file](https://www.npmjs.com/package/@paydock/client-sdk#ClickToPay).
1839
+
1840
+ ## Click To Pay simple example
1841
+
1842
+ The following section provides an example use case and integration for the widget.
1843
+
1844
+ ### Create a Container
1845
+
1846
+ To integrate the Click To Pay checkout iFrame, create a container in your HTML code. This container serves as the placeholder for the iFrame.
1847
+
1848
+ ```html
1849
+ <div id="checkoutIframe"></div>
1850
+ ```
1851
+
1852
+ ### Initialize the Widget
1853
+
1854
+ Use the following code to initialize your widget:
1855
+
1856
+ ```javascript
1857
+ var src = new paydock.ClickToPay(
1858
+ "#checkoutIframe",
1859
+ "service_id",
1860
+ "paydock_public_key_or_access_token",
1861
+ {}, // meta
1862
+ );
1863
+ src.load();
1864
+ ```
1865
+
1866
+ ```javascript
1867
+ // ES2015 | TypeScript
1868
+ import { ClickToPay } from '@paydock/client-sdk';
1869
+ var src = new ClickToPay(
1870
+ "#checkoutIframe",
1871
+ "service_id",
1872
+ "paydock_public_key_or_access_token",
1873
+ {}, // meta
1874
+ );
1875
+ src.load();
1876
+ ```
1877
+
1878
+ *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.
1879
+
1880
+ ### Full example
1881
+
1882
+ A full example of the container and the initialized widget is as follows:
1883
+
1884
+ ```html
1885
+ <!DOCTYPE html>
1886
+ <html lang="en">
1887
+ <head>
1888
+ <meta charset="UTF-8">
1889
+ <title>Title</title>
1890
+ <style>iframe {border: 0;width: 40%;height: 300px;}</style>
1891
+ </head>
1892
+ <body>
1893
+ <div id="checkoutIframe"></div>
1894
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1895
+ <script>
1896
+ var src = new paydock.ClickToPay(
1897
+ "#checkoutIframe",
1898
+ "service_id",
1899
+ "paydock_public_key_or_access_token",
1900
+ {},
1901
+ );
1902
+ src.load();
1903
+ </script>
1904
+ </body>
1905
+ </html>
1906
+ ```
1907
+
1908
+ ## Customize your Click To Pay Checkout
1909
+
1910
+ The following is an advanced example that includes customization. You can use these methods to enhance your checkout experience.
1911
+
1912
+ ### Settings
1913
+
1914
+ ```javascript
1915
+ src.setEnv('sandbox'); // set environment
1916
+ src.hideCheckout(); // hide checkout iframe
1917
+ src.showCheckout(); // show checkout iframe
1918
+ src.on('iframeLoaded', () => {
1919
+ console.log("Initial iframe loaded");
1920
+ });
1921
+ src.on('checkoutReady', () => {
1922
+ console.log("Checkout ready to be used");
1923
+ });
1924
+ src.on('checkoutCompleted', (token) => {
1925
+ console.log(token);
1926
+ });
1927
+ src.on('checkoutError', (error) => {
1928
+ console.log(error);
1929
+ });
1930
+ ```
1931
+
1932
+ ### Full example
1933
+
1934
+ ```html
1935
+ <!DOCTYPE html>
1936
+ <html lang="en">
1937
+ <head>
1938
+ <meta charset="UTF-8">
1939
+ <title>Title</title>
1940
+ <style>iframe {border: 0;width: 40%;height: 450px;}</style>
1941
+ </head>
1942
+ <body>
1943
+ <div id="checkoutIframe"></div>
1944
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
1945
+ <script>
1946
+ var src = new paydock.ClickToPay(
1947
+ "#checkoutIframe",
1948
+ "service_id",
1949
+ "paydock_public_key_or_access_token",
1950
+ {},
1951
+ );
1952
+ src.on('iframeLoaded', () => {
1953
+ console.log("Initial iframe loaded");
1954
+ });
1955
+ src.on('checkoutReady', () => {
1956
+ console.log("Checkout ready to be used");
1957
+ });
1958
+ src.on('checkoutCompleted', (token) => {
1959
+ console.log(token);
1960
+ });
1961
+ src.on('checkoutError', (error) => {
1962
+ console.log(error);
1963
+ });
1964
+ src.load();
1965
+ </script>
1966
+ </body>
1967
+ </html>
1968
+ ```
1969
+
1970
+ ## Customize your billing address fields
1971
+
1972
+ To customize your billing address experience, Paydock uses a flag that manages whether a customer's billing address is mandatory.
1973
+ The options for this customization are NONE (default option), and POSTAL_COUNTRY or FULL.
1974
+
1975
+ ```
1976
+ var src = new paydock.ClickToPay(
1977
+ "#checkoutIframe",
1978
+ "service_id",
1979
+ "paydock_public_key_or_access_token",
1980
+ {
1981
+ "dpa_transaction_options": {
1982
+ "dpa_billing_preference": "FULL"
1983
+ }
1984
+ },
1985
+ );
1986
+ ```
1987
+
1988
+ 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.
1989
+ 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:
1990
+ 1. Disable the billing address in Paydock's Click To Pay widget.
1991
+ 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.
1992
+ 3. Send the billing address when creating the charge.
1993
+
1994
+ ```
1995
+ POST v1/charges
1996
+ {
1997
+ "amount": "10.00",
1998
+ "currency": "AUD",
1999
+ "token": "one_time_token",
2000
+ "customer": {
2001
+ "payment_source": {
2002
+ "gateway_id": "gateway_id",
2003
+ "address_line1": "address_line1",
2004
+ "address_line2": "address_line2",
2005
+ "address_city": "address_city",
2006
+ "address_postcode": "address_postcode",
2007
+ "address_state": "address_state",
2008
+ "address_country": "address_country"
2009
+ }
2010
+ },
2011
+ "shipping": {
2012
+ "address_line1": "address_line1",
2013
+ "address_line2": "address_line2",
2014
+ "address_line3": "address_line3",
2015
+ "address_city": "address_city",
2016
+ "address_postcode": "address_postcode",
2017
+ "address_state": "address_state",
2018
+ "address_country": "address_country"
2019
+ }
2020
+ }
2021
+ ```
2022
+
2023
+ ## How to customize accepted cards
2024
+
2025
+ You can send a flag `unaccepted_card_type` to block the usage of a specific card type. The available options are 'DEBIT' and 'CREDIT'.
2026
+
2027
+ ### Example code
2028
+
2029
+ The following example demonstrates how to block the card:
2030
+
2031
+ ```
2032
+ var src = new paydock.ClickToPay(
2033
+ "#checkoutIframe",
2034
+ "service_id",
2035
+ "paydock_public_key",
2036
+ {
2037
+ unaccepted_card_type: 'DEBIT'
2038
+ },
2039
+ );
2040
+ ```
2041
+
2042
+ ## Personalize the Style
2043
+
2044
+ Customize the look and feel of your UI. The following example demonstrates changes in the styling of the buttons.
2045
+
2046
+ ### Example code
2047
+
2048
+ ```
2049
+ var src = new paydock.ClickToPay(
2050
+ "#checkoutIframe",
2051
+ "service_id",
2052
+ "paydock_public_key",
2053
+ {},
2054
+ );
2055
+ src.setStyles({
2056
+ enable_src_popup: true,
2057
+ primary_button_color: 'red',
2058
+ secondary_button_color: 'red',
2059
+ primary_button_text_color: 'red',
2060
+ secondary_button_text_color: 'red',
2061
+ font_family: 'Arial',
2062
+ });
2063
+ ```
2064
+
2065
+ # Fraud prevention
2066
+
2067
+ The Fraud Prevention module allows you to add security layers to your payment workflows
2068
+ by integrating with any of our underlying fraud prevention providers.
2069
+
2070
+ ## Real time user behavior analysis
2071
+
2072
+ ### Forter
2073
+
2074
+ One of Forter's key features is our ability to track the user's real-time behavior on
2075
+ the site and use it to separate fraudsters from legitimate buyers. To take advantage
2076
+ of Forter's technology, a JavaScript snippet needs to be placed on EVERY page
2077
+ of your commerce site beginning with the homepage and up to and including the final
2078
+ "Thank you for your purchase" page.
2079
+
2080
+ The integration is simple and straightforward - you only need to configure event
2081
+ listeners and then instantiate a FraudPreventionService with your site configuration.
2082
+
2083
+ Additional setup is required in case your website uses Content Security Policies (CSP)
2084
+
2085
+ #### Forter: Code snippet
2086
+
2087
+ ```html
2088
+ <!doctype html>
2089
+ <html lang="en">
2090
+
2091
+ <head>
2092
+ <meta charset="utf-8">
2093
+ <title>Real time user behaviour anaylsis - Forter example</title>
2094
+ <base href="/">
2095
+ <meta name="viewport" content="width=device-width, initial-scale=1">
2096
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
2097
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
2098
+ </head>
2099
+
2100
+ <body>
2101
+ <main>
2102
+ <h1>Real time user behaviour anaylsis - Forter example</h1>
2103
+ <div class="forter-test">
2104
+ <h2>Forter Integration</h2>
2105
+
2106
+ <div class="status-card">
2107
+ <p>
2108
+ <strong>Integration Status:</strong>
2109
+ <span data-fraud-prevention="status-indicator" class="status pending">
2110
+ Pending
2111
+ </span>
2112
+ </p>
2113
+ <p>
2114
+ <strong>Token Value:</strong>
2115
+ <code data-fraud-prevention="forter-token">Not available</code>
2116
+ </p>
2117
+ <p data-fraud-prevention="error-container" style="display: none;">
2118
+ <strong>Error Code:</strong>
2119
+ <span data-fraud-prevention="error-code" class="error"></span>
2120
+ </p>
2121
+ </div>
2122
+ </div>
2123
+ </main>
2124
+ <script>
2125
+ const { FRAUD_PREVENTION_EVENTS, FraudPreventionService } = window.paydock
2126
+
2127
+ let token = '';
2128
+ let errorCode = '';
2129
+
2130
+ const render = () => {
2131
+ const statusIndicator = document.querySelector('[data-fraud-prevention="status-indicator"]');
2132
+ const tokenValue = document.querySelector('[data-fraud-prevention="forter-token"]');
2133
+ const errorContainer = document.querySelector('[data-fraud-prevention="error-container"]');
2134
+ const errorCodeElement = document.querySelector('[data-fraud-prevention="error-code"]');
2135
+
2136
+ if (token) {
2137
+ statusIndicator.className = 'status success';
2138
+ statusIndicator.textContent = 'Active';
2139
+ tokenValue.textContent = token;
2140
+ } else {
2141
+ statusIndicator.className = 'status pending';
2142
+ statusIndicator.textContent = 'Pending';
2143
+ tokenValue.textContent = 'Not available';
2144
+ }
2145
+
2146
+ if (errorCode) {
2147
+ errorCodeElement.textContent = errorCode;
2148
+ errorContainer.style.display = 'block';
2149
+ } else {
2150
+ errorContainer.style.display = 'none';
2151
+ }
2152
+ };
2153
+
2154
+ document.addEventListener(FRAUD_PREVENTION_EVENTS.NAMESPACE, (event) => {
2155
+ switch (event.detail.type) {
2156
+ case FRAUD_PREVENTION_EVENTS.TYPES.FINTERPRINT_TOKEN_READY: {
2157
+ token = event.detail.payload.token;
2158
+ break;
2159
+ }
2160
+ case FRAUD_PREVENTION_EVENTS.TYPES.FINGERPRINT_TOKEN_ERROR: {
2161
+ errorCode = event.detail.payload.code;
2162
+ break;
2163
+ }
2164
+ default: {
2165
+ throw new Error(
2166
+ `${FRAUD_PREVENTION_EVENTS.NAMESPACE} emitted an unsupported event: ${JSON.stringify(event.detail)}.`,
2167
+ );
2168
+ }
2169
+ }
2170
+
2171
+ render();
2172
+ });
2173
+
2174
+ const fraudPreventionServiceConfig = {
2175
+ environmentId: 'sandbox',
2176
+ mode: 'test'
2177
+ }
2178
+
2179
+ // Set "csp" to true if your website uses Content Security Policies
2180
+ const csp = false;
2181
+
2182
+ new FraudPreventionService(fraudPreventionServiceConfig)
2183
+ .withForter({
2184
+ siteId: 'example_site_id_or_subsite_id',
2185
+ csp,
2186
+ });
2187
+
2188
+ // new FraudPreventionService(fraudPreventionServiceConfig)
2189
+ // .withAccessTokenStrategy("eyJhb_access_token_example_...")
2190
+ // .withForter({
2191
+ // providerId: environment.forter.serviceId,
2192
+ // csp,
2193
+ // });
2194
+
2195
+ // new FraudPreventionService(fraudPreventionServiceConfig)
2196
+ // .withPublicKeyStrategy("pk_example_...")
2197
+ // .withForter({
2198
+ // providerId: environment.forter.serviceId,
2199
+ // csp,
2200
+ // });
2201
+ </script>
2202
+ </body>
2203
+
2204
+ </html>
2205
+ ```
2206
+
2207
+ #### Forter: Content Security Policies
2208
+
2209
+ If your site enforces Content Security Policies (CSP), make sure to:
2210
+
2211
+ 1. Set the `csp` option to `true` when invoking `withForter` on your `FraudPreventionService` instance.
2212
+ 2. Allowlist Forter's domains on `connect-src`, `script-src` and `worker-src` as shown below.
2213
+
2214
+ ```bash
2215
+ connect-src https://*.forter.com wss://cdn0.forter.com https://d2o5idwacg3gyw.cloudfront.net https://dz8rit8v72mig.cloudfront.net https://db7q4jg5rkhk8.cloudfront.net https://1.1.1.1 https://d94qwxh6czci4.cloudfront.net https://dr6vcclmzwk74.cloudfront.net https://d6rak4b14t5gp.cloudfront.net https://d3k4bt74u9esq1.cloudfront.net https://d1ezzflfzltk6e.cloudfront.net https://d3nocrch4qti4v.cloudfront.net https://duuytoqss3gu4.cloudfront.net https://df45ay5pw60dy.cloudfront.net
2216
+ script-src https://*.forter.com https://dlthst9q2beh8.cloudfront.net https://d2nww8zpyj5pk0.cloudfront.net https://d2w2nqfk3z9hdt.cloudfront.net
2217
+ worker-src blob:
2218
+ ```