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

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

问题描述

我正在建立一个 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 & 在实时网站上接受虚拟信用卡贝宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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