ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Simple Commerce doesn't record TXN_ID and doesn't send Unsubscribe Emails

October 13, 2010 9:38pm

Subscribe [6]
  • #1 / Oct 13, 2010 9:38pm

    Shane Robinson

    55 posts

    I’ve now done several dozen tests trying to get Simple Commerce to work as advertised. It only works half way…

    EE Version: 2.1.0
    EE Build: 20100810

    I’m posting $1.00 recurring subscriptions to a LIVE PayPal account (‘cause the PayPal sandbox is still borked) and I also have Debug IPN emails sent to me so I can see the Array coming from PayPal to EE.

    Here’s what happens:

    1. Login to the site as a member in the “Free Members” member group.

    2. Click the Simple Commerce generated “Subscribe Now” link (basically copy/pasted the code from the docs and changed the Success and Cancel template paths)

    3. New window opens, login to PayPal, auth the payment, click the link to go back to our site’s Success page.

    4. I check EE Members and that member has been switched to the “Paid Members” member group. So far, so good.

    5. I check the SC Purchases page, the purchase is listed, but when viewing the detail, the TXN ID field is always blank (see attached screenshot). I can confirm the TXN ID field has a value in the IPN Array PayPal sends to EE. The column is also blank in the exp_simple_commerce_purchases table. No TXN ID value ever gets inserted into the table.

    6. I receive both the PayPal email notice that we have a newly subscribed member as well as the SC Admin Email Template message.

    7. The member receives their email from PayPal telling they’ve subscribed and they also receive the SC Customer Email Template message.

    Except for the missing TXN ID value, all is good so far. Also, I checked the exp_simple_commerce_purchases table and no value is present in the “txn_id” column for any purchases even though the IPN Array from PayPal has valid TXN IDs. And the “subscription_end_date” field is always “0”.


    8. Member logs back into their PayPal and cancels their subscription.

    9. Member receives an email from PayPal confirming they’ve canceled their subscription

    10. I receive the IPN debug message from EE with the PayPal IPN Array values. All are valid for a canceled subscription

    11. The member DOES NOT receive their Customer Email Unsubscribe Template message from SC

    12. I DO NOT receive my Admin Email Unsubscribe Template message from SC.

    13. The member is NOT moved back to the “Free Members” member group as specified in the SC Item config.

    I got to thinking, what if, since the member subscribed and paid for an entire month, their member group wouldn’t be updated until 30 days after their purchase_date? So I’ve set the subscription to 1 Day and will see if those members are unsubscribed tomorrow and all the emails and their member group change works then…?

    In the mean time, the rows in the exp_simple_commerce_purchases table do not change regardless of if a member has cancelled or not. And the “subscription_end_date” in the table is always set to “0” regardless of if the member is active or has cancelled.

    Hope this is an easy and quick fix because we have a membership site ready to go live and the final steps after moving it to the live server were to test the Simple Commerce module at a URL that PayPal could reach…

  • #2 / Oct 14, 2010 4:03am

    John Henry Donovan

    12339 posts

    Shane,

    Regarding missing emails can you confirm that the Email module is installed? It’s not by default.

    Have you reset var $debug = FALSE; after testing with the Sandbox?

  • #3 / Oct 14, 2010 3:02pm

    Shane Robinson

    55 posts

    Hey John,

    Email module is installed. As I mentioned in items 6 and 7, both the Simple Commerce Admin and Member Subscription emails are sent.

    My $debugs are set as follows and as mentioned above in items 5 and 10, I receive the $debug messages showing the PayPal IPN arrays:

    var $debug                = FALSE;
    var $debug_incoming_ipn = TRUE;  
    var $debug_email_address = '[email protected]';

    Just to reiterate, here’s what DOES NOT happen:

    A. The TXN ID does not get added to the ‘exp_simple_commerce_purchases’ table
    B. The Admin and Member Unsubscribe emails do not get sent
    C. The Member does not get changed to the ‘Free Members’ member group as selected in the SC Item settings.

    Basically it’s like EE just ignores the Unsubscribe Notice from PayPal, except via the $debug_incoming_ipn message, I know it is receiving both the Subscribe and Unsubscribe IPN Arrays.

    Also there’s the issue with the TXN ID not getting set during the Subscription process…?

  • #4 / Oct 14, 2010 5:29pm

    Corey Szopinski

    2 posts

    I’m having the same problem. I can subscribe to an item, and receive an IPN message back. However, UNSUBSCRIBING does not work. I get the IPN message (which I’m logging for now), but nothing happens:

    1. The user profile group does NOT change (demoted from “subscriber” to “member” for example).
    2. SimpleCommerce Purchases control panel does not show anything for “Subscription End Date” (only “—”).

    I’m using the PayPal sandbox ( https://developer.paypal.com/ ), and I’ve enabled Simple Commerce debugging:

    var $debug                = TRUE;
        var $debug_incoming_ipn = TRUE;  // Will send an email with the incoming ipn post data for debug purposes


    In mod.simple_commerce.php on line 693 (or nearby):

    // we ignore subscr_cancel actions since they do not affect the current subscription
            if ($type == 'subscr_eot')
            {
                $new_member_group            = $row->member_group_unsubscribe;
                $admin_email_template        = $row->admin_email_template_unsubscribe;
                $customer_email_template    = $row->customer_email_template_unsubscribe;
                
                if ($this->end_subscription() === FALSE)
                {
                    return FALSE;
                }
            }
            elseif ($type == 'subscr_signup')
            {
                if ($this->start_subscription($row) === FALSE)
                {
                    return FALSE;
                }
            }

    It seems like the unsubscribe methods are completely missing from this module!!!! Looks like someone didn’t finish coding it

    Any suggestions?

    -corey

  • #5 / Oct 14, 2010 5:53pm

    Shane Robinson

    55 posts

    Nice find in the MOD conditional, Corey.  I hadn’t yet taken the time to search the MOD file for $type functions or conditionals.

    That would certainly explain why SC ignores the unsub IPN. But doen’t explain why it’s not recording the TXN ID. I’ll wager a search in the MOD for “txn_id” turns up the problem. I’m working on another client project today but will look for that later unless we hear back from EE Support.

  • #6 / Oct 15, 2010 1:03pm

    Sue Crocker

    26054 posts

    Corey, can you add your findings to the EE2.x bug tracker? The link can be found in my signature. Also please reference this thread.

  • #7 / Mar 15, 2011 5:26pm

    Noah Kuhn

    60 posts

    Any word on this? I looked in the bug tracker and didn’t notice that this had been added.

  • #8 / Mar 16, 2011 11:59am

    Brandon Jones

    5500 posts

    I went ahead and filed this as a bug for tracking. Thanks for your patience, all.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases