如何开始使用 PHP 制作自定义支付系统?
假设为了方便讨论,我的客户不想使用 Paypal api 进行交易。我已经做了一个购物车。用户提交购物车上的商品及其信用卡号码。
假设我没有使用任何 api,那么我如何向用户的信用卡收取购物车上商品的费用?我知道这很复杂,只是想知道一般流程是什么样以及如何开始。
Let's say, for the sake of discussion, my client does not want to use the Paypal api for transactions. I have already made a shopping cart. The user submits the items on the shopping cart and their credit card number.
Assuming I'm not using any api, how would I then charge the user's credit card for the items on the shopping cart? I understand that it is complex, just wondering what the general process is like and how to get started.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您将需要触发银行交易,因此显然您将需要在某种程度上使用 API。我认为要走的路是首先详细了解至少一种流行的商业(根据定义?)支付卡处理服务的工作原理,例如:
下一步是设计 PHP 应用程序/库的“支付处理”子系统围绕“后端工作流程” (也许使用第三方 PHP 库,如果有的话),并进行一些测试。
然后我会计划对您的代码进行安全审核在您实际使用系统代表客户/第三方处理支付卡信息之前。
You're going to need to trigger a bank transaction, so obviously you're going to need to use an API at some level. I think the way to go would be to first learn in some detail how at least one of the popular commercial (by definition?) payment card processing services works, e.g.:
The next step would be to design the "payment processing" subsystem of your PHP application/library around the "backend workflow" (perhaps using a 3rd party PHP library, if one is available), and do some testing.
Then I would plan for a security audit of your code & systems before you actually use it to handle payment card information on behalf of a customer/3rd party.
您还可以捕获所有卡信息并使用外部支付处理器。问题是您将承担大量费用,因为它将被视为键入而非刷卡交易。
如果您不想/喜欢 paypal,不想使用像authorize.net这样的支付处理器,您可以看看其他选项,比如stripe.com。
You can also capture all the card information and use an external payment processor. The problem is that you will be hit with major fees since it will be considered a keyed in and not swiped transaction.
If you don't want/like paypal, don want to use a payment processor like authorize.net, you could look at other options like stripe.com.
找到支付网关,例如authorize.net。使用此类支付网关,您的客户将需要在信用卡处理机构注册一个商家帐户。您的支付网关可以帮助您解决此问题。
然后,您通常会获得一个令牌或 api 密钥,用于连接到支付网关服务。在 php 中,您将使用 cURL 或 fsockopen 来连接到它们。安全地发送您的 api 密钥,获取响应,然后发送其他一些所需的消息,获取另一个响应,然后发送信用卡信息和信用卡持有人信息。
对于不同的支付网关,有很多 PHP 库可供选择。我并不是建议使用authorize.net,这只是一个例子。但是,当您找到满意的信用卡,并且对与处理信用卡相关的费用感到满意时,您可以使用预先编写的库,或者他们的支付网关将为您提供 API,告诉您如何与其集成系统。
Find an payment gateway, such as authorize.net. With payment gateways such as this, your client will need to sign up for a merchant account with a credit card processing agency. You payment gateway can help you with this.
Then, you'll usually get a token or api key that you will use to connect to the payment gateways services. From php, you'll use cURL or fsockopen to connect to them. Securely send your api key, get a response, then send some other required message, get another response, and then send in credit card information and credit card holder information.
There are lots of PHP Libraries to choose from out there for different payment gateways. I'm not suggesting authorize.net, it was just an example. But when you find one you are happy with, and happy with the fees that are associated with processing credit cards, you can either use a prewritten library, or they payment gateway will provide you with and API that will tell you how to integrate with their system.
Payum 效率由 GitHub 上有超过 1000 颗星,精彩评论和一百万下载。支持 50 多个不同的支付网关,因此您一定能找到您需要的。
Payum efficiency proved by 1k+ stars on a GitHub, great comments and a million of downloads. Supports 50+ different payment gateways so you surely find what you need.