app/Plugin/AmazonPayV2_42/Resource/template/default/Cart/amazon_pay_js.twig line 1

Open in your IDE?
  1. {#
  2. Amazon Pay V2 for EC-CUBE4.2
  3. Copyright(c) 2023 EC-CUBE CO.,LTD. all rights reserved.
  4. https://www.ec-cube.co.jp/
  5. This program is not free software.
  6. It applies to terms of service.
  7. #}
  8. <script src="{{ AmazonPayV2Api.checkout_script_url }}"></script>
  9. {% for CartIndex,Cart in Carts %}
  10.     {% set cartKey = Cart.cart_key %}
  11.     {% set SaleType = Cart.CartItems[0].ProductClass.SaleType.id %}
  12.     {% if SaleType in AmazonSaleTypes %}
  13.     <script>
  14.     // ボタンを設置
  15.     $('#form_cart > div.ec-cartRole__actions').eq("{{ loop.index0 }}").after($("#AmazonPayJS{{ cartKey }}"));
  16.     $(function () {
  17.         amazon.Pay.renderButton('#AmazonPayButton{{ cartKey }}', {
  18.             // set checkout environment
  19.             merchantId: '{{ AmazonPayV2Config.seller_id }}',
  20.             ledgerCurrency: 'JPY',
  21.             {% if AmazonPayV2Config.env == eccube_config.amazon_pay_v2.env.sandbox %}
  22.             sandbox: true,
  23.             {% endif %}
  24.             // customize the buyer experience
  25.             checkoutLanguage: 'ja_JP',
  26.             productType: 'PayAndShip',
  27.             placement: 'Cart',
  28.             buttonColor: '{{ AmazonPayV2Config.cart_button_color }}',
  29.             // configure Create Checkout Session request
  30.             createCheckoutSessionConfig: {
  31.                 payloadJSON: '{{ cart[cartKey].payload | raw }}', // string generated in step 2
  32.                 signature: '{{ cart[cartKey].signature }}', // signature generated in step 3
  33.                 publicKeyId: '{{ AmazonPayV2Config.public_key_id }}'
  34.             }
  35.         });
  36.     });
  37.     </script>
  38.     {% else %}
  39.         <script>
  40.             $("#AmazonPayButton{{ cartKey }}").remove();
  41.         </script>
  42.     {% endif %}
  43. {% endfor %}