简体   繁体   English

如何在PayPal Express Checkout中动态更改货币并传递其他数据

[英]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 我想接受多种货币的付款方式,还希望使用Express Checkout方法以PayPal形式自动填写地址/名称

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. 目前,使用Express Checkout,我可以通过更改脚本的get参数来接收付款。

<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>

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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