How to get rebill _date after payment

Discussion in 'Customization & add-ons' started by acetolyne, Apr 21, 2016.

  1. acetolyne

    acetolyne New Member

    Joined:
    Apr 21, 2016
    Messages:
    3
    Hi I am working on a customization for Amember and have been trying to figure out the best way to get the new rebill date after a user renews their product. I tried the invoiceAfterInsert hook but it seems that the rebill date is not present in the invoice array at this time I also tried to pull it out of the database but its not in there either. Then I thought maybe about using the accessAfterInsert hook but then I do not have the cooresponding ivoice id.

    Can someone lead me in the right direction to get the new rebill date after a user pays to renew their product. I need to get the new rebill date and do some custom command based on it. Thanks for any assistance with this. Have a great day!
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Here is code that you can use:
    Code:
    Am_Di::getInstance()->hook->add(Am_Event::PAYMENT_WITH_ACCESS_AFTER_INSERT, function(Am_Event $e){
        $e->getInvoice()->rebill_date;
    });

Share This Page