Reputation: 387
I am trying to run payments through PayPal in sandbox mode with my .NET CORE 3 project. The idea is to give the customer ability to choose whether to pay using his/her PayPal account or Credit Card. I am using the PayPal-NET-SDK v2.0.0-rc2
I am trying to understand whether this is the right order to run things:
PaymentCreateRequest
PaymentExecuteRequest
, using the PAYID and PAYERID I get from the redirect URL. Here I get an order objectOrderAuthorizeRequest
with the order id (setting body to a PayPal.v1.Orders.Capture
object)OrderCaptureRequest
with the order id (setting body to a
PayPal.v1.Payments.Capture
object)Is that a correct execution order?
Upvotes: 3
Views: 3987
Reputation: 30467
Rather than the old v1/payments, you should use v2/orders; the v2 SDK can be downloaded here
Rather than an old-style full page redirect to an approval_url , it's much nicer to use the new checkout's in-context UI that keeps your site loaded in the background. Here is a demo pattern. Another benefit is that it gives an embedded/in-line credit card form.
If you start out with intent=capture(v2) or sale(v1), the capture(v2)/execution(v1) call will be final and complete the transaction, there will be no authorize step, so (4) on your list is skipable. (You should only bother with implementing something other than intent=capture/sale if you find you have a specific business need for delaying captures, as it adds complexity)
More general information on implementing the server-side portion of the integration: https://developer.paypal.com/docs/checkout/reference/server-integration/set-up-transaction/
Upvotes: 1