Paypal按钮的价格因国家而异

Paypal按钮的价格因国家而异,paypal,currency,country-codes,Paypal,Currency,Country Codes,我有一个网站,我想包括一个贝宝按钮,以便客户可以直接在网站上购买,唯一的问题是,我需要相同的按钮,以不同的显示(不同的价格和货币)在不同的国家 如何做到这一点?我建议使用地理位置JavaScript代码。但是,用户在加载页面时必须授予权限。您可以在这里查看: 或参见示例代码: <p id="demo">Click the button to get your coordinates:</p> <button onclick="getLocation()">Tr

我有一个网站,我想包括一个贝宝按钮,以便客户可以直接在网站上购买,唯一的问题是,我需要相同的按钮,以不同的显示(不同的价格和货币)在不同的国家


如何做到这一点?

我建议使用地理位置JavaScript代码。但是,用户在加载页面时必须授予权限。您可以在这里查看:

或参见示例代码:

<p id="demo">Click the button to get your coordinates:</p>
<button onclick="getLocation()">Try It</button>
<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
   }
function showPosition(position)       {
  x.innerHTML="Latitude: " + position.coords.latitude + 
  "<br>Longitude: " + position.coords.longitude;    
  }
</script>

单击按钮获取您的坐标:

试试看 var x=document.getElementById(“演示”); 函数getLocation() { if(导航器.地理位置) { navigator.geolocation.getCurrentPosition(showPosition); } else{x.innerHTML=“此浏览器不支持地理位置。”;} } 功能显示位置(位置){ x、 innerHTML=“纬度:”+position.coords.Latitude+ “
经度:”+position.coords.Longitude; }
然后,您可以将lat和long数据传递给api,以查找他们居住的城市/国家。
希望有帮助

我建议使用地理位置JavaScript代码。但是,用户在加载页面时必须授予权限。您可以在这里查看:

或参见示例代码:

<p id="demo">Click the button to get your coordinates:</p>
<button onclick="getLocation()">Try It</button>
<script>
var x=document.getElementById("demo");
function getLocation()
  {
  if (navigator.geolocation)
    {
    navigator.geolocation.getCurrentPosition(showPosition);
    }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
   }
function showPosition(position)       {
  x.innerHTML="Latitude: " + position.coords.latitude + 
  "<br>Longitude: " + position.coords.longitude;    
  }
</script>

单击按钮获取您的坐标:

试试看 var x=document.getElementById(“演示”); 函数getLocation() { if(导航器.地理位置) { navigator.geolocation.getCurrentPosition(showPosition); } else{x.innerHTML=“此浏览器不支持地理位置。”;} } 功能显示位置(位置){ x、 innerHTML=“纬度:”+position.coords.Latitude+ “
经度:”+position.coords.Longitude; }
然后,您可以将lat和long数据传递给api,以查找他们居住的城市/国家。
希望有帮助

PayPal将为您进行货币转换,但如果您需要在不同的国家/地区(ala移动应用商店)设置不同的价格,则您必须自己创建不同的按钮-每个国家/地区/货币对应一个按钮。然后,根据区域设置或请求URL,您将显示正确的按钮代码。

PayPal将为您进行货币转换,但如果您需要在不同的国家/地区(ala移动应用商店)设置不同的价格,则您必须自己创建不同的按钮-每个国家/地区对应一个按钮。然后,根据区域设置或请求URL,您将显示正确的按钮代码