@paydock/client-sdk 1.128.2 → 1.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +529 -0
  2. package/bundles/index.cjs +2661 -401
  3. package/bundles/index.cjs.d.ts +395 -194
  4. package/bundles/index.mjs +2660 -401
  5. package/bundles/index.mjs.d.ts +395 -194
  6. package/bundles/types/api/api-internal.d.ts +3 -1
  7. package/bundles/types/api/api-internal.d.ts.map +1 -1
  8. package/bundles/types/api/api-payment-source-internal.d.ts +8 -0
  9. package/bundles/types/api/api-payment-source-internal.d.ts.map +1 -0
  10. package/bundles/types/checkout/checkout.d.ts +8 -14
  11. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  12. package/bundles/types/checkout/helpers/instruction-debugger.d.ts +4 -0
  13. package/bundles/types/checkout/helpers/instruction-debugger.d.ts.map +1 -0
  14. package/bundles/types/checkout/helpers/instruction-handler.d.ts +4 -4
  15. package/bundles/types/checkout/helpers/instruction-handler.d.ts.map +1 -1
  16. package/bundles/types/checkout/images/card-icons.d.ts +10 -0
  17. package/bundles/types/checkout/images/card-icons.d.ts.map +1 -0
  18. package/bundles/types/checkout/index.d.ts +2 -1
  19. package/bundles/types/checkout/index.d.ts.map +1 -1
  20. package/bundles/types/checkout/models/checkout.models.d.ts +14 -0
  21. package/bundles/types/checkout/models/checkout.models.d.ts.map +1 -0
  22. package/bundles/types/checkout/utils/checkout-styles.util.d.ts +2 -0
  23. package/bundles/types/checkout/utils/checkout-styles.util.d.ts.map +1 -0
  24. package/bundles/types/checkout/utils/checkout-version-handler.util.d.ts +3 -0
  25. package/bundles/types/checkout/utils/checkout-version-handler.util.d.ts.map +1 -0
  26. package/bundles/types/checkout/v1/helpers/widget-structure-handler.d.ts +10 -0
  27. package/bundles/types/checkout/v1/helpers/widget-structure-handler.d.ts.map +1 -0
  28. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/index.d.ts.map +1 -1
  29. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.afterpay_checkout_form.show.d.ts +2 -2
  30. package/bundles/types/checkout/v1/instructions/instruction.afterpay_checkout_form.show.d.ts.map +1 -0
  31. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.afterpay_wallet_form.show.d.ts +3 -2
  32. package/bundles/types/checkout/v1/instructions/instruction.afterpay_wallet_form.show.d.ts.map +1 -0
  33. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.apple_pay_form.show.d.ts +3 -2
  34. package/bundles/types/checkout/v1/instructions/instruction.apple_pay_form.show.d.ts.map +1 -0
  35. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.bank_account_form.show.d.ts +2 -2
  36. package/bundles/types/checkout/v1/instructions/instruction.bank_account_form.show.d.ts.map +1 -0
  37. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.canvas_3ds.show.d.ts.map +1 -1
  38. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.card_form.show.d.ts +1 -1
  39. package/bundles/types/checkout/v1/instructions/instruction.card_form.show.d.ts.map +1 -0
  40. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.disable_payment_method_event.emit.d.ts +2 -2
  41. package/bundles/types/checkout/v1/instructions/instruction.disable_payment_method_event.emit.d.ts.map +1 -0
  42. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.fraud_service.show.d.ts.map +1 -1
  43. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.generic.show_message.d.ts +1 -1
  44. package/bundles/types/checkout/v1/instructions/instruction.generic.show_message.d.ts.map +1 -0
  45. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.google_pay_form.show.d.ts +3 -2
  46. package/bundles/types/checkout/v1/instructions/instruction.google_pay_form.show.d.ts.map +1 -0
  47. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.merchant_event.emit.d.ts +2 -2
  48. package/bundles/types/checkout/v1/instructions/instruction.merchant_event.emit.d.ts.map +1 -0
  49. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.payment_methods.show.d.ts.map +1 -1
  50. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.paypal_form.show.d.ts +2 -2
  51. package/bundles/types/checkout/v1/instructions/instruction.paypal_form.show.d.ts.map +1 -0
  52. package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.zip_checkout_form.show.d.ts +3 -2
  53. package/bundles/types/checkout/v1/instructions/instruction.zip_checkout_form.show.d.ts.map +1 -0
  54. package/bundles/types/checkout/v1/layout-widgets/additionals.d.ts +3 -0
  55. package/bundles/types/checkout/v1/layout-widgets/additionals.d.ts.map +1 -0
  56. package/bundles/types/checkout/v1/layout-widgets/default-variables.enum.d.ts.map +1 -0
  57. package/bundles/types/checkout/{layout-widgets → v1/layout-widgets}/message.d.ts +6 -6
  58. package/bundles/types/checkout/v1/layout-widgets/message.d.ts.map +1 -0
  59. package/bundles/types/checkout/v1/layout-widgets/payment-methods-template.d.ts.map +1 -0
  60. package/bundles/types/checkout/{layout-widgets → v1/layout-widgets}/payment-methods.d.ts +5 -5
  61. package/bundles/types/checkout/v1/layout-widgets/payment-methods.d.ts.map +1 -0
  62. package/bundles/types/checkout/v1/layout-widgets/payment-template.d.ts.map +1 -0
  63. package/bundles/types/checkout/v1/models/checkout.models.d.ts +5 -0
  64. package/bundles/types/checkout/v1/models/checkout.models.d.ts.map +1 -0
  65. package/bundles/types/checkout/v3/components/go-back-to-payments-button/go-back-to-payments.d.ts +4 -0
  66. package/bundles/types/checkout/v3/components/go-back-to-payments-button/go-back-to-payments.d.ts.map +1 -0
  67. package/bundles/types/checkout/v3/components/list-items-wrapper/list-items-wrapper.d.ts +8 -0
  68. package/bundles/types/checkout/v3/components/list-items-wrapper/list-items-wrapper.d.ts.map +1 -0
  69. package/bundles/types/checkout/v3/components/payment-methods-list/payment-methods-list.d.ts +3 -0
  70. package/bundles/types/checkout/v3/components/payment-methods-list/payment-methods-list.d.ts.map +1 -0
  71. package/bundles/types/checkout/v3/components/payments-wrapper/payments-wrapper.d.ts +9 -0
  72. package/bundles/types/checkout/v3/components/payments-wrapper/payments-wrapper.d.ts.map +1 -0
  73. package/bundles/types/checkout/v3/helpers/widget-structure-handler.d.ts +10 -0
  74. package/bundles/types/checkout/v3/helpers/widget-structure-handler.d.ts.map +1 -0
  75. package/bundles/types/checkout/v3/instructions/index.d.ts +4 -0
  76. package/bundles/types/checkout/v3/instructions/index.d.ts.map +1 -0
  77. package/bundles/types/checkout/v3/instructions/instruction.afterpay_checkout_form.show.d.ts +20 -0
  78. package/bundles/types/checkout/v3/instructions/instruction.afterpay_checkout_form.show.d.ts.map +1 -0
  79. package/bundles/types/checkout/v3/instructions/instruction.afterpay_wallet_form.show.d.ts +17 -0
  80. package/bundles/types/checkout/v3/instructions/instruction.afterpay_wallet_form.show.d.ts.map +1 -0
  81. package/bundles/types/checkout/v3/instructions/instruction.apple_pay_form.show.d.ts +17 -0
  82. package/bundles/types/checkout/v3/instructions/instruction.apple_pay_form.show.d.ts.map +1 -0
  83. package/bundles/types/checkout/v3/instructions/instruction.bank_account_form.show.d.ts +14 -0
  84. package/bundles/types/checkout/v3/instructions/instruction.bank_account_form.show.d.ts.map +1 -0
  85. package/bundles/types/checkout/v3/instructions/instruction.canvas_3ds.show.d.ts +12 -0
  86. package/bundles/types/checkout/v3/instructions/instruction.canvas_3ds.show.d.ts.map +1 -0
  87. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts +24 -0
  88. package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -0
  89. package/bundles/types/checkout/v3/instructions/instruction.disable_payment_method_event.emit.d.ts +21 -0
  90. package/bundles/types/checkout/v3/instructions/instruction.disable_payment_method_event.emit.d.ts.map +1 -0
  91. package/bundles/types/checkout/v3/instructions/instruction.fraud_service.show.d.ts +21 -0
  92. package/bundles/types/checkout/v3/instructions/instruction.fraud_service.show.d.ts.map +1 -0
  93. package/bundles/types/checkout/v3/instructions/instruction.generic.show_message.d.ts +27 -0
  94. package/bundles/types/checkout/v3/instructions/instruction.generic.show_message.d.ts.map +1 -0
  95. package/bundles/types/checkout/v3/instructions/instruction.google_pay_form.show.d.ts +17 -0
  96. package/bundles/types/checkout/v3/instructions/instruction.google_pay_form.show.d.ts.map +1 -0
  97. package/bundles/types/checkout/v3/instructions/instruction.merchant_event.emit.d.ts +18 -0
  98. package/bundles/types/checkout/v3/instructions/instruction.merchant_event.emit.d.ts.map +1 -0
  99. package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts +23 -0
  100. package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts.map +1 -0
  101. package/bundles/types/checkout/v3/instructions/instruction.paypal_form.show.d.ts +19 -0
  102. package/bundles/types/checkout/v3/instructions/instruction.paypal_form.show.d.ts.map +1 -0
  103. package/bundles/types/checkout/v3/instructions/instruction.saved_card_form.show.d.ts +22 -0
  104. package/bundles/types/checkout/v3/instructions/instruction.saved_card_form.show.d.ts.map +1 -0
  105. package/bundles/types/checkout/v3/instructions/instruction.zip_checkout_form.show.d.ts +19 -0
  106. package/bundles/types/checkout/v3/instructions/instruction.zip_checkout_form.show.d.ts.map +1 -0
  107. package/bundles/types/checkout/v3/models/card.model.d.ts +20 -0
  108. package/bundles/types/checkout/v3/models/card.model.d.ts.map +1 -0
  109. package/bundles/types/checkout/v3/models/checkout-styles.model.d.ts +9 -0
  110. package/bundles/types/checkout/v3/models/checkout-styles.model.d.ts.map +1 -0
  111. package/bundles/types/checkout/v3/models/checkout.models.d.ts +4 -0
  112. package/bundles/types/checkout/v3/models/checkout.models.d.ts.map +1 -0
  113. package/bundles/types/checkout/v3/models/payment-methods.model.d.ts +13 -0
  114. package/bundles/types/checkout/v3/models/payment-methods.model.d.ts.map +1 -0
  115. package/bundles/types/checkout/v3/styles/additionals.d.ts +3 -0
  116. package/bundles/types/checkout/v3/styles/additionals.d.ts.map +1 -0
  117. package/bundles/types/checkout/v3/utils/checkout-customisation-styles.util.d.ts +3 -0
  118. package/bundles/types/checkout/v3/utils/checkout-customisation-styles.util.d.ts.map +1 -0
  119. package/bundles/types/components/param.d.ts +5 -0
  120. package/bundles/types/components/param.d.ts.map +1 -1
  121. package/bundles/types/configs/env/environment.uba.d.ts +28 -0
  122. package/bundles/types/configs/env/environment.uba.d.ts.map +1 -0
  123. package/bundles/types/constants/validators.d.ts +2 -2
  124. package/bundles/types/constants/validators.d.ts.map +1 -1
  125. package/bundles/types/fraud-prevention/providers/forter/templates/{forter-snippet-2025-02-06t14:19:34z.template.d.ts → forter-snippet-20250206141934.template.d.ts} +1 -1
  126. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-20250206141934.template.d.ts.map +1 -0
  127. package/bundles/types/helper/card-scheme.d.ts +76 -0
  128. package/bundles/types/helper/card-scheme.d.ts.map +1 -0
  129. package/bundles/types/index.d.ts +1 -0
  130. package/bundles/types/index.d.ts.map +1 -1
  131. package/bundles/types/open-wallets/base/base-open-wallet.d.ts +33 -0
  132. package/bundles/types/open-wallets/base/base-open-wallet.d.ts.map +1 -0
  133. package/bundles/types/open-wallets/enum/event.enum.d.ts +8 -0
  134. package/bundles/types/open-wallets/enum/event.enum.d.ts.map +1 -0
  135. package/bundles/types/open-wallets/index.d.ts +6 -0
  136. package/bundles/types/open-wallets/index.d.ts.map +1 -0
  137. package/bundles/types/open-wallets/interfaces/base-service-config.interface.d.ts +30 -0
  138. package/bundles/types/open-wallets/interfaces/base-service-config.interface.d.ts.map +1 -0
  139. package/bundles/types/open-wallets/interfaces/base-wallet-meta.interface.d.ts +5 -0
  140. package/bundles/types/open-wallets/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
  141. package/bundles/types/open-wallets/interfaces/events.interface.d.ts +34 -0
  142. package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -0
  143. package/bundles/types/open-wallets/interfaces/index.d.ts +8 -0
  144. package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -0
  145. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts +5 -0
  146. package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts.map +1 -0
  147. package/bundles/types/open-wallets/services/index.d.ts +9 -0
  148. package/bundles/types/open-wallets/services/index.d.ts.map +1 -0
  149. package/bundles/types/open-wallets/types/index.d.ts +5 -0
  150. package/bundles/types/open-wallets/types/index.d.ts.map +1 -0
  151. package/bundles/types/open-wallets/types/ott-backend.type.d.ts +26 -0
  152. package/bundles/types/open-wallets/types/ott-backend.type.d.ts.map +1 -0
  153. package/bundles/types/open-wallets/types/ott-response.type.d.ts +8 -0
  154. package/bundles/types/open-wallets/types/ott-response.type.d.ts.map +1 -0
  155. package/bundles/types/open-wallets/types/wallet-type.type.d.ts +6 -0
  156. package/bundles/types/open-wallets/types/wallet-type.type.d.ts.map +1 -0
  157. package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -1
  158. package/bundles/types/shared-ui/components/button.d.ts +23 -0
  159. package/bundles/types/shared-ui/components/button.d.ts.map +1 -0
  160. package/bundles/types/shared-ui/components/item-info-blocks.d.ts +20 -0
  161. package/bundles/types/shared-ui/components/item-info-blocks.d.ts.map +1 -0
  162. package/bundles/types/shared-ui/components/list-item.d.ts +13 -0
  163. package/bundles/types/shared-ui/components/list-item.d.ts.map +1 -0
  164. package/bundles/types/shared-ui/components/loading-spinner.d.ts +12 -0
  165. package/bundles/types/shared-ui/components/loading-spinner.d.ts.map +1 -0
  166. package/bundles/types/shared-ui/components/message-card.d.ts +19 -0
  167. package/bundles/types/shared-ui/components/message-card.d.ts.map +1 -0
  168. package/bundles/types/shared-ui/components/svg-container.d.ts +2 -0
  169. package/bundles/types/shared-ui/components/svg-container.d.ts.map +1 -0
  170. package/bundles/types/shared-ui/components/widget-wrapper.d.ts +2 -0
  171. package/bundles/types/shared-ui/components/widget-wrapper.d.ts.map +1 -0
  172. package/bundles/types/shared-ui/models/widget-root.model.d.ts +12 -0
  173. package/bundles/types/shared-ui/models/widget-root.model.d.ts.map +1 -0
  174. package/bundles/types/shared-ui/styles/widget-root-styles.d.ts +3 -0
  175. package/bundles/types/shared-ui/styles/widget-root-styles.d.ts.map +1 -0
  176. package/bundles/types/shared-ui/utils/loading-spinner.util.d.ts +8 -0
  177. package/bundles/types/shared-ui/utils/loading-spinner.util.d.ts.map +1 -0
  178. package/bundles/types/wallet-buttons/enums.d.ts +2 -1
  179. package/bundles/types/wallet-buttons/enums.d.ts.map +1 -1
  180. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +12 -6
  181. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  182. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts +2 -2
  183. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -1
  184. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts +3 -3
  185. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -1
  186. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts +2 -2
  187. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -1
  188. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts +7 -7
  189. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -1
  190. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -1
  191. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts +2 -2
  192. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -1
  193. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts +3 -3
  194. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -1
  195. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts +6 -6
  196. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -1
  197. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +1 -0
  198. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
  199. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +20 -0
  200. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -1
  201. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -1
  202. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts +3 -0
  203. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -1
  204. package/bundles/types/widget/configuration.d.ts +2 -0
  205. package/bundles/types/widget/configuration.d.ts.map +1 -1
  206. package/bundles/types/widget/html-multi-widget.d.ts +7 -5
  207. package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
  208. package/bundles/types/widget/html-widget.d.ts +1 -0
  209. package/bundles/types/widget/html-widget.d.ts.map +1 -1
  210. package/bundles/types/widget/multi-widget.d.ts +8 -0
  211. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  212. package/bundles/widget.umd.js +2661 -401
  213. package/bundles/widget.umd.js.d.ts +395 -194
  214. package/bundles/widget.umd.js.min.d.ts +395 -194
  215. package/bundles/widget.umd.min.js +1 -1
  216. package/docs/wallet-buttons-express-examples.md +528 -0
  217. package/docs/wallet-buttons.md +1 -0
  218. package/package.json +3 -2
  219. package/bundles/types/checkout/instructions/index.d.ts +0 -3
  220. package/bundles/types/checkout/instructions/index.d.ts.map +0 -1
  221. package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +0 -1
  222. package/bundles/types/checkout/instructions/v1/instruction.afterpay_wallet_form.show.d.ts.map +0 -1
  223. package/bundles/types/checkout/instructions/v1/instruction.apple_pay_form.show.d.ts.map +0 -1
  224. package/bundles/types/checkout/instructions/v1/instruction.bank_account_form.show.d.ts.map +0 -1
  225. package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +0 -1
  226. package/bundles/types/checkout/instructions/v1/instruction.disable_payment_method_event.emit.d.ts.map +0 -1
  227. package/bundles/types/checkout/instructions/v1/instruction.generic.show_message.d.ts.map +0 -1
  228. package/bundles/types/checkout/instructions/v1/instruction.google_pay_form.show.d.ts.map +0 -1
  229. package/bundles/types/checkout/instructions/v1/instruction.merchant_event.emit.d.ts.map +0 -1
  230. package/bundles/types/checkout/instructions/v1/instruction.paypal_form.show.d.ts.map +0 -1
  231. package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +0 -1
  232. package/bundles/types/checkout/layout-widgets/additionals.d.ts +0 -3
  233. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +0 -1
  234. package/bundles/types/checkout/layout-widgets/default-variables.enum.d.ts.map +0 -1
  235. package/bundles/types/checkout/layout-widgets/message.d.ts.map +0 -1
  236. package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +0 -1
  237. package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +0 -1
  238. package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +0 -1
  239. package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +0 -1
  240. /package/bundles/types/checkout/{instructions/v1 → v1/instructions}/index.d.ts +0 -0
  241. /package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.canvas_3ds.show.d.ts +0 -0
  242. /package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.fraud_service.show.d.ts +0 -0
  243. /package/bundles/types/checkout/{instructions/v1 → v1/instructions}/instruction.payment_methods.show.d.ts +0 -0
  244. /package/bundles/types/checkout/{layout-widgets → v1/layout-widgets}/default-variables.enum.d.ts +0 -0
  245. /package/bundles/types/checkout/{layout-widgets → v1/layout-widgets}/payment-methods-template.d.ts +0 -0
  246. /package/bundles/types/checkout/{layout-widgets → v1/layout-widgets}/payment-template.d.ts +0 -0
package/README.md CHANGED
@@ -3628,6 +3628,7 @@ List of available event's name in the wallet button lifecycle
3628
3628
  | PAYMENT_SUCCESSFUL | <code>string</code> | <code>&quot;paymentSuccessful&quot;</code> |
3629
3629
  | PAYMENT_ERROR | <code>string</code> | <code>&quot;paymentError&quot;</code> |
3630
3630
  | ON_CLICK | <code>string</code> | <code>&quot;onClick&quot;</code> |
3631
+ | LOADED | <code>string</code> | <code>&quot;onWalletLoaded&quot;</code> |
3631
3632
 
3632
3633
 
3633
3634
  ## Express Wallet Buttons
@@ -3737,6 +3738,534 @@ A full description of the meta parameters for [ApplePayWalletButtonExpress](#App
3737
3738
  </html>
3738
3739
  ```
3739
3740
 
3741
+ ### Apple Pay Wallet Button Express with Shipping
3742
+
3743
+ A full description of the meta parameters for [ApplePayWalletButtonExpress](#ApplePayWalletButtonExpress) meta parameters can be found [here](#ApplePayWalletMeta). Below you will find a fully working html example.
3744
+
3745
+ ```html
3746
+ <html>
3747
+ <head>
3748
+ <title>Apple Pay Express test page</title>
3749
+ <style>
3750
+ #inputModal {
3751
+ display: none;
3752
+ position: fixed;
3753
+ left: 0;
3754
+ top: 0;
3755
+ width: 100%;
3756
+ height: 100%;
3757
+ background-color: rgba(0,0,0,0.5);
3758
+ z-index: 1000;
3759
+ }
3760
+ #inputBox {
3761
+ position: absolute;
3762
+ left: 50%;
3763
+ top: 50%;
3764
+ transform: translate(-50%, -50%);
3765
+ padding: 20px;
3766
+ background: white;
3767
+ border-radius: 5px;
3768
+ box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
3769
+ }
3770
+ </style>
3771
+ </head>
3772
+ <body>
3773
+ <table id='paymentTable'>
3774
+ <tr>
3775
+ <td>Environment:</td>
3776
+ <td>
3777
+ <select id="environment" name="environment">
3778
+ <option value="sandbox">Sandbox</option>
3779
+ <option value="local">Local</option>
3780
+ </select>
3781
+ </td>
3782
+ </tr>
3783
+ <tr>
3784
+ <td>Access Token / Public Key:</td>
3785
+ <td><input type="text" name="access" id="access" /></td>
3786
+ </tr>
3787
+ <tr>
3788
+ <td>Secret Key:</td>
3789
+ <td><input type="text" name="secretKey" id="secretKey" /></td>
3790
+ </tr>
3791
+ <tr>
3792
+ <td>Gateway Id:</td>
3793
+ <td><input type="text" name="gateway" id="gateway" /></td>
3794
+ </tr>
3795
+ <tr>
3796
+ <td>Wallet Charge - for apple pay we need to add it here because the apple pay popup does not allow us to
3797
+ inject it there but it will be used only on click. So is optional, if not provided it simulates an error
3798
+ when creating B2B wallet charge on click:</td>
3799
+ <td><input type="text" name="token" id="token" /></td>
3800
+ </tr>
3801
+ <tr>
3802
+ <td>Charge id - Used to update the charge with the shipping data/shipping options</td>
3803
+ <td><input type="text" name="chargeId" id="chargeId" /></td>
3804
+ </tr>
3805
+ <tr>
3806
+ <td>Meta:</td>
3807
+ <td><textarea id="meta" name="meta" rows="4" cols="50"></textarea></td>
3808
+ </tr>
3809
+ </table>
3810
+ <div id="button">
3811
+ <input type="submit" name="event" value="Send" class="button" onclick="return loadButtons()" />
3812
+ </div>
3813
+ <div id="widget"></div>
3814
+ </body>
3815
+
3816
+ <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js"></script>
3817
+ <script type=text/javascript>
3818
+ // Environment enum with API URLs
3819
+ const ENVIRONMENTS = {
3820
+ PRODUCTION: {
3821
+ name: 'production',
3822
+ apiUrl: 'https://api.paydock.com'
3823
+ },
3824
+ SANDBOX: {
3825
+ name: 'sandbox',
3826
+ apiUrl: 'https://api-sandox.paydock.com'
3827
+ }
3828
+ };
3829
+
3830
+ // Function to get API URL based on selected environment
3831
+ function getApiUrl(environmentName) {
3832
+ const env = Object.values(ENVIRONMENTS).find(env => env.name === environmentName);
3833
+ return env ? env.apiUrl : ENVIRONMENTS.SANDBOX.apiUrl;
3834
+ }
3835
+
3836
+ // Function to get current base URL from selected environment
3837
+ function getBaseUrl() {
3838
+ const selectedEnvironment = document.getElementById("environment").value;
3839
+ return getApiUrl(selectedEnvironment);
3840
+ }
3841
+
3842
+ async function updateCharge(secretKey, chargeId, updateData) {
3843
+ try {
3844
+ const baseUrl = getBaseUrl();
3845
+ const response = await fetch(`${baseUrl}/v1/charges/wallet/${chargeId}`, {
3846
+ method: 'PUT',
3847
+ headers: {
3848
+ 'x-user-secret-key': secretKey,
3849
+ 'Content-Type': 'application/json',
3850
+ },
3851
+ body: JSON.stringify(updateData),
3852
+ });
3853
+ const data = await response.json();
3854
+ console.log('Update charge response:', data);
3855
+ return data;
3856
+ } catch (error) {
3857
+ console.error('Error updating charge:', error);
3858
+ }
3859
+ };
3860
+
3861
+ const shippingOptions = [
3862
+ {
3863
+ label: "Test 1",
3864
+ detail: "This is a test 1 shipping methods",
3865
+ amount: 10,
3866
+ id: "randomId1",
3867
+ date_components_range: {
3868
+ start_date_components: {
3869
+ years: 0,
3870
+ months: 0,
3871
+ days: 5,
3872
+ hours: 0,
3873
+ },
3874
+ end_date_components: {
3875
+ years: 0,
3876
+ months: 0,
3877
+ days: 10,
3878
+ hours: 0,
3879
+ }
3880
+ }
3881
+ },
3882
+ {
3883
+ label: "Test 2",
3884
+ detail: "This is a test 2 shipping methods",
3885
+ amount: 14,
3886
+ id: "randomId2",
3887
+ date_components_range: {
3888
+ start_date_components: {
3889
+ years: 0,
3890
+ months: 0,
3891
+ days: 6,
3892
+ hours: 0,
3893
+ },
3894
+ end_date_components: {
3895
+ years: 0,
3896
+ months: 0,
3897
+ days: 12,
3898
+ hours: 0,
3899
+ },
3900
+ },
3901
+ },
3902
+ ];
3903
+
3904
+ function loadButtons() {
3905
+ const secretKey = document.getElementById("secretKey").value;
3906
+ if (!secretKey) {
3907
+ alert("Please enter the secret key.");
3908
+ return false;
3909
+ }
3910
+
3911
+ let button = new paydock.ApplePayWalletButtonExpress(
3912
+ "#widget",
3913
+ document.getElementById("access").value,
3914
+ document.getElementById("gateway").value,
3915
+ JSON.parse(document.getElementById("meta").value),
3916
+ );
3917
+
3918
+ button.setEnv(document.getElementById("environment").value);
3919
+
3920
+ let charge_id;
3921
+
3922
+ button.onClick(async (data) => {
3923
+ const { token, chargeId } = await getUserInput();
3924
+ charge_id = chargeId;
3925
+ return token;
3926
+ });
3927
+
3928
+ const amount = JSON.parse(document.getElementById('meta').value).amount;
3929
+
3930
+ button.onUnavailable(function() {
3931
+ console.log("Button unavailable");
3932
+ });
3933
+ button.onError(function(error) {
3934
+ console.log("On Error Callback", error);
3935
+ });
3936
+ button.onPaymentSuccessful(function(data) {
3937
+ console.log("Payment successful");
3938
+ console.log(data);
3939
+ });
3940
+ button.onPaymentError(function(err) {
3941
+ console.log("Payment error");
3942
+ console.log(err);
3943
+ });
3944
+ button.onPaymentInReview(function(data) {
3945
+ console.log("The payment is on fraud review");
3946
+ console.log(data);
3947
+ });
3948
+ button.onCheckoutClose(() => {
3949
+ console.log("Checkout closed");
3950
+ });
3951
+
3952
+ button.onShippingAddressChange(async function(data) {
3953
+ console.log("Shipping address has been updated", data);
3954
+
3955
+ const defaultOption = shippingOptions[0];
3956
+
3957
+ const updateData = {
3958
+ shipping: {
3959
+ ...data.data,
3960
+ amount: defaultOption.amount,
3961
+ method: defaultOption.id,
3962
+ options: shippingOptions,
3963
+ },
3964
+ amount: amount + defaultOption.amount
3965
+ };
3966
+
3967
+ const res = await updateCharge(secretKey, charge_id, updateData);
3968
+ return { token: res.resource.data.token };
3969
+ });
3970
+
3971
+ button.onShippingOptionsChange(async function(data) {
3972
+ console.log("Shipping options have been updated", JSON.stringify(data, null, 2));
3973
+
3974
+ const updateData = {
3975
+ shipping: {
3976
+ method: data.data.shipping_option_id,
3977
+ amount: data.data.amount,
3978
+ },
3979
+ amount: amount + Number(data.data.amount)
3980
+ };
3981
+
3982
+ const res = await updateCharge(secretKey, charge_id, updateData);
3983
+ return { token: res.resource.data.token };
3984
+ });
3985
+
3986
+ button.load()
3987
+
3988
+ document.getElementById("paymentTable").style.display = "none";
3989
+ document.getElementById("button").style.display = "none";
3990
+ return true;
3991
+ }
3992
+
3993
+ function getUserInput(message) {
3994
+ return new Promise((resolve, reject) => {
3995
+ console.log("Simulating B2B call to generate token...");
3996
+ setTimeout(() => {
3997
+ const token = document.getElementById("token").value;
3998
+ const chargeId = document.getElementById("chargeId").value;
3999
+ if (token && chargeId)
4000
+ return resolve({ token, chargeId });
4001
+ return reject("No token or Charge Id provided");
4002
+ }, 2000);
4003
+ });
4004
+ }
4005
+
4006
+ document.addEventListener('DOMContentLoaded', () => {
4007
+ // Function to get the value of a query parameter by name
4008
+ function getQueryParam(name) {
4009
+ const urlParams = new URLSearchParams(window.location.search);
4010
+ return urlParams.get(name);
4011
+ }
4012
+
4013
+ // Function to set input values from URL parameters
4014
+ function setInputValues() {
4015
+ const meta = {
4016
+ apple_pay_capabilities: ['credentials_available', 'credentials_status_unknown', 'credentials_unavailable'],
4017
+ amount_label: 'TOTAL',
4018
+ country: 'AU',
4019
+ currency: 'AUD',
4020
+ amount: 10,
4021
+ shipping_editing_mode: 'available', // available, store_pickup
4022
+ required_shipping_contact_fields: [
4023
+ 'postalAddress',
4024
+ 'name',
4025
+ 'phone',
4026
+ 'email',
4027
+ ],
4028
+ shipping: {
4029
+ amount: 5,
4030
+ address_line1: "Address Line 1",
4031
+ address_city: "Test Locality",
4032
+ address_state: "NSW",
4033
+ address_country: "Australia",
4034
+ address_country_code: "AU",
4035
+ address_postcode: "3000",
4036
+ contact: {
4037
+ phone: "+61400245562",
4038
+ email: "qa.notifications+appleid@paydock.com",
4039
+ first_name: "QA",
4040
+ last_name: "QA",
4041
+ },
4042
+ options: shippingOptions,
4043
+ },
4044
+ // merchant_capabilities: ['supports3DS', 'supportsEMV', 'supportsCredit', 'supportsDebit'],
4045
+ // supported_networks: ['visa', 'masterCard', 'amex', 'chinaUnionPay', 'discover', 'interac', 'jcb', 'privateLabel'],
4046
+ // required_billing_contact_fields: ['email', 'name', 'phone', 'postalAddress', 'phoneticName'],
4047
+ // required_shipping_contact_fields: ['email', 'phone' /*, 'name', 'postalAddress', 'phoneticName'*/],
4048
+ // supported_countries: [],
4049
+ // style: {
4050
+ // button_type: 'continue',
4051
+ // button_style: 'white',
4052
+ // },
4053
+ };
4054
+ document.getElementById('meta').value = JSON.stringify(meta, null, 2);
4055
+ }
4056
+
4057
+ setInputValues();
4058
+ });
4059
+ </script>
4060
+ </html>
4061
+ ```
4062
+
4063
+ When supporting shipping, the method `onShippingAddressChange` and `onShippingOptionsChange` are required to update the shipping address and options.
4064
+
4065
+ ```javascript
4066
+ button.onShippingAddressChange(async function(data) {
4067
+ console.log("Shipping address has been updated", data);
4068
+
4069
+ const updateData = {
4070
+ shipping: {
4071
+ ...data.data,
4072
+ amount: defaultOption.amount,
4073
+ method: defaultOption.id,
4074
+ options: shippingOptions,
4075
+ },
4076
+ amount: amount + defaultOption.amount
4077
+ };
4078
+
4079
+ const res = await updateCharge(secretKey, charge_id, updateData);
4080
+ return { token: res.resource.data.token };
4081
+ });
4082
+
4083
+ button.onShippingOptionsChange(async function(data) {
4084
+ console.log("Shipping options have been updated", data);
4085
+
4086
+ const updateData = {
4087
+ shipping: {
4088
+ method: data.data.shipping_option_id,
4089
+ amount: data.data.amount,
4090
+ },
4091
+ amount: amount + Number(data.data.amount)
4092
+ };
4093
+
4094
+ const res = await updateCharge(secretKey, charge_id, updateData);
4095
+ return { token: res.resource.data.token };
4096
+ });
4097
+ ```
4098
+
4099
+ The `updateCharge` method is a custom method to update the charge with the shipping data/shipping options. It is not part of the Paydock SDK and it should use the Paydock's public API to update the charge from the merchant's server.
4100
+
4101
+ ### Supported Cases
4102
+ #### Injected Shipping Address, non-editable by the customer
4103
+
4104
+ This is the case where the shipping address is injected by the merchant and is not editable by the customer. The customer can only select the shipping option.
4105
+
4106
+ The required meta parameters for this case are:
4107
+ - shipping_editing_mode: 'store_pickup'
4108
+ - required_shipping_contact_fields: ['postalAddress'] <-- At least one of the fields is required so the shipping address is shown at Apple Pay.
4109
+
4110
+ ```javascript
4111
+ meta: {
4112
+ apple_pay_capabilities: ['credentials_available', 'credentials_status_unknown', 'credentials_unavailable'],
4113
+ amount_label: 'TOTAL',
4114
+ country: 'AU',
4115
+ currency: 'AUD',
4116
+ amount: 10,
4117
+ shipping_editing_mode: 'store_pickup',
4118
+ required_shipping_contact_fields: [
4119
+ 'postalAddress', // At least one of the fields is required so the shipping address is shown at Apple Pay.
4120
+ 'name',
4121
+ 'phone',
4122
+ 'email',
4123
+ ],
4124
+ shipping: {
4125
+ amount: 5,
4126
+ address_line1: "Address Line 1",
4127
+ address_city: "Test Locality",
4128
+ address_state: "NSW",
4129
+ address_country: "Australia",
4130
+ address_country_code: "AU",
4131
+ address_postcode: "3000",
4132
+ contact: {
4133
+ phone: "+61400245562",
4134
+ email: "qa.notifications+appleid@paydock.com",
4135
+ first_name: "QA",
4136
+ last_name: "QA",
4137
+ },
4138
+ options: [
4139
+ {
4140
+ label: "Test 1",
4141
+ detail: "This is a test 1 shipping methods",
4142
+ amount: 10,
4143
+ id: "randomId1",
4144
+ date_components_range: {
4145
+ start_date_components: {
4146
+ years: 0,
4147
+ months: 0,
4148
+ days: 5,
4149
+ hours: 0,
4150
+ },
4151
+ end_date_components: {
4152
+ years: 0,
4153
+ months: 0,
4154
+ days: 10,
4155
+ hours: 0,
4156
+ }
4157
+ }
4158
+ }
4159
+ ],
4160
+ },
4161
+ }
4162
+ ```
4163
+
4164
+ This is the case where the shipping address is injected by the merchant and is editable by the customer. The customer can edit the shipping address and select the shipping option.
4165
+
4166
+ The required meta parameters for this case are:
4167
+ - shipping_editing_mode: 'available'
4168
+ - required_shipping_contact_fields: ['postalAddress'] <-- At least one of the fields is required so the shipping address is shown at Apple Pay.
4169
+
4170
+ ```javascript
4171
+ meta: {
4172
+ apple_pay_capabilities: ['credentials_available', 'credentials_status_unknown', 'credentials_unavailable'],
4173
+ amount_label: 'TOTAL',
4174
+ country: 'AU',
4175
+ currency: 'AUD',
4176
+ amount: 10,
4177
+ shipping_editing_mode: 'available',
4178
+ required_shipping_contact_fields: [
4179
+ 'postalAddress', // At least one of the fields is required so the shipping address is shown at Apple Pay.
4180
+ 'name',
4181
+ 'phone',
4182
+ 'email',
4183
+ ],
4184
+ shipping: {
4185
+ amount: 5,
4186
+ address_line1: "Address Line 1",
4187
+ address_city: "Test Locality",
4188
+ address_state: "NSW",
4189
+ address_country: "Australia",
4190
+ address_country_code: "AU",
4191
+ address_postcode: "3000",
4192
+ contact: {
4193
+ phone: "+61400245562",
4194
+ email: "qa.notifications+appleid@paydock.com",
4195
+ first_name: "QA",
4196
+ last_name: "QA",
4197
+ },
4198
+ options: [
4199
+ {
4200
+ label: "Test 1",
4201
+ detail: "This is a test 1 shipping methods",
4202
+ amount: 10,
4203
+ id: "randomId1",
4204
+ date_components_range: {
4205
+ start_date_components: {
4206
+ years: 0,
4207
+ months: 0,
4208
+ days: 5,
4209
+ hours: 0,
4210
+ },
4211
+ end_date_components: {
4212
+ years: 0,
4213
+ months: 0,
4214
+ days: 10,
4215
+ hours: 0,
4216
+ }
4217
+ }
4218
+ }
4219
+ ],
4220
+ },
4221
+ }
4222
+ ```
4223
+
4224
+ #### Shipping address editable by the customer
4225
+
4226
+ This is the case where the shipping address is not injected by the merchant and is editable by the customer. The customer can edit the shipping address and select the shipping option.
4227
+
4228
+ The required meta parameters for this case are:
4229
+ - shipping_editing_mode: 'available'
4230
+ - required_shipping_contact_fields: ['postalAddress'] <-- At least one of the fields is required so the shipping address is shown at Apple Pay.
4231
+
4232
+ ```javascript
4233
+ meta: {
4234
+ apple_pay_capabilities: ['credentials_available', 'credentials_status_unknown', 'credentials_unavailable'],
4235
+ amount_label: 'TOTAL',
4236
+ country: 'AU',
4237
+ currency: 'AUD',
4238
+ amount: 10,
4239
+ shipping_editing_mode: 'available',
4240
+ required_shipping_contact_fields: [
4241
+ 'postalAddress', // At least one of the fields is required so the shipping address is shown at Apple Pay.
4242
+ 'name',
4243
+ 'phone',
4244
+ 'email',
4245
+ ],
4246
+ }
4247
+ ```
4248
+
4249
+ When the the customer selects an address, the `onShippingAddressChange` method is called with the shipping address data. If the merchant wants to update the charge with the shipping address, it should update the charge using Paydock's public API Update Charge method with the shipping address data.
4250
+
4251
+ It can include the shipping options in the update data, that will be used to show the shipping options in the Apple Pay popup.
4252
+
4253
+ ```javascript
4254
+ button.onShippingAddressChange(async function(data) {
4255
+ console.log("Shipping address has been updated", data);
4256
+
4257
+ const updateData = {
4258
+ shipping: {
4259
+ ...data.data,
4260
+ amount: defaultOption.amount,
4261
+ method: defaultOption.id,
4262
+ options: shippingOptions,
4263
+ },
4264
+ amount: amount + defaultOption.amount
4265
+ };
4266
+ });
4267
+ ```
4268
+
3740
4269
  ### Paypal Wallet Button Express
3741
4270
  A full description of the meta parameters for [PaypalWalletButtonExpress](#PaypalWalletButtonExpress) meta parameters can be found [here](#PaypalWalletMeta). Below you will find a fully working html example.
3742
4271