Using PayPal MPL, how could the back-end server check whether the payment completed? As I understand the MPL controls the entire flow, no need for back-end server calls - but what if the server needs to validate and register the purchase completion.
UPDATE First of all, thank you for the answers so far. We have two requirements/preferences that can guide us to refine our process:
- The payment should be validated as soon as possible. Customer should access the paid services right after the purchase.
- For the validation process we should use minimum proof data from the app. Consider the following scenario: purchase completed, but the back-end server went offline - so the client app needs to store the proof data (transaction id, payment id) in order to validate later. But what if the client looses the proof data (app reinstall, etc.) in the meantime- how can then the client and the back-end server get back in sync?
Because of req #1, we don't prefer IPN. According to the IPN documentation:
Although PayPal usually processes IPN messages immediately, IPN is not synchronized with actions on your website. Internet connectivity is not always 100% reliable and IPN messages can be lost or delayed. The IPN service automatically resends messages until the listener acknowledges them. The service resents messages for up to 4 days. Because IPN is not a real-time service, your checkout flow should not wait for the IPN message before it is allowed to complete. If the checkout flow is dependent on receiving an IPN message, processing can be delayed by system load or other reasons. Configure your checkout flow to handle a possible delay.
The process described in the iOS SDK docs involves various API calls to verify the payment, but those calls need some proof data from the client app. But what if the client looses proof data? (req #2) Maybe the proof data could be sent to the back-end before the payment? In that case the back-end server could store the proof data until it can be validated. That process would go like this:
- Client app initiates a PayPal payment
- Client app sends proof data/payment info to the back-end server
- Back-end server stores payment info
- Client app follow through the payment process with PayPal
- Client app notifies back-end that the payment can be validated (no additional data needed)
- Back-end server validates payment using the data from step 2.
For this we need an API call with a parameter that is available in step 2, but most id-s are available only after payment completed. Any advices?