我目前让我的网站通过PayPal接受付款。我使用PHP SDK作为REST API来处理这个问题。这是我通过我的网站处理付款的步骤:
这是一种享受。但是,我想让用户选择通过PayPal(如上)或通过我的网站(使用PayPal直接付款)处理付款。
对于直接付款,我已成功创建付款方式,将意图设置为“促销”,付款方式为“credit_card”并传递相应的信用卡详细信息。但是,我不确定我是否需要像之前那样执行付款,或者付款是否自动完成。
如果我确实需要执行付款,那么如何获得paymentId和PayerID?如果我不需要执行付款,则会出现问题,因为我希望用户确认付款。我可以将创建支付内容移动到仅在用户确认直接付款订单后才执行,但是在用户输入后我无法验证卡详细信息。我想知道是否有更好的方法来解决这个问题?
如果有人能帮忙解决这个问题,我会很感激。感谢
答案 0 :(得分:1)
You'll just need to process the first step (create the payment) when it comes to a credit card (detailed here: https://developer.paypal.com/docs/integration/direct/accept-credit-cards/).
For your other question about the issues in not being able to have the user confirm, there are a few things you can do:
Since I think auth/capture is closer to what you're thinking about doing, let me dig in there a bit further. What you're essentially doing is authorizing the funds (holding them on the user's payment source) and then capturing them at a later time. This is the same premise as a hotel putting a hold on your credit card for incidentals, and later canceling the hold.
You can do all of this with the PayPal REST API. Here are the features you're looking for:
After you authorize, that's the point where the user can confirm and you can validate the card. Once everything is approved, you can then capture.
I know this isn't going to be an issue for you, but I'll mention it anyways. With auth/capture, authorized funds will be guaranteed to be there for only 3 days (honor period), but you can keep trying to capture the funds for 29 days. After those 3 days though, there isn't a guarantee that the funds will be present.
Hope that helps