airwallex.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <!-- s-->
  6. <title></title>
  7. <style type="text/css">
  8. body{
  9. width: 50%;
  10. margin: auto;
  11. }
  12. .pay_b {
  13. font-size: 12px;
  14. font-family: Microsoft YaHei;
  15. font-weight: bold;
  16. line-height: 28px;
  17. color: #000000;
  18. margin-right: 10px;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div class="pay">
  24. <div class="paytwo">
  25. <div class="pay_b">
  26. <span>商品:</span>
  27. <span style="color:#FB5E5E ;">{$result['goods']}</span>
  28. </div>
  29. </div>
  30. <div id="dropIn"></div>
  31. </div>
  32. </body>
  33. <script src="https://checkout.airwallex.com/assets/elements.bundle.min.js"></script>
  34. <script>
  35. var id = "{$result['id']}"
  36. var client_secret = "{$result['client_secret']}"
  37. var currency = "{$result['currency']}"
  38. Airwallex.init({
  39. env: 'prod', // Setup which Airwallex env('demo' | 'prod') to integrate with
  40. origin: window.location.origin, // Set up your event target to receive the browser events message
  41. });
  42. const element = Airwallex.createElement('dropIn', {
  43. intent_id: id,
  44. client_secret: client_secret,
  45. currency:currency,
  46. });
  47. element.mount('dropIn'); // Injects iframe into the Drop-in Element container
  48. window.addEventListener('onReady', (event) => {
  49. /*
  50. ... Handle event
  51. */
  52. // window.alert(event.detail);
  53. console.log(event)
  54. });
  55. window.addEventListener('onSuccess', (event) => {
  56. // Handle event on success
  57. console.log(event)
  58. });
  59. window.addEventListener('onError', (event) => {
  60. // Handle event on error
  61. console.log(event)
  62. });
  63. </script>
  64. </html>