Redirect Callbacks
After a customer completes or cancels checkout at PayPal, they are redirected to PWP callback URLs. PWP then processes the result and redirects the customer to your application.
Flow
1. Your app creates a purchase (POST /api/purchases/create/)
2. Customer is redirected to PayPal (location URL)
3. Customer completes or cancels payment
4. PayPal redirects to PWP callback
5. PWP processes the result
6. PWP redirects customer to your success_url or cancel_url
Complete Callback
When the customer completes payment at PayPal:
- PWP captures the payment via PayPal
- Payment status is updated to PAID
- Subscription is created or extended
- Customer is redirected to
success_url(if provided)
If the payment was already captured (e.g. double-click), PWP detects this and still redirects to success_url.
Cancel Callback
When the customer cancels at PayPal:
- Payment status is updated to CANCELLED
- Customer is redirected to
cancel_url(if provided)
If the payment was already paid before the cancel callback arrives, PWP redirects to success_url instead.
Query Parameters
Both success_url and cancel_url are set when creating the purchase. If neither is provided, PWP returns a JSON response instead of redirecting.
Checking Purchase Status
You can check the status of any payment via the PWP invoice URL returned in the invoice field of the create response.