简体   繁体   English

商户网站在实施支付网关时应该担心什么?

[英]What should a merchant site worry about when implementing a payment gateway?

I have to implement a payment gateway for a website I am maintaining, and I haven't done anything like this before. 我必须为自己维护的网站实现一个支付网关,而我之前从未做过这样的事情。 Previously to implement payment processing, the site would build a transaction and send it directly to the payment processor and await a result. 以前要执行付款处理,该站点将构建交易并将其直接发送到付款处理器并等待结果。 Since the site handled the gathering of credit card information, building of the transaction, and the requests/responses, there wasn't much I had to worry about that the previous developer hadn't already covered. 由于该站点处理了信用卡信息的收集,交易的建立以及请求/响应,因此我不必担心以前的开发人员还没有涉及到。

Now that I'm implementing a payment gateway, is there anything I should be checking or verifying? 现在,我正在实现一个支付网关,我应该检查或验证任何东西吗?

The way this processor works is, I build a form that has the order id, amount, currency, etc. in hidden fields. 该处理器的工作方式是,我构建一个在隐藏字段中具有订单ID,金额,货币等的表单。 That form is posted to the gateway, which will handle the processing, and then post a form back to our server where we can update the shopping cart and complete the order. 该表格将发布到网关,该网关将处理该处理,然后将表格发布回我们的服务器,在这里我们可以更新购物车并完成订单。

The only thing I can think of is a user modifying the form fields before we post them to the gateway. 我唯一能想到的就是用户在将表单字段发布到网关之前对其进行修改。 Such as adding a $100 item and changing 例如添加价值100美元的商品并更改

<input name="amount" value="100.00" type="hidden"> 

to

<input name="amount" value="0.01" type="hidden"> 

So when I receive the post I have to verify that the amount paid for was equal to the amount owed. 因此,当我收到该职位时,我必须核实所支付的金额等于所欠的金额。 Is there anything else I am missing? 还有什么我想念的吗? The implementation documentation doesn't even mention a scenario similar to the above, so I'm a little worried I'm missing other things and leaving the site open to further exploits. 实施文档甚至没有提到与上述情况类似的情况,因此我有点担心我错过了其他事情,并使该网站开放给其他人利用。

I think you'd be better off creating a dedicated web service to handle this '3rd party' conduit architecture you have going on here, your basically playing the middle-man and an HTML form just feels like unnecessary overhead to me, unless it's required to be done that specific way, I'd move to a web service. 我认为您最好创建一个专用的Web服务来处理这种“第三方”管道体系结构,基本上扮演中间人和HTML格式对我来说就像是不必要的开销,除非需要要以这种特定方式完成操作,我将转到Web服务。

That being said, treat it like any client application, don't trust whatever they give you, validate and cleanse the information as necessary before performing the operation. 话虽如此,将其像任何客户端应用程序一样对待,不要信任他们给您的任何内容,在执行操作之前根据需要验证和清除信息。

I would also recommend building or integrating support for logging into your middle ware system, so should a problem arise, you have some way of capturing issues and tracking them for the future, bug fixes, support calls, etc. 我还建议您建立或集成对登录到中间件系统的支持,因此,如果出现问题,您可以采用某种方式来捕获问题并在将来进行跟踪,错误修复,支持电话等。

It's probably obvious but make sure to validate your order #'s, a user could put anything in there they wanted, again, validate and cleanse the data and log the truly weird situations. 这可能很明显,但是请确保验证您的订单号,用户可以在所需的地方放任何东西,再次验证和清除数据并记录真正的怪异情况。

First, I have to agree with Capital G. It would be so much easier to just make a server to server connection than to try and handle form submission through the client browser. 首先,我必须同意CapitalG。仅建立服务器到服务器的连接要比尝试通过客户端浏览器处理表单提交要容易得多。

One thing to check: after submitting to the gateway, does the client then initiate the post back to your server, or does the gateway server handle it? 要检查的一件事:提交到网关后,客户端是否将帖子发起回您的服务器,还是由网关服务器处理? If the client initiates it, what prevents them from POSTing to you that the order is complete without ever having gone to the gateway? 如果客户端启动了它,那么是什么阻止他们在没有去网关的情况下向您发布订单已完成的信息? It sounds like you might need to make a webservice request to the gateway to verify the payment actually went through before accepting the client POST that claims it did. 听起来您可能需要先向网关发出Web服务请求,以验证付款是否实际通过,然后再接受声称已付款的客户端POST。

Could you add a digest to the communication? 您可以在通讯中添加摘要吗? If you had a shared secret with the gateway you could validate the integrity of information shared even if it passed through the client by including a digest both ways. 如果您与网关具有共享机密,则可以通过包括两种摘要的方式来验证共享信息的完整性,即使该信息通过客户端也是如此。

Make sense? 说得通?

Carl 卡尔

First, I don't think you're implementing a payment gateway. 首先,我认为您没有实现付款网关。 It sounds like you're just using one. 听起来您只是在使用一个。 If this is wrong, just ignore the rest of this answer, and I'll delete it when I can :) 如果这是错误的,请忽略此答案的其余部分,我将在可能的时候将其删除:)

Using a Payment Gateway from a Simple HTTP Form 通过简单的HTTP表单使用支付网关

Google Checkout -- as one example -- allows you to use an "unsigned cart" like the one you describe. Google Checkout(例如)允许您使用您描述的“未签名的购物车”。 The other option is to post via the web service interface, and do correct error checking etc.. When you submit an order with an HTML form, Google Checkout warns you, the merchant, that the "cart is unsigned" (later in the admin screen). 另一种选择是通过Web服务界面进行发布,并进行正确的错误检查等。当您使用HTML表单提交订单时,Google Checkout会向商家警告您“购物车未签名”(稍后在管理员中屏幕)。 This means that the information in the cart -- especially prices -- is not to be trusted. 这意味着购物车中的信息-尤其是价格-是不可信的。 The fact that the end-user put in their credit card basically vouches for the fact that the transaction is okay with him/her. 最终用户放入信用卡的事实基本上证明了交易对他/她而言是可以的。 So you just have to check that the numbers used to arrive at the final totals -- or amount owed, or whatever your business is -- check out. 因此,您只需要检查用于得出最终总数的数字(或所欠金额或您从事的业务如何),即可结帐。 So what you're doing is fine on a low-level. 因此,从低层次上来说,您正在做的事情很好。

The reason you should use a web-service submit to the service -- and secure signing of the cart, etc. -- is... What do you do if the numbers are wrong? 您应该使用网络服务提交服务的原因-以及对购物车进行安全签名等-是...如果数字错误,您该怎么办? Call the end-user up and explain the situation? 致电最终用户并说明情况? So that's a bit tricky, because you cannot assume fraud. 这有点棘手,因为您不能承担欺诈行为。 There are many strange reasons for which the cart would be altered without the user actually wanting to scam you. 有很多奇怪的原因导致购物车被更改,而用户实际上并不想骗您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM