ReferenceError: PayPal не определяется при настройке PayPal Checkout с использованием vuejs - PullRequest
1 голос
/ 17 апреля 2020

У меня есть компонент PaypalButton. vue, и когда я реализую свою кнопку, следуя этим инструкциям: https://developer.paypal.com/docs/checkout/integrate/#

<template>
  <div>
    <div id="paypal-button-container"></div>
  </div>
</template>
    <script src="https://www.paypal.com/sdk/js?client-id=AZy2xQtNMcibA3BneS56WHoq1oqLhWdM7nsP3pwS02lr_1TOpC9Lnpp-IGbZQDS8K_xvMH5ssRmNPoDT" >
      // Required. Replace SB_CLIENT_ID with your sandbox client ID.
    </script>


<script>
import JQuery from 'jquery'
let $ = JQuery

var checkExist = setInterval(function() {
   if ($('#paypal-button-container').length) {
      console.log("Exists!");
      paypal
  .Buttons({
    createOrder: function(data, actions) {
      // This function sets up the details of the transaction, including the amount and line item details.
      return actions.order.create({
        purchase_units: [
          {
            amount: {
              value: "0.01"
            }
          }
        ]
      });
    },
    onApprove: function(data, actions) {
      // This function captures the funds from the transaction.
      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.
        alert("Transaction completed by " + details.payer.name.given_name);
      });
    }
  })
  .render("#paypal-button-container");
//This function displays Smart Payment Buttons on your web page.

      clearInterval(checkExist);
   }
}, 100); // check every 100ms


export default {
  data: () => ({
    //
  })
};
</script>



Я получаю эту ошибку ... кто-то знает, что это происходит? Я попытался импортировать скрипт PayPal в индекс. html, но то же самое происходит

enter image description here

...