render-pay-button.php
45 lines
| 1 | <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" |
| 2 | crossorigin="anonymous"> |
| 3 | |
| 4 | <script src="<?php echo $config->get('payment_script') ?>"></script> |
| 5 | |
| 6 | <script type="text/javascript" charset="utf-8"> |
| 7 | document.addEventListener("DOMContentLoaded", () => { |
| 8 | |
| 9 | amazon.Pay.renderButton('#AmazonPayButton', { |
| 10 | |
| 11 | // set checkout environment |
| 12 | merchantId: '<?php echo $config->get('merchant_id'); ?>', |
| 13 | publicKeyId: '<?php echo $config->get('public_key_id'); ?>', |
| 14 | ledgerCurrency: '<?php echo $config->get('ledger_currency'); ?>', |
| 15 | |
| 16 | // customize the buyer experience |
| 17 | productType: 'PayOnly', |
| 18 | placement: 'Cart', |
| 19 | buttonColor: 'Gold', |
| 20 | estimatedOrderAmount: { |
| 21 | "amount": '<?php echo $total_amount; ?>', |
| 22 | "currencyCode": '<?php echo $currency; ?>' |
| 23 | }, |
| 24 | |
| 25 | // configure Create Checkout Session request |
| 26 | createCheckoutSessionConfig: { |
| 27 | payloadJSON: '<?php echo $payload; ?>', |
| 28 | signature: '<?php echo $signature; ?>', |
| 29 | algorithm: 'AMZN-PAY-RSASSA-PSS-V2' |
| 30 | } |
| 31 | }); |
| 32 | }) |
| 33 | </script> |
| 34 | |
| 35 | <!-- AmazonPay Button --> |
| 36 | <div class="d-flex align-items-center justify-content-center" style="min-height: 80vh;"> |
| 37 | <div> |
| 38 | <p> Click the button to initiate the Amazon Pay payment.</p> |
| 39 | |
| 40 | <div id="AmazonPayButton"></div> |
| 41 | <a href="<?php echo $config->get('cancel_url'); ?>" class="d-flex align-items-center justify-content-center m-5"> |
| 42 | Cancel |
| 43 | </a> |
| 44 | </div> |
| 45 | </div> |