I am using Paypal rest API on my site. Till now I have implemented flow for regular order -
Create checkout session
Approve Payment by Payer
Capture Payment
Refund against captured payment
For subscription, I have implemented -
Create a checkout session with a subscription
Approve subscription by the payer
But after this, I couldn't get any further to capture any payment even from webhook, against which I could initiate a refund. There is an API for subscription capture, but it only adjusts the outstanding balance with the current payment. Also, the API doesn't return any object that might carry any capture info to work on a refund.
Does PayPal have any way to refund against payments on recurring subscriptions?
Approved subscriptions will charge automatically on their schedule. That is the point of subscriptions.
To be notified of subscription payments, register a listener endpoint for the webhook event PAYMENT.SALE.COMPLETED.
To refund subscription payments, full or partially, use the rel:refund link within any such sale object to refund it. See the v1/payments/sale/.../refund API call.
Related
I have implemented recurring payments using PayPal Rest API. I have subscribed to some events of webhooks. When the subscription is created, I got a notification from paypal. But when the recurring payment created I have not get any notification, even on the events console of developer account.
There is a solution to get the list of transactions from transaction API and on the basis of agreement id verify the transaction you want.
I'm creating a website using paypal recurring payments. Each month the payment happens automatically, but I need to know when this happens in order to update the user profile in my application, so I know until when the subscription is valid.
Using paypal webhooks, which events do I need to subscribe to in order to know when the payment actually happens (or fails) each month?
I am trying to prevent paypal for allowing a payment I have created.
The scenario:
My App is creating a Payment. I get the payKey from PayPal and the Customer is redirected to PayPal.
When the Customer is not able to finish the Payment after 2 minutes I will delete the Order for him and then - if possible - I will force Paypal that the payment is not active anymore and the customer is not able to pay after these 2 minutes. For this I have to do at least of this:
send Paypal the payKey and tell Paypal: Do not allow to pay with this payKey! Just "Delete" the information for this order
after the customer paid - but after 2 minutes, so the order is deleted - I will tell Paypal the payKey and a refund has to be done right after the customer has paid. This is no problem I thought but because its an AdaptivePayment and chained paypal is not allowing me to refund the money because every receiver in the refund receiverList needs permissions to allow a refund by API Call.
So my question is:
Is it possible to prevent a Payment with an API call ? I did not find any information in the REST API Reference of PayPal.
The payKey cannot be deleted or change the expire duration. You can use delayed chained payment with IPN. You are the API caller and primary receiver, compare the transaction complete time with the paykey generation time to decide refund or pay secondary receivers.
My users subscribe to my project using the paypal button "Subscribe", and then I manage the monthly payments via the IPN, but if the user delete his account, I'd like to unsubscribe him automatically, without asking him to go to Paypal to cancel his subscription.
Is it possible to use the Paypal Adaptive Payment API to tell Paypal to unsubscribe this user ?
Bonus question : is it possible to use the Paypal Adaptive Payment API to know the status of the subscription, and eventually also to modify it (lower the amount for example) ?
You wouldn't use the Adaptive Payments API to unsubscribe a user from a subscription. If the buyer signed up for a subscription, you could ManageRecurringPaymentsProfileStatus API to cancel the profile. As for the status, you would not be able to use the "GetRecurringPaymentsProfileDetails" API call to get the status for subscriptions. This would only be supported for recurring payments, not subscriptions. However, you could use IPN which would send you the details when the profile gets created, when a new transaction is processed, and etc. Then you could just query your own database for the details.
I am using the 'reference transactions' of the Paypal express checkout api to set up a recurring billing scenario for our customers. I have chosen this method since the amount billed per month will vary and there is no initial payment when entering into the billing agreement.
My question is, can I use the paypal IPN to detect when the user cancels this? I know that if the customer enters into this agreement they have the power to log into their own Paypal account and cancel the agreement. What variables should I be listening for through the IPN?
Whilst I see mention of recurring payments and recurring payment profiles in the IPN documentation these are not actually the same as setting up a recurring billing scenario via reference transactions (recurring payments and reference transactions are in two different parts of the general paypal api documentation).
Enable IPN in your PayPal account , then PayPal will notify you via IPN about the Billing agreement cancel from the customer.
If you include IPN with SetExpressCheckout, it will not work with Reference Transaction. You need to Enable IPN on PayPal site.