COVID-19: Pausing CC Module Payments (e.g. Stripe)

Discussion in 'Customization & add-ons' started by robw, Mar 23, 2020.

  1. robw

    robw CGI-Central Partner

    Joined:
    Dec 18, 2007
    Messages:
    287
    Some of you may (like me) have a membership site that needs to be put "on hold" during the Coronavirus outbreak. I wanted a way to:

    a) not expire existing members
    b) not take more membership payments until conditions improve.
    c) not ruin accounting with fake payments

    The way to do it is to extend the access expiry date and the rebill date for every member.

    amember-change-dates.jpg

    If you have lots of members, then this is a pain to do manually.

    So here's an EXAMPLE of the database queries and procedure you could run to automate this. I say 'example' because you may have specific products or access periods that should or should not be extended... and you may use a CC module payment system other than Stripe :)

    The code below assumes you want to extend all RECURRING STRIPE subscriptions by 90 DAYS.

    As always, before running queries on your database... make a backup!

    1) Extend access expiry dates

    Code:
    UPDATE `am_access`
    SET expire_date = expire_date + INTERVAL 90 DAY
    WHERE expire_date >= NOW()
    AND invoice_id IN (
        SELECT invoice_id FROM `am_invoice` WHERE `paysys_id` = 'stripe' AND `status` = 2
    )

    This query extends the expiry date by 90 days for all access records that expire from today onwards which are attached to an active recurring stripe subscription.

    2) Rebuild the access cache

    Once you've run the query above, you need to rebuild the core database for aMember to rebuild the access cache.

    Run aMember admin > Rebuild DB > Rebuild Core DB

    3) Extend rebill dates

    Now the access is extended, we also want to extend the rebill dates by the same amount:

    Code:
    UPDATE `am_invoice`
    SET rebill_date = rebill_date + INTERVAL 90 DAY
    WHERE `paysys_id` = 'stripe' AND `status` = 2
    
    This query extends the rebill date by 90 days for all invoices for an active recurring stripe subscription.

    And that's it!

    Hope this helps
    Rob
    caesar likes this.

Share This Page