paypal / PayPal-PHP-Server-SDK

Other
6 stars 1 forks source link

Creating payment subscriptions #22

Closed dparker1005 closed 4 hours ago

dparker1005 commented 2 days ago

Hi there!

We currently use the SetExpressCheckout NVP endpoint to handle checkout flows for both one-time payments and to set up payment subscriptions.

As the NVP/SOAP APIs are legacy integration methods, we are considering moving to PayPal Advanced Checkout. The PayPal Advanced Checkout sample code leverages this SDK, but there isn't any sample code for setting up subscriptions with Advanced Checkout. Is setting up subscriptions with Advanced Checkout currently possible, possibly with a different SDK or API? If not, is this a planned feature of this SDK?

Alternatively, is there a different PayPal payment flow that would be better suited for one-time payments, subscriptions, and SCA compliance?

LeonarthusMectus commented 22 hours ago

Hey @dparker1005

I want to clarify a bit first to be sure I understand your integration. Based on the API call and the behavior you're describing, it sounds like you're using the SetExpressCheckout API to configure checkout to generate a billing agreement for future use, not specifically to generate a subscription inside of PayPal, correct?

I and my team don't work with the NVP/SOAP APIs, so my understanding is sparse at best, but as I understand it, you'd still need to make a separate call to something like CreateRecurringPaymentsProfile to setup the actual recurring billing behavior. Unless your code handles that aspect and simply uses the billing agreement itself and a call such as DoReferenceTransaction to do it.

If you could elaborate a bit on what APIs you're using, or give a general description of the logic flow around what you're calling subscriptions, I can clarify if the SDK can currently do what you need or if there's an additional API that is required that is not yet available.

dparker1005 commented 4 hours ago

Hi there @LeonarthusMectus, thank you for the response!

I found a path forward using the PayPal REST API directly. I did not realize that the Create Order and Create Subscription endpoint provide payment URLs that users can visit to complete payments. For anyone else who stumbles across this issue, here are the endpoints that I ended up using (see links in the response sample):

Once this SDK supports those endpoints, we may use it. But for now, direct calls to the REST API seem to be doing just fine.

Thanks again for your help!

LeonarthusMectus commented 3 hours ago

This is definitely an option!

It's worth noting that this path does involve redirects, while an alternative would be using the JS SDK to allow the customer to stay in-context. I can understand if that's a significant paradigm shift and not quite the solution you're after, but it's worth mentioning.

This SDK does support the Orders API, however it does not yet support the Subscriptions API. In that regard, it seems like it might not yet meet your needs. We're still sorting out what additional APIs we're going to add next, so we will add this as a point to Subscriptions!