Paid Subscriptions Bug?

Started by Looking, December 14, 2015, 02:42:36 PM

Previous topic - Next topic

Sir Osis of Liver

PayPal allows recurring payments (they call it subcriptions) in business and premier accounts.  If you do a subscription with recurring disabled, you'll go to the PP personal account payment interface.  With recurring enabled, you'll go to the business interface.  If you have the wrong type of account, PayPal will display an error message that you're not authorized to do recurring payments.

Can you set up a clean test install on same account as your production site and give me admin access?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Looking

Maybe I have it blocked in my Paypal account, will check later, but first I need to work this on another site to see if it is unique to me. I will return and report. Thanks.

Sir Osis of Liver

You can't block IPNs in your PayPal account.  Subscriptions-PayPal.php sends a notify_url (link to your forum's subscriptions.php) which overrides IPN settings.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Looking

I am working on another site. The bug fix of "&" over ";" fixes the urlencode problem and everything works fine, however I noticed that if you check "recurring payment" then on the return Paypal sends back an "Auth=......" code rather than "profile;u=1111;area=subscriptions;sub_id=1;done" so nothing is registered. Is this happening to anyone else?

Sir Osis of Liver

The semicolon problem does not affect subscription activation, subscription is successful but returns user to main index instead of confirmation page.  If subscription is failing, that's a different problem altogether.  Are you getting a paid subs error in your log?  Are you running the Subscriptions-PayPal.php I posted here?  Where are you seeing the Auth= code?

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Looking

Thanks for your reply. Sorry for the delayed reply.

I am seeing the Auth code in the return URL from PayPal for example:
/index.php?auth=A2.uSamhLI95WqNLKPY0i581N9NQ23wHfqpbyFgr-qex6pVdmSN29PQnhPNUelAArHkjew&form_charset=UTF-8

I did not use your edits. Just checking logs it says: "Undefined index: action"

Also, what happens if the subscriber does not hit the return to site button after payment does that mean SMF will not be able to record and Admin will have to manually enter the subscription based on an Email from Paypal? If so, is the Member ID sent as part of the info under notes?

Sir Osis of Liver


Quote from: Looking on April 01, 2016, 07:03:35 PM
I am seeing the Auth code in the return URL from PayPal for example:
/index.php?auth=A2.uSamhLI95WqNLKPY0i581N9NQ23wHfqpbyFgr-qex6pVdmSN29PQnhPNUelAArHkjew&form_charset=UTF-8

Haven't a clue what that is, PayPal is changing the return url.  The correct url is put together in Profile-Actions.php -



$fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile&u=' . $memID . '&area=subscriptions&sub_id=' . $context['sub']['id'] . '&done');



and is posted to Paypal with the other transaction data by Subscriptions-PayPal.php -



// All the standard bits.
$return_data['hidden']['business'] = $modSettings['paypal_email'];
$return_data['hidden']['item_name'] = $sub_data['name'] . ' ' . $txt['subscription'];
$return_data['hidden']['item_number'] = $unique_id;
$return_data['hidden']['currency_code'] = strtoupper($modSettings['paid_currency_code']);
$return_data['hidden']['no_shipping'] = 1;
$return_data['hidden']['no_note'] = 1;
$return_data['hidden']['amount'] = $value;
$return_data['hidden']['cmd'] = !$sub_data['repeatable'] ? '_xclick' : '_xclick-subscriptions';
>>> $return_data['hidden']['return'] = $return_url;
$return_data['hidden']['a3'] = $value;
$return_data['hidden']['src'] = 1;
$return_data['hidden']['notify_url'] = $boardurl . '/subscriptions.php';



You'll have to contact PayPal support and ask them wtf they're doing.


Quote
Also, what happens if the subscriber does not hit the return to site button after payment does that mean SMF will not be able to record and Admin will have to manually enter the subscription based on an Email from Paypal?

The subscription should activate regardless of whether the subscriber returns to your forum or not.  As I understand it, this is how the process works:

- Forum posts subscription data to PayPal
- If payment is successful, PP posts IPN to forum.  IPN includes verify_sign, which is verification code.
- Forum posts verification code back to PP.
- PP verifies code and posts verification to forum.
- Subscription activates.

None of this is affected by $return_url

Upload the modified Subscriptions-PayPal.php I posted in the other thread.  It contains additional error handling that may tell you why subscription is failing.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Looking

As a followup, everything is working well. It seems that sandbox mode limits the ability to test what happens with some of the features described above. When not in test mode everything executed fine.

Thanks for your help Sir Osis of Liver.

Advertisement: