Does PayPal use the same Transaction ID when Retrying failed payments? - paypal-ipn

I'm building a recurring/subscription payment system with PayPal and all is going well.
Can anyone share the IPN data for when PayPal sends a retry payment? Specifically I need to know if paypal is going to use the same txn_id, or generate a new one every time it retries?
Appreciate the help!

You should receive a new transaction id everytime a payment is processed. You can test this by setting up a recurring payment in the sandbox, and setting it to bill daily.

Related

PayPal Express Checkout - Webhook PAYMENT.SALE.COMPLETED

I was searching a while and also read the paypal docs but I am unable to find an answer to my question. I created a recurring payment with Paypal Express Checkout. Everything is working fine, but now I need to know a little bit more about webhooks.
Assume a user registered and created a recurring subscription. The set-up fee is 0,00€ and the first payment will be in one week. After the first payment, the billing cycle will be every week. Now about my webhook question: I guess I need to use the PAYMENT.SALE.COMPLETED webhook am I right? As soon as I get paid every week, the PAYMENT.SALE.COMPLETED webhook will fire for every successfull payment and therefore add a new entry inside my database. Am I right? Or do I need to use another webhook for recurring payments?
Is there someone who uses this webhook in combination of a recurring subscription? Would be great if someone can help me out understanding if PAYMENT.SALE.COMPLETED is the correct webhook for recurring subscriptions.
Yes, PAYMENT.SALE.COMPLETED is sent after every successful billing event for a subscription.
Here is an example timeline of a subscription sale on my website:
2021-07-30 13:17:13.143: PAYMENT.SALE.COMPLETED - first payment
2021-07-30 13:17:10.679: BILLING.SUBSCRIPTION.ACTIVATED
2021-07-30 13:16:15.032: BILLING.SUBSCRIPTION.CREATED - this came after the one above, so make sure you can handle that
2021-08-30 11:13:05.321: PAYMENT.SALE.COMPLETED with "state"=>"completed" - second recurring payment
2021-09-08 14:34:44.816: PAYMENT.SALE.COMPLETED with "state"=>"completed","payment_hold_status"=>"RELEASED" - this is the release of the second recurring payment
If the recurring payment fails, you will receive BILLING.SUBSCRIPTION.PAYMENT.FAILED. Paypal retries the payment 3 times. See the attribute next_payment_retry_time which is set to null after the 3rd and final failed payment attempt.
You can configure your billing plan to automatically suspend a subscription after x number of failed payments (note: set this to be 1+ because 0 keeps is always active) and/or automatically add the outstanding payments to the next billing cycling.
Screenshot below:
I don't believe you have any choice for which webhook PayPal will send you. I am fighting with this right now because PAYMENT.SALE.COMPLETED is the one they send me, but it doesn't contain enough data for me to match it up with a customer or a shopping cart. I want them to return CHECKOUT.ORDER.COMPLETED instead, but there doesn't seem to be a way to make that happen.

PayPal generate invoice and notify application after payment

I would appreciatte if someone helps me to clarify some PayPal concepts. I'm using PayPal to send/receive payments and I want to offer the users the possibility of get an invoice for the payments. So, right now I'm using the Invoicing Service API for the payments I receive, I call the service and get the URL of the invoice for the user and here is muy first question: once the user pays the invoice, how do I get notified of this in my application (without having to login into PayPal and check by myself)? Second: in the Integration Guide it says "PayPal sends IPN messages for invoice payments and for invoices cancelled by the buyer..." is IPN the only option to get notified of a payment in my application? Beyond this, I've start reading about IPN and testing the IPN Simulator, but after select all of the items in the combo "Transaction Type" I couldn't see the transaction type "invoice_payment" mentioned in the Invoicing Service API, so which type of transaction should I configure?
Thanks in advance, regards.
You can try using the Web Accept. Basically, the IPN simulator is used to test your IPN Listener whether it can listen to the message that sent by PayPal. It does not sent any a real message to your listener. For the invoice payment, it will return invoive_payment. You can have a try on your end.

Paypal Recurring api for find next recurring payment occure

i has been implemented paypal recurring subscription plan in php and paypal recurring also charge via paypal as per recurring periods. but my system didnt find out next recurring was charged or not so how could i know next recurring payment has been charged using paypal api.
i want to help for to upgrade next expire date after next recurring payment changed.
As I understood, you want to see if the user paid or not and change expiration date according to that.
The solution is Webhooks. In your PayPal Application section click on add webhook and choose PAYMENT.SALE.COMPLETED and enter the URL that you want to listen to this event where PayPal will send a post request to this URL when you get a new payment completed.
In the page that corresponds to the URL you entered, you have to do the followings:
Verify that the call is from PayPal, not from another source (in case you are using PHP you can check this: PHP verify Paypal webhook signature)
Parse the data sent from PayPal by reading the body content, not the POST data
Verify that the event is what you need, in this case PAYMENT.SALE.COMPLETED
Verify the amount you received and the currency
Make sure that you have not processed this transaction before and this is too important
If everything is valid, you can save the transaction and do whatever you want, in your case extending the expiry date.
If I understand you correctly, you need to configure Instant Payment Notification (IPN). PayPal's server will POST transaction data to a listener script you have on your server so you can process things accordingly. It happens in real-time.
When working with recurring payments you'll get an IPN when a profile is created, canceled, or suspended, and you'll also get notifications when payments for profiles are completed, failed, etc. You can update your system or send out email notifications accordingly based on the IPN data you get.

Paypal IPN prior to renewal

I am setting up a Paypal IPN for a subscription service. After reviewing the documentation and speaking with Paypal, I'm still unsure as to whether the IPN feature will send out notifications before a subscription is renewed. I've got it to where it will notify a user when their account is charged for the renewal, but there is no prior notification that this transaction will take place.
Does anyone have any experience with setting this up and if it's possible?
Thanks!
IPN only notifies you when a payment is made or its status changes. For subscriptions you won't get one prior to renewal.
If you're using the Recurring Payments API, you can get that via GetRecurringPaymentsProfileDetails, which will tell you when the next billing cycle is.

Do Paypal recurring payments have unique txn_ids?

I'm using the Paypal "Subscription" button. I have an IPN handler and overall I think I've got it all figured out. My last problem is that apparently there's no good way to test a recurring payment (except to wait for the cycle to occur). This issue is discussed here: [question]: Testing Paypal subscription IPN
I don't really need to test this recurring payment but I do need to know if every recurring payment will have it's own txn_id or if every payment in a subscription shares the same ID.
Thanks!
Yes, each recurring payment cycle will create a new transaction with its own transaction ID.
You'd link these transactions together via their recurring payments profile ID.