I am using PayPals adaptive payments for chained payment processing. I am able to successfully get a preapproval key by calling https://svcs.paypal.com/AdaptivePayments/Preapproval.
My understanding is that when completing a pay request (https://svcs.paypal.com/AdaptivePayments/Pay), that you can add the param &preapprovalkey=PA-a891asnk to do implicit authorization and prevent the user from having to enter their credentials and the payment will automatically complete.
My question is: Can the 'Pay' process be split up? In other words, I have a server process that already has the logic to create the receivers and the amounts and it calls 'pay' and returns a paymentKey. If there wasn't already a preapproval, this paymentKey would be passed into the redirect and the user would enter their credentials. Can I keep this server process and then just make a call back to PayPal passing in both the paymentKey and the preapprovalKey and do an implicit authorization?
When I tried this, it failed validation saying that the receiverList cannot be null. I thought that the paymentKey would have this detail and I could just "approve" is using my preapproval key.
I realize many people would just ask why I wouldn't want it in a single call, but I want to keep anonymity between parties and have that logic stay on the server and want the client to just do the final "approval"
Possible?
The way it works is that you would make a call to Preapproval so that your payer can create the preapproval profile. You would store that preapproval ID in your system with that user's details.
When submitting a delayed chained payment for that user you would call the Pay API with the preapproval ID included and the action set to PAY_PRIMARY. That is what makes it delayed. You would include the primary and secondary receiver(s) details in this request, though.
With PAY_PRIMARY set the funds would go to the primary receiver only. You would then make a call to the ExecutePayment API to trigger the secondary payment(s) when necessary.