BigCommerce:限制基于国家/地区的付款选项

时间:2017-04-03 16:51:59

标签: payment bigcommerce countries limiting gateways

简短版本:
我想只接受Paypal作为美国境内48岁以下人士的付款方式。

我不知道这不是支付选项中已经安装在bigcommerce中的功能,而是根据下拉菜单中的选项隐藏这些支付网关。

不幸的是,我不太了解大型商业,但我已经设法在其他购物车上编码,例如x-cart没有太多问题。有没有人经历过这个或者有我的修复?

目前我们已经通过我们的商家禁止向美国以外的任何人付款,并在注册您的付款帐户时在我们的网站上放置了横幅,但人们将坐在那里尝试进入他们的CC信息12000次充斥我的邮箱与捕获警报-_-
提前致谢

Currnetly运行Cornerstone 1.5主题

1 个答案:

答案 0 :(得分:0)

一种可能的解决方案是使用JavaScript来读取运费或结算国家/地区,然后显示相关的付款方式。

这是一个概念性示例,假设您知道如何选择特定元素(使用浏览器的开发人员工具来确定目标元素的正确选择器)。

/**
 * This example binds a change event to the shipping country input dropdown, 
 * so whenever a country is selected or changed, this code will show the relevant
 * payment methods. 
 * NOTE: The change method here might not work if the payment methods section
 * is inaccessible at the time of country selection, at which point you should
 * modify the code to read the country at the time of DOM load for the payment methods.
 */

//** Whenever the shipping country is selected or changed **//
$("#shipping_country_dropdown").change(function() {
  // Hide/Clear all visible payment options:
  $(".payment_methods :input").each(function() {
    $(this).hide();
  });
  togglePaymentMethodsByCountry($(this).find('option:selected').text());
});

/**
 * Displays specific payment methods depending on the customer's selected billing or shipping country. 
 * You set the list of countries and their allowed payment methods here. 
 * @param country String - The customer selected country. 
 * @return Void
 */
function togglePaymentMethodsByCountry(country) {
  //** Define your country/payment options here, countries in caps **//
  switch(country.toUpperCase()) {
    case "UNITED STATES OF AMERICA":
      $('#payment_method_1').show();
      $('#payment_method_2').show();
      $('#payment_method_3').show();
      break;
    case "CANADA":
      $('#payment_method_1').show();
      $('#payment_method_2').show();
      break;
    default:
      // For all other countries not listed above:
      $('#payment_method_3').show();
      break;
  }
}