【问题标题】:Paypal buttons with different prices depending on country不同国家/地区价格不同的 Paypal 按钮
【发布时间】:2013-03-19 03:55:18
【问题描述】:

我有一个网站,我想包含一个 PayPal 按钮,以便客户可以直接在网站上购买,唯一的问题是我需要同一个按钮在不同国家/地区以不同的方式显示(具有不同的价格和货币)。

我该怎么做?

【问题讨论】:

    标签: paypal currency country-codes


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我建议使用地理定位 JavaScript 代码。但是,用户在加载页面时必须授予权限。你可以看这里:http://www.w3schools.com/html/html5_geolocation.asp

      或查看示例代码:

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

      然后,您可以将经纬度数据传递给 api,以查找他们居住的城市/国家。 希望对您有所帮助!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-06-12
        • 1970-01-01
        • 2015-09-30
        • 1970-01-01
        • 1970-01-01
        • 2015-09-30
        • 2011-02-20
        • 2017-12-18
        相关资源
        最近更新 更多