簡體   English   中英

如何在PayPal Express Checkout中動態更改貨幣並傳遞其他數據

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

我想接受多種貨幣的付款方式,還希望使用Express Checkout方法以PayPal形式自動填寫地址/名稱

我嘗試過各種職位,貝寶入門,貝寶社區,但無法找到是否有可能。 目前,使用Express Checkout,我可以通過更改腳本的get參數來接收付款。

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

是否可以在以下代碼中傳遞貨幣和名稱/地址詳細信息?

<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