Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default can't switch between PayPal and Micropayments accounts

    I'm having trouble getting PayPal Micropayments to work. I'm using ZC 1.5.5e with PayPal Express Checkout. I've created a second PayPal account to use with micropayments, added its credentials to /includes/extra_configures/paypal_micropayments_credentials.php and set the threshold there as 15, so any purchase below $15 should use my micropayment credentials.

    Here's what I've tried:
    • Using the micropayments code already included in 1.5.5e's paypal_curl.php
    • Replacing it with Dr Byte's code from this thread https://www.zen-cart.com/showthread....d-Credit-Cards (the original post #1 and the mod in post #30, just in case that might fix anything).
    • Installed a vanilla install of 1.5.5f to a test site and done nothing to it except set up Express Checkout with my normal credentials and the includes/extra_configures/paypal_micropayments_credentials.php file with my micropayments credentials.


    In all cases, the same thing happens: no purchase amount seems to trigger the switch to micropayments - my regular PayPal credentials are always used, no matter how small the purchase price.

    (I've also tried changing my PayPal credentials in admin to the micropayments credentials, to make sure that account works, and it does - it's just the switching between them that never seems to be triggered.)

    I'm baffled! Does anyone have any ideas what else I can try, please?

  2. #2
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: can't switch between PayPal and Micropayments accounts

    Further to this, I'm wondering if anyone is actually using the micropayments code successfully (to switch between a regular PayPal account for higher-value payments, and a micropayments-enabled PayPal account for low-value payments, to minimise fees)?

    When I searched the forum logs, I can't find any mention since 2013. It seems like such a useful feature that all PayPal users should be using it to save money on fees. Is everyone using it successfully, hence no posts on the subject, or does nobody use it at all?

    I'd be grateful to know if anyone has managed to get this working on the latest version of Zen Cart, just so I know it is possible!

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: can't switch between PayPal and Micropayments accounts

    pretty lame of paypal - you want to give lower rates on small transactions, do it! don't make people jump through hoops to have a second account.

    ok, rant over.

    - i have never used paypal live on a ZC site.
    - the code does not look like rocket science.
    - unless you are getting special rates from paypal, your threshold should be set at $12. for a $12 transaction, the fee is the same.

    first off did you create the following file:

    /includes/extra_configures/paypal_micropayments_credentials.php
    Code:
    <?php
    /**
    * Micropayments Credentials
    */
    define('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIUSERNAME', 'insert your API-Username from your Micropayments account here');
    define('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIPASSWORD', 'insert your micropayments API password here');
    define('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APISIGNATURE', 'insert your micropayments API signature here');
    define('MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD', '12');
    assuming you created that file, it looks like the incorporated changes are all in the latest version of v155, which can be found here:

    https://raw.githubusercontent.com/ze...aypal_curl.php

    are you sure you have the same file as the one i just referenced? if that is the case and it is still not working, we can add a few lines to see what is the problem. the switch only happens on line 518.

    just prior to that, we can add some echo statements to see why it is not switching.

    Code:
    echo MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIUSERNAME. '<------->';
    echo MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIPASSWORD. '<------->';
    echo MODULE_PAYMENT_PAYPALWPP_MICROPAY_APISIGNATURE. '<------->';
    echo MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD. '<------->';
    print_r($pairs);
    die(__FILE__ . ':' . __LINE__);
    try placing an order and lets see what comes back on the screen, and post the results here. if a normal paypal transaction comes through and it is not stopped on the screen, then you have a configuration issue.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: can't switch between PayPal and Micropayments accounts

    Thanks very much for the help, Carl. Yes, I confirm that I have the credentials file in place and I've replaced my paypal_curl.php file with the one you linked to, just in case. I tried to 'buy' one of the test products in a clean install of Zen 1.5.5.f (all I've added to it are the credentials file with my micropayments details and my regular PayPal details in the PayPal Express Checkout module).

    Adding your extra lines of code, I get this response (I've replaced my actual credentials with *****s):

    *****<------->*****<------->*****<------->15<------->Array ( [PAYMENTREQUEST_0_AMT] => 10 [PAYMENTREQUEST_0_ITEMAMT] => 10 [L_PAYMENTREQUEST_0_NUMBER0] => ROPE [L_PAYMENTREQUEST_0_NAME0] => Rope [154] Length: per Foot [L_PAYMENTREQUEST_0_QTY0] => 10 [L_PAYMENTREQUEST_0_AMT0] => 1 [PAYMENTREQUEST_0_CURRENCYCODE] => USD [LOCALECODE] => CA [GIFTMESSAGEENABLE] => 0 [GIFTRECEIPTEENABLE] => 0 [GIFTWRAPENABLE] => 0 [GIFTWRAPNAME] => [GIFTWRAPAMOUNT] => 0 [BUYEREMAILOPTINENABLE] => 0 [CUSTOMERSERVICENUMBER] => [BRANDNAME] => PlanetJune [PAYMENTREQUEST_0_PAYMENTACTION] => Sale [ALLOWNOTE] => 1 [SOLUTIONTYPE] => Sole [LANDINGPAGE] => Billing [NOSHIPPING] => 0 [RETURNURL] => https%3A%2F%2Fwww.planetjune.com%2Fzen%2Fipn_main_handler.php%3Ftype%3Dec%26zeni d%3D6b1bec37aaf8849e8cd9c51925f6f85c [CANCELURL] => https%3A%2F%2Fwww.planetjune.com%2Fzen%2Findex.php%3Fmain_page%3Dshopping_cart%2 6ec_cancel%3D1%26zenid%3D6b1bec37aaf8849e8cd9c51925f6f85c [PAGESTYLE] => Primary [METHOD] => SetExpressCheckout ) /home/plan5078/public_html/zen/includes/modules/payment/paypal/paypal_curl.php:523
    Does this give any clues?

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: can't switch between PayPal and Micropayments accounts

    it does!

    it looks like paypal express does NOT make the switch while payal pro does. can you confirm that you are using paypal express?

    when we look at the if statement, it is looking for an element known as:

    $pairs['AMT']

    which is not visible if your array. which is why the switch is never happening.

    it also looks your order was for $10 - can you confirm that as well?

    there also is a situation with the method. the if statement looks for a method:

    ['METHOD'] == 'DoExpressCheckoutPayment'

    while your array method is set to:

    SetExpressCheckout

    we have a couple of choices. can you move to paypal pro? else we will have to make some code changes. and again, i refer you to my first post, i have never used paypal pro on a live site! so if we want to make some changes, it will be the blind leading the blind - unless others want to chime in. it looks like we can use PAYMENTREQUEST_0_AMT as a replacement for the AMT element - although i could be wrong.

    hope that helps!

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: can't switch between PayPal and Micropayments accounts

    Aha, okay. Yes, I'm definitely using PayPal Express, and yes, my test order was for $10.

    I'd prefer not to switch to PayPal Pro, as there's a $35/month fixed fee for Pro, and the whole point of this is to give less money to PayPal, not more

    I'm happy to be a guinea pig for blind-leading-the-blind code changes, if you can give me some guidance there - I can run some test amounts through the test shop I've set up to be reasonably sure it works properly before pushing it through to my live shop. I've been struggling with this for weeks and I'd really like to get it working.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: can't switch between PayPal and Micropayments accounts

    ok. try switching the if statement at line 518 to this:

    PHP Code:
        // Adjustments if Micropayments account profile details have been set
        
    if (defined('MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD') && MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD != ''
            
    && ((($pairs['AMT'] > && $pairs['AMT'] < strval(MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD) )
                    || (
    $pairs['PAYMENTREQUEST_0_AMT'] > && $pairs['PAYMENTREQUEST_0_AMT'] < strval(MODULE_PAYMENT_PAYPALWPP_MICROPAY_THRESHOLD)) )
               || (
    $pairs['METHOD'] == 'GetExpressCheckoutDetails' && isset($_SESSION['using_micropayments']) && $_SESSION['using_micropayments'] == TRUE))
            && 
    defined('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIUSERNAME') && MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIUSERNAME != ''
            
    && defined('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIPASSWORD') && MODULE_PAYMENT_PAYPALWPP_MICROPAY_APIPASSWORD != ''
            
    && defined('MODULE_PAYMENT_PAYPALWPP_MICROPAY_APISIGNATURE') && MODULE_PAYMENT_PAYPALWPP_MICROPAY_APISIGNATURE != '') { 
    please copy it exactly as the parenthesis can get a little confusing.

    let us know what happens! i'm not sure if the return string is somehow different between pro and express. but we will see!

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: can't switch between PayPal and Micropayments accounts

    I've tried it in my test shop, with low and high value items, and it seems to be making the switch correctly between my two accounts! I'll do a little more testing before I put it into my live shop and I'll report back again once I've successfully had some real sales (both high and low value) in my actual shop.

    Thank you so much - I'll send a donation your way once I know it's all working :)

  9. #9
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,685
    Plugin Contributions
    9

    Default Re: can't switch between PayPal and Micropayments accounts

    cool.

    please let us know if it works, so that the team can incorporate it into the base code.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  10. #10
    Join Date
    Jul 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: can't switch between PayPal and Micropayments accounts

    Confirmed - after running it in my live shop for a couple of days, it's working perfectly! Thanks again Carl :)

    And I have a little advice for anyone else reading this outside the US who'd like to set up a second PayPal account for micropayments (to avoid relatively high fees for low-value transactions): the standard threshold of $12 only applies if you and most of your customers are US-based, making the standard PayPal fee 30c + 2.9%.

    For me in Canada, that percentage is 2.9% for Canadian orders, 3.7% for US orders and 3.9% everywhere else (and the micropayments fee goes from '5c + 5%' to '5c + 6%' for intl orders) - that would make my micropayments thresholds $11.90 for Canada, $19.23 for US and $21.82 for international - but you can only set one threshold with this code. As the largest fraction of my orders are from the US, I've settled on $19 as my threshold - YMMV depending on your and your customers' locations.

 

 

Similar Threads

  1. v154 How to switch between http and https
    By su35 in forum General Questions
    Replies: 4
    Last Post: 11 Jul 2016, 02:54 PM
  2. v139h PayPal Micropayments
    By jgold723 in forum Addon Payment Modules
    Replies: 1
    Last Post: 16 Mar 2013, 12:26 AM
  3. can I use 3 different paypal accounts in one store?
    By nay27uk in forum Basic Configuration
    Replies: 1
    Last Post: 29 Apr 2010, 05:01 PM
  4. What's the difference between PayPal IPN and PayPal Express?
    By taliesin in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 11 Sep 2007, 05:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR