I am currently using the PayPal API to process payments inside my application. My problem is the following: My application is now capable of creating an order and letting the user approve the order. What I want to accomplish is authorizing the amount the user approved to directly after the user approved the order. I know it is possible to authorize an order but from what I understand this is only possible after the user approved the Order. So what I want to know is the following: is it possible to let the user approve with the order and then authorize in one step, without the interfering of my backend(Spring Boot). Or should I let the frontend make a call after the user approved, so that another endpoint in my application can try the authorization of the funds. It al comes down to the fact that I don't know when to make the authorization call. What is the best practice?
So basically you want to create an order with "intent": "authorize"
and then authorize it from your backend after approval (rather than capturing it, as would be the case for intent:capture).
For this you need to make two routes, one for 'create an order for authorization' and one for 'authorize an order', documented here. These routes should return only JSON data (no HTML or text). The second one should (on success) store the resulting authorization ID, purchase_units[0].payments.authorizations[0].id
...for later capture
Pair these two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server