VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Payment VM 1.1 => PayPal / PayPal Pro VM 1.1 => Topic started by: jdl777 on February 06, 2011, 21:46:57 PM

Title: PayPal New API Adds Credit Card Payment Option that causes error
Post by: jdl777 on February 06, 2011, 21:46:57 PM
When you select PayPal New API, it then adds "Credit Card" as a payment method option. If you select that as your payment method, then "Confirm Order", you get the following error:



Obviously this error is because nobody entered any credit card information to check out! It should NOT have a Credit Card option to begin with.

How do we remove this Credit Card option when using PayPal New API? DO we go into the source files and delete the code that would call for that option?

Please advise. It makes little sense why it would do this.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: jdl777 on February 06, 2011, 22:14:04 PM
SOLVED:

in the file: components/com_virtuemart/themes/(your theme)/templates/checkout/list_payment_methods.tpl.php

...I commented out line 113 s shown below:

   <div class="yagendoo_vm_checkout_payment_elements">
         <?php $ps_payment_method->list_nocheck($payment_method_id,  false); ?>
         <?php $ps_payment_method->list_bank($payment_method_id,  false); ?>
         <!--<?php $ps_payment_method->list_paypalrelated($payment_method_id,  false); ?>-->
      </div>

You can see that I have commented out the "paypal related" line. This removed the "Credit Card" option but left the other option intact.

Hope this helps someone who gets lost like I was!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: newbii on February 07, 2011, 10:10:11 AM
Thanks, I had the same problem :-)
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: krofeta on February 11, 2011, 22:24:21 PM
It's remove credit card radio button, but errors remain...
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: piperpilot on February 13, 2011, 04:27:54 AM
I'm working on this...I have narrowed it down to this...

When you have another payment option enabled, you get the option to choose "PayPal".  That choice triggers the checkout module to tell it that there is an express checkout in process.  It sets up some variables that tells the system how to handle everything from that point forward.

Now with ONLY paypal as your payment option, it skips over that choice and the proper variables aren't getting set.

If I can figure out what is telling it to skip over the payment choice screen, I can probably fix this, but VM is very confusing as to the flow.

If anyone has any pointers on where the code snippet that checks for multiple payment options is and skips that step, I'd appreciate it.

PiperPilot
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: piperpilot on February 13, 2011, 05:03:40 AM
Update:

Well I figured out where the code to bypass the payment type selection is.  Its in ps_checkout.php.

If you comment out the following section like I have shown here, it will always ask for a payment method.  This makes the module work properly, but isn't ideal because the selection of a payment type when there is only one is an unnecessary step.  I'm gonna work on figuring out how to bypass this and have the module still work.


        // Redirect to the last step when there's only one payment method
//              if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order$
//                      if ($count <= 1 && $cc_payments==false) {
//                              $vmLogger->debug("Only One Payment, skipping se$
//                              vmRedirect($sess->url(SECUREURL.basename($_SERV$
//                      }
//                      elseif( isset($order_total) && $order_total <= 0.00 ) {
//                              // In case the order total is less than or equa$
//                              vmRedirect($sess->url(SECUREURL.basename($_SERV$
//                      }
//              }

Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: ozkart on February 15, 2011, 11:37:25 AM
What version of VM are you using. I'm on 1.1.7 and I'm also getting the

Invalid Credit Card Number or Credit Card Verification Code.
Error: Invalid Credit Card Number or Credit Card Verification Code.
Error: Failure in Processing the Payment (ps_paypal_api)
Invalid Credit Card Number or Credit Card Verification Code.

But when I opened the ps_checkout.php to comment out the code I found the string "Redirect to the last step when there's only one payment method" however the code under it is not the same as your post.

This is a frustrating bug.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: piperpilot on February 15, 2011, 19:44:48 PM
Quote from: ozkart on February 15, 2011, 11:37:25 AM
But when I opened the ps_checkout.php to comment out the code I found the string "Redirect to the last step when there's only one payment method" however the code under it is not the same as your post.

I am on 1.1.7 I thought.  Post that section and I'll take a look.  I also found the fix to still bypass it but have it work properly.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: ssaarroo on February 15, 2011, 21:31:35 PM
hi,
piperpilot
I am trying to sort it out the problem too.
Actually I am trying to do that just doing files back up and then by copying and past whatever I find in the web web. :P   ;D
I am doing that because my php skills gets a 0 rate ( or under 0)
I found your line code but to me it seems that I can see ( and also do my magic copy and past) only the left half part of the code.
So the right side is missing if I am not wrong.
It is like I can watch only half part of the pic.
I am using VM 1.1.6 and last version of joomla
Thanks to piperlot for your help and to everybody who can participate to this post.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: 4lane on February 15, 2011, 22:30:20 PM
I had the same problem on 1.1.6, and due to a flaw in that build, updated to 1.1.7. In both versions I get the following error when trying to pay by credit card. Note: paying by paypal works fine.

"Error: Error - Paypal did not complete the transaction. Please try again in a little while.
Error: Failure in Processing the Payment (ps_paypal_api)"
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: piperpilot on February 17, 2011, 02:46:18 AM
OOPS...sorry about the cut and paste problem.  I was copying from a terminal window so it got truncated.  Here is the whole section:


        // Redirect to the last step when there's only one payment method
if( $VM_CHECKOUT_MODULES['CHECK_OUT_GET_PAYMENT_METHOD']['order'] != $VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'] ) {
if ($count <= 1 && $cc_payments==false) {
$vmLogger->debug("Only One Payment, skipping selection");
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']."&payment_method_ppex=2", false, false ),"");
}
elseif( isset($order_total) && $order_total <= 0.00 ) {
// In case the order total is less than or equal zero, we don't need a payment method
vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order'], false, false),"");
}
}



If you look at this line here:

vmRedirect($sess->url(SECUREURL.basename($_SERVER['PHP_SELF'])."?page=checkout.index&payment_method_id=$first_payment_method_id&ship_to_info_id=$ship_to_info_id&shipping_rate_id=".urlencode($shipping_rate_id)."&checkout_stage=".$VM_CHECKOUT_MODULES['CHECK_OUT_GET_FINAL_CONFIRMATION']['order']."&payment_method_ppex=2", false, false ),"");

You will see that I added:


."&payment_method_ppex=2"


If you only have Paypal as your payment option, this will fix it so that it uses the express checkout option properly. 

Hope this helps everyone and that the devs might pick this up.  I'll see if I can figure out how to submit a bug and fix to the project when I have time.

Just to re-iterate, you can remove the comment // from my original post and this works fine.

PiperPilot
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: 4lane on February 17, 2011, 22:39:39 PM
Nice job - works well. I'll just need to get in a Paypal logo w/ credit card icons so users know that they'll be paying via Paypal only.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: zanardi on February 18, 2011, 22:08:16 PM
@piperpilot:
thank you for your input, i will surely check your fix as soon as i can, and hopefully include it VM code in time for 1.1.8 release.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: zanardi on February 19, 2011, 11:38:03 AM
Nope. In the clear light of the morning, i can see that this "fix" cannot be included in the code, since it is an hack for those who only use PayPal payment method.
But this sent me on the right track. I think i know what to do now, updates later.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: EdgeCrafter on March 01, 2011, 01:18:19 AM
Any guess on timeframe for 1.1.8, and a fix ..... ?
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: zanardi on March 01, 2011, 23:08:39 PM
@edgecrafter:
this is one of the bug i think i have fixed in the other post "PayPal updates and fixes". All other significant bugs for 1.1.8 are fixed so i think that a BETA 1.1.8 package could be ready in a couple of weeks.
This being spare time work, as usual i can not promise any fixed date. If i have less spare time, it'll take longer. :-)
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: Aglobalweb on March 07, 2011, 22:32:13 PM
Hi Guys,

I have posted a solution for this bug
http://www.aglobalweb.com/aglobalweb/blog/2-virtuemart/48-virtuemart-paypal-api-bugs-and-solutions.html

Check it out,


Regards,
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: zanardi on March 08, 2011, 12:17:28 PM
@Aglobalweb:
i will surely check it soon! Thank you for sharing.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: adham on March 28, 2011, 11:51:13 AM
Dint work for me, if I use express cheout it works ok and goes t Paypal "normaly" but if you check out gives you credit cart error.
I have a credit card process form that appears no matter what, i cant stop it.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: slayer2199 on March 30, 2011, 11:28:05 AM
I just upgraded my site from 1.1.5 to 1.1.8 and had this problem. Aglobalweb's fix worked for me. Thank you!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: FrankA on May 31, 2011, 23:12:08 PM
Aglobalweb thanks!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: Stonedfury on August 24, 2011, 20:52:02 PM
@Aglobalweb Thanks for your fix. It solved a few issues, however there is still the issue.

PayPal API should load its own credit card form and for some reason is not. That is what I have come to the conclusion of.

So far there is a tax issue when submitting to paypal with the api. Easy fix by searching VM forums. There is also a fix to set the new paypal api to send you straight to paypal with credit card option or sign in. I would truly like to find out why the card for this API is not loading its own but instead the "credit card" module. It should have it's own.

Hope that makes sense.
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: ewanvrooyen on September 05, 2011, 22:09:20 PM
Im afraid @Aglobalweb's solution did not work form me in 1.1.8 either.

Anyone, please?
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: ralfeez on September 10, 2011, 20:11:36 PM
I believe that this issue is still a problem. I am using J1.5.23 and VM 1.1.9 and the error still shows "Error: Credit Card Type not found" when "Enable Direct Payment" is not selected. When it is selected, the user can be redirected to Paypal, but cannot use the Credit Card form to enter in information. If they do, the error reads "Error: Error - Paypal did not complete the transaction. Please try again in a little while.
Error: Failure in Processing the Payment (ps_paypal_api)". Please review this bug and post any findings that you may have. Thank you,
Ralph
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: nasowos on January 03, 2012, 15:40:40 PM
Aglobalweb's solution worked for me (1.1.9) - thanks so far!

But I want to voice that it is outrageous, how buggy VM is out of the box!!  >:(
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: crazihel on February 07, 2012, 14:41:27 PM
Quote from: jdl777 on February 06, 2011, 22:14:04 PM
SOLVED:

in the file: components/com_virtuemart/themes/(your theme)/templates/checkout/list_payment_methods.tpl.php

...I commented out line 113 s shown below:

   <div class="yagendoo_vm_checkout_payment_elements">
         <?php $ps_payment_method->list_nocheck($payment_method_id,  false); ?>
         <?php $ps_payment_method->list_bank($payment_method_id,  false); ?>
         <!--<?php $ps_payment_method->list_paypalrelated($payment_method_id,  false); ?>-->
      </div>

You can see that I have commented out the "paypal related" line. This removed the "Credit Card" option but left the other option intact.

Hope this helps someone who gets lost like I was!

Sorry but commenting out this line is not the answer. I want my customers to be able to pay by paypal (using the paypal api method) & by credit cards via a card processor. Commenting out '<?php $ps_payment_method->list_paypalrelated($payment_method_id,  false); ?>' comments out any alternative html-formed based payment methods as well. Can someone please advise of a better solution. Thank you!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: crazihel on February 15, 2012, 14:04:53 PM
Anyone...? This is one of the last things I need to do, please help if you can :) thanks!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: joeleal on February 24, 2012, 05:34:02 AM
I am having the same problem, an i have read everything here, nothing works for me. Can any one help, i will even pay for it!
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: Hermes on March 02, 2012, 13:50:37 PM
Hi There:

I'm having exactly the same problems of all the other users, but I have made one minor change that partially solve my problem, but clearly doesn't solve it.
The solution is one suggested by some users of the forum, and is to comment the following line in the file get_payment_method_paypal_ex.tpl.php:

echo ps_checkout::list_payment_methods( $payment_method_id );

Of course, you can add also the attribute checked to this other line:

<input type="radio" id="paypalExpressID_ecm" name="payment_method_id" value="<?php echo ps_paypal_api::getPaymentMethodId();?>" checked="checked" />

Although this fact only saves a click to the users, which isn't bad, but doesn't solve the real problem.

Dear developers, I have a good level of php, and more or less I have a good Acknowledge of virtuemart, because I have developed many sites with virtuemart.
Anyway I don't understand exactly the logical that virtuemart follows to process the cart, it's a little obscure. I probably could solve if you can tell me something about it.
When user clicks in "Checkout" and Paypal Express is the only method what happens?
I know that this coud sound very comical if it is supposed that I understand php, but I have more or less debbuged the file checkout index, and I don't understand why any about paypal
is generated, any variable, nor ppex_token, nor any session variable about paypal, only $paypalActive is ok, although his value is 1 instead of Y. am I wrong?

I have activate the debug mode in virtuemart but clearly you can find nothing important there and doesn't help to search the problem, at less I haven't found anything relevant.

Please, could tell something related to the logical of the applicattion, in order to try to solve this problem for all the users.
I will work to solve this if you give me some light. My time is also limited as the time of Zanardi, for example.

Thanks in advance, sorry for my english and have a nice day from Spain (Europe)!


Note for users testing Virtuemart and PayPal CheckOut Express in Sandbox:
As far as I know, only accounts created with EEUU as your country works well with virtuemart for testing.
I mean, that I have never get success testing any web if I don't create the sandbox account
with EEUU as my country of residence, and dollars as my currency. And it's important to say
that all payments received by the checkout express will be always returned as "pending".
When you go live all will be ok as expected, but in sandbox NO! All will be "Pending" whatever you do.


Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: korinsama on April 30, 2012, 17:43:57 PM
So, i did all the steps stated in the previous posts, and it works (hurray), but the Checkout with Paypal button still does not redirect to Paypal, it sends me to the confirmation page with this error :

Error: PayPal returned: The field Shipping Address State is required

how do i fix this?
Thanks in advance ~
Title: Re: PayPal New API Adds Credit Card Payment Option that causes error
Post by: Hermes on May 06, 2012, 18:19:15 PM
Please, see this post.
I solved two months ago!

http://forum.virtuemart.net/index.php?topic=99663.msg329290#msg329290

Hope it help you!