Apple pay button on mendix page.

0
Hi All,   I need to implement apple pay in my project. The very first requirement is I should show the apple pay button on safari browser but not in other browser after checking apple pay JS availability. as first thing, I could do it using simple HTML+JS in a simple html file. below is the reference. How can I integrate the same on my mendix page. I tried with html snippets and JS snippets but did not work. Please help me if any one knows.   <!DOCTYPE html> <html>     <head>         <script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"></script>         <style>             apple-pay-button {               --apple-pay-button-width: 140px;               --apple-pay-button-height: 30px;               --apple-pay-button-border-radius: 5px;               --apple-pay-button-padding: 5px 0px;               display: initial;             }             </style>     </head>     <body>         <apple-pay-button id="applebtn" buttonstyle="black" type="continue" locale="en-US"></apple-pay-button>         <script type="text/javascript">             const btn = document.getElementById('applebtn');         if (window.ApplePaySession) {             btn.style.display= 'block';                  }          else          {             btn.style.display= 'none';                            }         </script>     </body> </html>
asked
2 answers
0

Two things need to happen:

  • the scripts needs to trigger; The html-javascript snippet can certainly do this.
  • the style.display needs to change for the button. const btn will probably be ok. Maybe ApplePaySession is false. You can check this using the Inspector (F12) and debug that script. 

Do they both not work, or just (part of) one of them?

  

*Edited*

The html-snippet, added to any part of a page, having this settings, should trigger the alert ‘hi’ on page-load, and trigger the script to show or hide your button:

 

answered
0

Hi Swamy Nandikam,

 

Can you please refer this link which will helps you definitely in addition I think 

https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_javascript

 

answered