Troubleshooting PayPal 'Invoice Not Found' error with Subscriptions starting with 'S-'
At the time of this writing (15 November, 2018), we have become aware of a change to legacy-styled PayPal Subscriptions (IDs starting with 'S-') that impacts the method by which subscription payments are associated with unpaid invoices. This may result in some PayPal subscription payments not being applied to invoices.
The WHMCS Development Team is introducing an automated migration path in the upcoming 7.7 release. PayPal have set a 2 month window for migration, but we have raised the possibility of extending this.
To resolve this matter, we will need to identify the New Subscription ID Paypal is sending and update the affected Service's Subscription ID to use the value PayPal is now providing.
At the end of October 2018, PayPal made an undocumented and unannounced change to the format of IPN data. This is the notification sent from PayPal to your WHMCS installation notifying it when a payment is received.
This change converts old 'S-' formatted subscription IDs to the new 'I-' style. During this transition, PayPal has begun supplying both the old and new subscription values, but has replaced the value WHMCS utilizes with the new value.
As a result, when WHMCS receives an IPN for a payment, and attempts to look up the service using the subscription_id value, it does not match the stored value.
Firstly, we need to review the Gateway Log to obtain the old_subscr_id value. This is the value that WHMCS is aware of in a Product/Service and is what we will need to replace later on.
To open the Gateway Log, navigate to Billing >> Gateway Log as shown below.
From here we need to look at the logs to identify affected payments. An example of an entry is shown below:
If we scroll down in the Debug Data box, we can see that an old_subscr_id is provided, in addition to the expected subscr_id. In this case, you can see the old_subscr_id does start with an S- and this is the cause of our issue.
To resolve this issue, we will need to locate the customer's specific product that is affected. The simplest way to do this is to use our Intelligent Search to look for a "known variable". In this case, we will search for the customer's name which is referenced in the Debug Data.
Once the customer is opened, we can navigate to the Products/Services tab to locate the affected item. We are looking for the Subscription ID field that matches the old_subscr_id value located in the Debug Data we found earlier.
Once this is located, we simply need to "swap" out that value for the new subscr_id that starts with an I- as shown below. Once swapped out, simply click Save Changes and you are all set going forward!
You may need to manually apply the invoice payment to the outstanding invoice. You will want to check if the customer has any outstanding Credit Balance. If WHMCS was able to match the transaction to the customer, an account credit will be applied. If WHMCS was not able to match the customer, the payment is not applied at all and will need to be manually applied. Please see our documentation referenced below on how to perform these tasks: