2 Checkout Recurring Plugin Possible Change / Fix?

Discussion in 'Payments processing' started by swintec, Jan 15, 2011.

  1. swintec

    swintec aMember Pro Customer

    Joined:
    Nov 24, 2008
    Messages:
    49
    Hello, I am using the most recent Amember version, and using the 2 Checkout plugin. When a product is rebilled, 2 Checkout is sending in the IPN update messages a value called "item_rec_date_next_1" which is the date that the next rebilling is going to happen. Amember seems to ignore this message for some reason and may make my users miss a day or two of there membership waiting for 2 Checkout to rebill. Amember goes by its own schedule not 2 Checkouts.

    Is it possible to set the expire date for customers to date that is in this subscription message "item_rec_date_next_1"? This would make the account expire and then re-enable as soon as 2 Checkout bills them again....all in the same day.

    The problem seems to stem from several things, how 2 Checkout waits an extra 2 days before billing the second installment (they say this is for "fraud" check. but this right here throws things off by 2 days), the way 2 Checkout handles a month in there system and how A member handles a month in its own system.

    Is there a simple change I can make in the code that will fix it?

    For reference, here is the documentation from 2 Checkout on this message (all the way at the bottom): https://www.2checkout.com/static/va/documentation/INS/message_recurring_installment_success.html
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Try to edit /amember/plugins/payment/twocheckout_r/twocheckout_r.inc.php and find this block:
    PHP:
                  $newp['member_id']   = $p['member_id'];
                  
    $newp['product_id']  = $p['product_id'];
                  
    $newp['paysys_id']   = $this->get_plugin_name();
                  
    $newp['receipt_id']  = $vars['invoice_id'];
                  
    $newp['begin_date']  = $begin_date;
                  
    $newp['expire_date'] = $expire_date;
                  
    $newp['amount']      = $pr['price'];.
                  
    $newp['completed']   = 1;
                  
    $newp['data']['RENEWAL_ORIG'] = "RENEWAL ORIG: $last_payment[payment_id]";

    change expiration date calculation to
    PHP:
                  $newp['member_id']   = $p['member_id'];
                  
    $newp['product_id']  = $p['product_id'];
                  
    $newp['paysys_id']   = $this->get_plugin_name();
                  
    $newp['receipt_id']  = $vars['invoice_id'];
                  
    $newp['begin_date']  = $begin_date;
                  
    $newp['expire_date'] = ($vars['item_rec_date_next_1'] ? $vars['item_rec_date_next_1'] : $expire_date);
                  
    $newp['amount']      = $pr['price'];.
                  
    $newp['completed']   = 1;
                  
    $newp['data']['RENEWAL_ORIG'] = "RENEWAL ORIG: $last_payment[payment_id]";
  3. swintec

    swintec aMember Pro Customer

    Joined:
    Nov 24, 2008
    Messages:
    49
    Great! Of the several rebillings that happened this morning that seemed to fix it. I will keep watching it to make sure. Will this change make it into future releases or should i copy these steps down so when a new version comes out I will need to do it again?

    Also, while your steps did fix this issue, one issue that remains is that 2 Checkout adds 2 days before it makes a second billing. They say these two days are to allow for fraud checking.

    For example, if someone signs up on January 1st, the first rebilling will not happen until Feb. 3rd.....the extra 2 days only applies to the first rebill. Is there something that can easily be changed so "item_rec_date_next_1" is also used when the subscription is first set up in Amember? it gets passed but seems to be ignored for the subscription set up. Thanks.
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Above fix will be added to next version.
    Also in regards to inital rebilling, can you post example of IPN message and redirect variables that being sent by 2CO. You can do this in helpdesk.

Share This Page