Automatic discount for certain payment systems

Discussion in 'Customization & add-ons' started by Blue3M, Jan 3, 2005.

  1. Blue3M

    Blue3M Guest

    What we are trying to do is have the aMember script automatically discount the subscription cost for certain payment systems. What we already did was to modify the 'Offline' payment plugin to be our e-Gold payment plugin (since the built in e-Gold payment plugin is not secure) and made the offline.html page display instructions for opening and funding an e-Gold account. What we want to do is setup the system so if a customer selects that plugin (or any others we want to give a discount for using) then the subscription fee will automaticlly discount by 25%. If any one knows how to do this or can point us where to look at it would be greatly appreciated. To see how our payment page is setup now look here..

    https://www.blue3m.com/amember/signup.php

    If you select the e-Gold option you can see how we setup payment page durin the signup process to display the e-Gold instructions and links to the different e-Gold exchangers/dealers. If anyone wants to setup e-Gold as an opton and wants to know how we did it feel free to email me at tech@blue3m.com and I will send them to you. Its much better than the non-secure plugin already in aMember. I am hoping Alex creates a more secure system but I dont think its any lack of his ability but a lack of functioning on the e-Gold system.

    If anyone can help us do this (the automatic discount based on payment system selection.) PLEASE post here or email us at blue3m@blue3m.com

    Mike
  2. Blue3M

    Blue3M Guest

    Alex did it again, and jesus how fast! You see the time stamp when I posted the question to the forum, I submited a trouble ticket to him AFTER that, and he already figured this one out for us!! Thats service!

    Well here is the code snippet to add to the signup.php page..

    if($paysys_id == 'offline'){
    $price = $price * 0.75;
    }

    You want to add this ABOVE the block in the signup.php that looks exactly like the below block, the block is located down about line 340..

    if (is_array($product_id)) {
    $product = & get_product($product_id[0]);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payments($member_id, $product_id,
    $paysys_id, $price, $prices, $begin_date, $expire_date, $vars,
    $additional_values);
    } else {
    $product = & get_product($product_id);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payment($member_id, $product_id,
    $paysys_id, $price, $begin_date, $expire_date, $vars,
    $additional_values);
    }


    So insert that snippet of code above that block and you can change the percentage discount, where the snippet I posted has 0.75 that works out to 25% discount. 0.50 would be a 50% disocunt, 0.25 would be a 75% disocunt, 0.90 would be a 10% discount. You change the 'offline' to whatever payment systems id you want the discount to apply to. If you want to apply it to paypal then change it to paypal, payzip change to payzip, worldpay change it to worldpay, etc.

    This really helps me out, hopefully it will help others out to. I think its an awesome feature, I like it because for our site, if someone pays via eGold, its worth saving 25% since 10% would already get held for 60 days using our CC processor (payzip) it is higher than that for other people processors I am sure. Figure probably 5% of what you get is fees for the authorization, precentage, etc. and you usually have to wait for 2 weeks for your payout, some processor it takes longer. So its worth it for us to give a 25% discount for this method, and it is an incentive for customers who wouldnt order without a deal. Also figure the percentage of sales you can keep from potential chargebacks and the fees that chargebacks come with.

    Hopefully this will be usefull to other people as well. I know the integration we paid to have developed for the PayZip system has benefited a ton of people (Ive seen all the sites utilizing the PayZip system and plugin now).

    For anyone using the PayZip plugin email me at tech@blue3m.com as we tweeked it and it can now be used to get automatic order updates without the customer having to click the "Return to Merchant" button on the payment confirmation page. You have to tweek it slightly and have PayZip setup postback and you need to setup positive and negative return URLs but it makes the whole process instant and completly transparent. Originally customers had to click the 'Return to Shop' button for the order status to get updated but now it can be updated automaticlaly as soon as the payment is authorized. Feel free to email me at tech@blue3m.com for the setup details.

    Mike
  3. Blue3M

    Blue3M Guest

    If anyone else is using the above I had to edit it jsut now, Alex had sent me the right code the first time and it was supposed to have a == sign and not a single = (two ='s not one). Also if you want to make seperate discounts for different paysystems just duplicate the code below and change 'offline' to 'paypal' or 'payzip' or whatever paysystem you want to give a discount for using. Hope this helps some.

    if($paysys_id == 'offline'){
    $price = $price * 0.75;
    }

    Mike
  4. Blue3M

    Blue3M Guest

    If you are using this here is an addition. The steps outlined before work excellent, but they only work for people signing up via the signup.php , anyone RENEWING using the member.php page this does not discount them at all. To discount them you need to find the block of script like below in member.php and add the snippet in above it..

    }

    if (is_array($product_id)) {
    $begin_date = get_begin_date($_amember_id, $product_id[0]);
    $product = & get_product($product_id[0]);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payments($member_id, $product_id,
    $paysys_id, $price, $prices, $begin_date, $expire_date, $vars,
    $additional_values);
    if ($error) break;
    } else {
    $begin_date = get_begin_date($_amember_id, $product_id);
    $product = & get_product($product_id);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payment($member_id, $product_id,
    $paysys_id, $price, $begin_date, $expire_date, $vars,
    $additional_values);
    if ($error) break;
    }
    exit();
    } while (0);
    //if we here, error was occured
    $t->assign('error', $error);
    return;
    }


    So find that area in the php file and add your discount code snippet in directly above it. This is what I have now..


    }
    if($paysys_id == 'offline'){
    $price = $price * 0.75;
    }
    if($paysys_id == 'paypal'){
    $price = $price * 0.90;
    }
    if($paysys_id == 'moneyorder'){
    $price = $price * 0.85;
    }
    if (is_array($product_id)) {
    $begin_date = get_begin_date($_amember_id, $product_id[0]);
    $product = & get_product($product_id[0]);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payments($member_id, $product_id,
    $paysys_id, $price, $prices, $begin_date, $expire_date, $vars,
    $additional_values);
    if ($error) break;
    } else {
    $begin_date = get_begin_date($_amember_id, $product_id);
    $product = & get_product($product_id);
    $expire_date = $product->get_expire($begin_date); //yyyy-mm-dd
    $payment_id = $db->add_waiting_payment($member_id, $product_id,
    $paysys_id, $price, $begin_date, $expire_date, $vars,
    $additional_values);
    if ($error) break;
    }

    $error = plugin_do_payment($paysys_id, $payment_id, $member_id,
    is_array($product_id) ? $product_id[0] : $product_id,
    $price, $begin_date, $expire_date, $vars);
    if ($error) {
    $db->delete_payment($payment_id);
    break;
    }
    exit();
    } while (0);
    //if we here, error was occured
    $t->assign('error', $error);
    return;
    }

    Hope this helps some of you!

    Mike
  5. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Mike,
    thank you for sharing this info with other customers!

Share This Page