If I have a product that's set up to pay $50 for 3 months (payment split over 3 month period) will the user have a lifetime subscription to the product after that period? If not, what hook would you suggest and how do I find out how many payments for that product the user made? Thanks, Paul
this is a little tricky, as setting the content item to "lifetime" will continue to give access to the product if they cancelafter 1 mos etc.. So I think you will need to create 2 protected content items 1) start to 2 mos. 2) 2 mos to lifetime. David
I'm not sure what you mean. In version 3, there wasn't the ability to make 3 monthly payments for a product and then receive a lifetime subscription. I was wondering if this capability was introduced in version 4. If not, in version 3, I had a hook that checked for three payments for that particular product, and if there were, they the expiration date was set to lifetime. So, if this capability isn't in version 4, I was wanting to know how to find out how many payments for a particular product were made, since the code has changed so much. Thanks, Paul
Paul, there is the same in product configuration in v4, but there is a change in content protection: at aMember Cp -> Protect Content, you can allow access "for lifetime".
I see. That won't work in my case as my software checks to see if they're currently subscribed for that product before allowing them to run the software. Thus I need the subscription to be for lifetime. So how do I find out how many payments for a particular product were made, so that I can change it's expire date?
Here is example: PHP: function addAccess(Am_Event_PaymentAfterInsert $event){ $invoice = $event->getInvoice(); $products = $invoice->getProducts(); $product_id = $products[0]->pk(); if($invoice->getExpectedPaymentsCount() == $invoice->getPaymentsCount() && $product_id == 1){ // Add access; $access = Am_Di::getInstance()->accessRecord; $access->begin_date = date('Y-m-d'); $access->expire_date = '2037-12-31'; $access->product_id = $product_id; $access->user_id = $invoice->user_id; $access->insert(); }}Am_Di::getInstance()->hook->add('paymentAfterInsert', 'addAccess'); Above will add lifetime access for product 1 when last payment for invoice will be received.
Hello I need the same thing, but to add nine months to the product that the person has paid. how? Thank Frederic
i try to use this function but when we make the purchase using dummy credit card details the invoice is pending in amember and we can't get set the access. is this cause of dummy card details or do we need to use another event instead of PaymentAfterInsert? if we need to use another event then please let me know.