使用ActiveMerchant& amp; amp; amp; amp; amp;#8482;在实际网站上接受虚拟信用卡贝宝 [英] Accepting dummy credit cards on a live site with ActiveMerchant & PayPal

查看:68
本文介绍了使用ActiveMerchant& amp; amp; amp; amp; amp;#8482;在实际网站上接受虚拟信用卡贝宝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个Rails网站,该网站将使用ActiveMerchant和PayPal Website Payments Pro接受信用卡.我已经成功地针对PayPal沙箱进行了测试,但是还需要能够在我的实时网站上进行测试.我想实施一个解决方案,使在我的实时站点上使用来自我自己域的电子邮件地址进行的注册使用PayPal沙箱,但对于其他所有人,它都使用实时PayPal站点.这样一来,当我测试自己的实时网站时,我就不会付钱给自己,也不会被PayPal征税:-)

I'm setting up a rails site that will accept credit cards with ActiveMerchant and PayPal Website Payments Pro. I am successfully testing against the PayPal sandbox, but need to be able to test on my live site as well. I'd like to implement a solution whereby registrations on my live site with email addresses from my own domain use the PayPal sandbox, but for everyone else it uses the live PayPal site. That way when I test my live site I'm not paying myself and getting taxed by PayPal in the process :-)

但是,问题在于要使ActiveMerchant使用测试服务器,您可以编写以下代码行:

The problem, however, is that to get ActiveMerchant to use the test servers you write this line:

ActiveMerchant::Billing::Base.mode = :test

这设置了一个类变量,该变量将应用于站点上的其他事务,而我只是希望一个事务以测试服务器为目标.

That sets a class variable which will apply to other transactions on the site, when I simply wish for one transaction to target the test servers.

有人可以提出一个优雅的解决方案吗?还是除了我想到的解决方案之外,还有其他更好的方法可以实现这一目标?

Can anyone suggest an elegant solution? Or are there better ways to accomplish this other than the solution I have in mind?

推荐答案

打开后门总是很危险的.我建议在任何情况下都不要在沙盒上运行您的生产环境.如果您需要进行临时测试,请在实时的PayPal环境中进行测试,并立即处理退款-不必大惊小怪,无需付费.

It´s always dangerous to leave a backdoor open. I'd recommend against running your production environment against the sandbox under any circumstance. If you need to run an ocassional test do it against the live PayPal environment and process a refund immediately - no fuss and no charge.

这篇关于使用ActiveMerchant& amp; amp; amp; amp; amp;#8482;在实际网站上接受虚拟信用卡贝宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆