简体   繁体   中英

How to dynamically change currency & pass other data in PayPal Express Checkout

I want to accept payment in Multiple currencies & also autofill the Address/Name in PayPal form using Express Checkout method

I have tried going through various posts, paypal getting started, paypal community, but not able to find if it possible. Currently, using Express Checkout I'm able to receive payment on changing the get parameter of the script.

<script src="https://www.paypal.com/sdk/js?client-id=valueOfClientID&currency=GBP"> </script>

Is is possible to pass the currency & name/address details in below code?

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '24'
          }
        }]
      });
    },
    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
        alert('Transaction completed by ' + details.payer.name.given_name);
        // Call your server to save the transaction
        return fetch('/paypal-transaction-complete', {
          method: 'post',
          headers: {
            'content-type': 'application/json'
          },
          body: JSON.stringify({
            orderID: data.orderID
          })
        });
      });
    }
  }).render('#paypal-button-container');
</script>

基于货币,将脚本动态注入到页面中,并按链接中所述传递地址对象

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM