title: Django python paypalrestsdk - No 'Access-Control-Allow-Origin' and ppxo_unhandled_error error
body: <p>Im trying to implement paypal with Django using paypalrestsdk.</p>
  
  <p>I followed the code example from the example here: <a href="https://prettyprinted.com/blog/1125955/creating-paypal-express-payments-in-flask" rel="nofollow noreferrer">https://prettyprinted.com/blog/1125955/creating-paypal-express-payments-in-flask</a></p>
  
  <p>But there is this error:
  <img src="https://i.imgur.com/oahba2u.png"></p>
  
  <p>here are my code snippets of template .html, views.py and urls.py
  <a href="https://gist.github.com/axilaris/1e6e34ba5915abceb0dbd06d46baf08b" rel="nofollow noreferrer">https://gist.github.com/axilaris/1e6e34ba5915abceb0dbd06d46baf08b</a></p>
  
  <p>here is template code that shows the button:</p>
  
  <pre><code>&lt;div id="paypal-button"&gt;&lt;/div&gt;
  &lt;script src="https://www.paypalobjects.com/api/checkout.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
      var CREATE_PAYMENT_URL  = 'http://127.0.0.1:8000/payment_create';
      var EXECUTE_PAYMENT_URL = 'http://127.0.0.1:8000/payment_execute';                        
  
      paypal.Button.render({
  
          env: 'sandbox', // Or 'sandbox'
  
          commit: true, // Show a 'Pay Now' button
  
          payment: function() {
              console.log("payment function")
              return paypal.request.post(CREATE_PAYMENT_URL).then(function(data) {
                  console.log("return create payment")
                  return data.paymentID;
              });
          },
  
          onAuthorize: function(data) {
              return paypal.request.post(EXECUTE_PAYMENT_URL, {
                  paymentID: data.paymentID,
                  payerID:   data.payerID
              }).then(function(res) {
  
                  console.log(res.success)
                  // The payment is complete!
                  // You can now show a confirmation message to the customer
              });
          }
  
      }, '#paypal-button');
  &lt;/script&gt;     
  </code></pre>
  
  <p>What is the problem, how to fix it and what is ppxo_unhandled_error ?</p>
  
  <p>Alternatively, whats the best way to implement paypal properly on Django. (I'm just not seeing any good docs on this) </p>
  
  <pre><code>Django==1.11.7
  </code></pre>