It's a circular reference error because $ipn seams to have a copy of itself inside of itself. That's irrelevant, because at this point the IPN has already failed and isn't what caused it to fail. It failed because you've an payment mismatch. That of course needs to be fixed, but I'd rather focus on what is causing the payment mismatch to begin with as that should never happen. Some of the common ways this happens are as follows.
1. You've configured CBSubs PayPal wrong where "PayPal Business (email or secure merchant ID)" and "PayPal Main receiver account (email) (if Business is different from your main account)" are not properly configured to match the payment. For this I recommend setting "PayPal Business" to Merchant ID and "PayPal Main receiver account" to whatever email address is marked as primary at PayPal.
2. You added a fee at PayPal instead of in CBSubs. This causes a price difference. CBSubs will flag that as a fraud attempt.
3. The currency changed at PayPal instead of in CBSubs. This again causes a fraud attempt check.
4. Return data is not properly configured at PayPal as this is happening inside the PDT check (return to site check). See CBSubs PayPal and follow the configuration instructions within it very carefully.
Below are step by step instructions for configurating PayPal please be sure you've configured everything exactly as instructed.
1. At PayPal navigate to Settings > Account and copy "Merchant ID" to "PayPal Business (email or secure merchant ID)"
2. At PayPal navigate to Settings > Account and copy the email address marked "Primary" under "Emails" section to "PayPal Main receiver account (email) (if Business is different from your main account)"
3. At PayPal navigate to Settings > Seller Tools > Website Preferences and configure the following
- 3A. Auto return for website payments = On
- 3B. Set your homepage for the return url
- 3C. Payment data transfer = On
- 3D. Copy "Identity Token" to "Your PayPal Identity Token"
- 3E. Encrypted website payments = Off
The final possible issue is PayPal has its encoding wrong. It should be UTF-8. It can be a bit frustrating to fix that. To fix that use the below link to go to the old PayPal language encoding page because I've no clue where they moved this.
www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding
Next click "More Options" then set "Encoding:" and set "Do you want to use the same encoding for data sent from PayPal to you (e.g., IPN, downloadable logs, emails)?" to "No" followed by selecting utf-8 again. Then click Save. This will ensure you've UTF-8 safe data communication between the sites as it can be a problem if there's an encoding mismatch (a lot of old accounts got set to things like windows-1252).
That should cover the bare minimum. API credentials aren't necessary unless you want to allow for on-site subscription cancellations or on-site refunds.
In the meantime will look into fixing that circular reference bug for a new CBSubs release.
forge.joomlapolis.com/issues/9843
Ok, bug ticket created and fixed but is pending review. Once merged we'll have a new CBSubs build out with the circular loop addressed.