Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal payment pro credit card number issue


Smoky Barnable

Recommended Posts

Today a customer brought to my attention that if he put spaces when entering his credit card number, which many people do - a space between every 4 numbers, an error is thrown: “This transaction cannot be processed. Please enter a valid credit card number and type.” The customer figured it out but I'm guessing some people would just give up and the sale would be lost. I'm sure this is an easy fix. I just thought I would mention it because I see it as a fairly serious bug. Now that I think about it, the box where you input payment information is pretty primitive....could do with an update.

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Link to comment
Share on other sites

I'm no expert so this is probably best left to some one who understands the PayPal module fullly 😊 , but on a simple form input box you can just use a simple bit of js to auto format the customers input into 4 digit blocks as they input the number. You can test it in the fiddle box.

https://jsfiddle.net/crb13rsd/

 

Link to comment
Share on other sites

Hello Eric,

The easiest step could be to add a placeholder text to the input field saying something like "no blank spaces"

If you are using PayPal direct payment, you would need to edit the payment module:

includes/modules/payment/paypal_pro_dp.php

find line 161 and modify to:

                 '    <td>' . tep_draw_input_field('cc_number_nh-dns', '', 'id="paypal_card_num" placeholder="' . $this->_app->getDef('module_dp_field_card_number_placeholder') . '"') . '</td>' .

then add the language definition to: includes/apps/paypal/languages/english/modules/DP/DP.php:

its a bit different done in the paypal app than in other language files:

module_dp_field_card_number_placeholder = no blank spaces

Then the second step could be to add a pattern check to the input filed which will show an error message if blank spaces are used.

This is a html5 input validation and shows if they try to hit the form submit ("Confirm Order" button).

This would look like follows:

                 '    <td>' . tep_draw_input_field('cc_number_nh-dns', '', 'id="paypal_card_num" placeholder="' . $this->_app->getDef('module_dp_field_card_number_placeholder') . '" pattern="^\S+$"') . '</td>' .

Then if you wish to auto remove blank spaces, try:

line 212:

                        'ACCT' => str_replace(' ', '', $HTTP_POST_VARS['cc_number_nh-dns']),

 

Edited by raiwa
Link to comment
Share on other sites

5 hours ago, Smoky Barnable said:

I'm guessing some people would just give up and the sale would be lost

I'm sure this is true as it's not easy checking if you have enterd the corect number if it looks like this 5457623898234113  It'a all about making it easy for the customer. I personally find this much better to check. 5457 6238 9823 4113 , Also forms that automaticly show it in the 4 digit block are even better.

Customer just enters the numbers and spacing is done automaticly making easy to enter and to check.

image.png.f0065c76027e1d3ea3061b6ce498ad27.png

 

research-media-file-12a64d8c5a2d656a34373afe11e75f83.gif

Edited by JcMagpie

 

Link to comment
Share on other sites

Another way:

Separate the input in 4 input fields, one for each group. Then concatenate them like this:

                        'ACCT' => $HTTP_POST_VARS['cc_number_nh-dns_1'] . $HTTP_POST_VARS['cc_number_nh-dns_2'] . $HTTP_POST_VARS['cc_number_nh-dns_3'] . $HTTP_POST_VARS['cc_number_nh-dns_4'],

 

Link to comment
Share on other sites

  • 3 weeks later...

hmmm... why not use

str_replace(' ','',$string);

to remove all spaces.

  • The clever one learn from everything and from everybody
  • The normal one learn from his experience
  • The silly one knows everything better

[socrates, 412 before Christ]

Computers help us with the problems we wouldn't have without them!
99.9% of the bugs sit in front of the computer!
My programmed add-ons: WDW EasyTabs 1.0.3, WDW Facebook Like 1.0.0

if(isset($this) || !isset($this)){ // that's the question...

 

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...