virtuemart 3.0.10 disable double confirmation on checkout - checkout

There is solution.
In my sites on virtuemart I manually (with code editing) do one page checkout (and one step). But after version 3.0.10 my solution no longer work.
Before version 3.0.10 I used follow method:
In cart/tmpl/default.php in bottom of file present hidden inputs.
After <input type='hidden' name='task' value='updatecart'/>
add <input type='hidden' name='task' value='confirm'/>. And it works.
But after version 3.0.10 I found no other option except hack of virtuemart core:
In cart/tmpl/default.php in bottom of file present hidden inputs.
Del <input type='hidden' name='task' value='updatecart'/>
add <input type='hidden' name='task' value='confirm'/>.
In site/components/com_virtuemart/controllers/cart.php
in method display() change
if(($task == 'confirm' or isset($request['confirm'])) and !$cart->getInCheckOut()){
$cart->confirmDone();
to
if(($task == 'confirm' or isset($request['confirm'])) and !$cart->getInCheckOut()){
$cart->checkoutData(false);
$cart->confirmDone();
My English is bad, but hope this will helpful.

There is no need for hacks anymore. VirtueMart 3.0.10 doesn't have double confirmation. Just check "OPC" and "Ajax for OPC" in the VirtueMart configuration - tab "checkout".
If you have chosen shipping and payment and checked the TOS button, the "Check Out Now" button switches to "Confirm Purchase".
One click and it is done.
Best practise will be to delete your old overrides and use the original VirtueMart files. Apply any custom changes to the new original files.

Related

We want to have a customized subscription form, that includes a coupon code input

As I understand it - I cannot use Recurly.js v3 for this... the hosted pages are not very pretty - so we want to style our own, however it seems like the coupon code field is not supported - and its very necessary for our business model.
Am I missing something?
It's definitely supported. Just add an input and use the data-recurly="coupon" attribute:
<input type="text" data-recurly="coupon">
You can see it in the pricing section of the R.JS docs.
I have integrated this into my application in few weeks ago. You can add the following to your page for the coupon code field.
<input type="text" name="couponcode" placeholder="Coupon Code" data-recurly="coupon_code" >
You can get the value by input field name name="couponcode". Following is the PHP code.
'coupon-code' => sanitize_text_field($_POST['couponcode'])

How to use IPN/PDT to display receipt and digital and/or downloadable products after purchase and redirection with PayPal

I have a webshop: energyshop.se which I have successfully managed to setup a Sandbox account at PayPal and to create a Buyer and a Seller account, created a button which I implemented to my site (from the Seller account) and I manage to make a payment through my Buyer account and got redirection to work too, to energyshop.se/tack.
So far so good, now I wonder how do I reach the "product ID" that IPN/PDT sends when the user is redirected? How do I use that holder to display files for download or just for play/listening? And what are the holders/variable that holds the receipt information? I would like to say for example when returned to /tack to display the receipt and then the downloadable item.
Any help is very welcome I have worked n this site for ages now and just want it done, it is for a customer too.
I tried to do something like this (i use wordpress at my thankyoupage):
<div id="receiptform">
<form method=post action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_notify-synch">
<input type="hidden" name="tx" value="TransactionID">
<input type="hidden" name="at" value="P0d7_HmQSAuXh9r-7hG1Rzf_npI2LaFgYHQJyWUsjQHg7WhZARqs3sq6IW4">
<input type="submit" value="PDT">
</form>
</div>
But that just displays a button PDT that when clicked displyas FAIL ERROR: 4002
How do I edit this to just display the content nicely in tx?
Also, I can tell that "its" working because in the address field, when redirected to thank-you-page this reads: http://energyshop.se/tack/?tx=9LJ24270G46097059&st=Completed&amt=10.00&cc=USD&cm=&item_number=1 which leads me to think its A) completed and B) got the info I need. Now is the question how i present this data? What am I supposed to do? A php-script that I...? I cant seem to find any examples on it, just the defnition of the variables for IPN/PDT but that doesnt help me if I dont know where to put or do with it...
You would want to use PDT as you are. When you receive the tx variable and etc back, you have to do a post back to PayPal to verify all of the inforamtion. Then once you have varified the post, PayPal will then send all of the variables back to your script. You can find a bit more on how PDT works at https://www.x.com/developers/paypal/documentation-tools/ipn/integration-guide/IPNPDTAnAlternativetoIPN. There are also some sample scripts on that site as well at https://www.x.com/developers/PayPal/documentation-tools/code-sample/216627 and https://paypaltech.com/PDTGen/

How does Chrome detect Credit Card fields?

In some forms, Chrome autofill prompts with Credit card autofill.
EDIT:Adding screenshot. This is not the same as browser autocomplete. You need not have entered the value in the same form before.
How should I write my HTML form so the browser detects these as Credit card fields and triggers this behavior?
An example of it working with a Stripe form would be ideal.
This question is pretty old but I have an updated answer for 2019!
You can now tell your browser which fields are for credit card info just by naming the <input> correctly.
The following answer is from my original answer from here: https://stackoverflow.com/a/41965106/1696153
Here's a link to the official current WHATWG HTML Standard for enabling autocomplete.
Google wrote a pretty nice guide for developing web applications that are friendly for mobile devices. They have a section on how to name the inputs on forms to easily use auto-fill. Eventhough it's written for mobile, this applies for both desktop and mobile!
How to Enable AutoComplete on your HTML forms
Here are some key points on how to enable autocomplete:
Use a <label> for all your <input> fields
Add a autocomplete attribute to your <input> tags and fill it in using this guide.
Name your name and autocomplete attributes correctly for all <input> tags
Example:
<label for="frmNameA">Name</label>
<input type="text" name="name" id="frmNameA"
placeholder="Full name" required autocomplete="name">
<label for="frmEmailA">Email</label>
<input type="email" name="email" id="frmEmailA"
placeholder="name#example.com" required autocomplete="email">
<!-- note that "emailC" will not be autocompleted -->
<label for="frmEmailC">Confirm Email</label>
<input type="email" name="emailC" id="frmEmailC"
placeholder="name#example.com" required autocomplete="email">
<label for="frmPhoneNumA">Phone</label>
<input type="tel" name="phone" id="frmPhoneNumA"
placeholder="+1-555-555-1212" required autocomplete="tel">
How to name your <input> tags
In order to trigger autocomplete, make sure you correctly name the name and autocomplete attributes in your <input> tags. This will automatically allow for autocomplete on forms. Make sure also to have a <label>! This information can also be found here.
Here's how to name your inputs:
Name
Use any of these for name: name fname mname lname
Use any of these for autocomplete:
name (for full name)
given-name (for first name)
additional-name (for middle name)
family-name (for last name)
Example: <input type="text" name="fname" autocomplete="given-name">
Email
Use any of these for name: email
Use any of these for autocomplete: email
Example: <input type="text" name="email" autocomplete="email">
Address
Use any of these for name: address city region province state zip zip2 postal country
Use any of these for autocomplete:
For one address input:
street-address
For two address inputs:
address-line1
address-line2
address-level1 (state or province)
address-level2 (city)
postal-code (zip code)
country
Phone
Use any of these for name: phone mobile country-code area-code exchange suffix ext
Use any of these for autocomplete: tel
Credit Card
Use any of these for name: ccname cardnumber cvc ccmonth ccyear exp-date card-type
Use any of these for autocomplete:
cc-name
cc-number
cc-csc
cc-exp-month
cc-exp-year
cc-exp
cc-type
Usernames
Use any of these for name: username
Use any of these for autocomplete: username
Passwords
Use any of these for name: password
Use any of these for autocomplete:
current-password (for sign-in forms)
new-password (for sign-up and password-change forms)
Resources
Current WHATWG HTML Standard for autocomplete.
"Create Amazing Forms" from Google. Seems to be updated almost daily. Excellent read.
"Help Users Checkout Faster with Autofill" from Google in 2015.
From this answer https://stackoverflow.com/a/9795126/292060, it looks like Chrome is either matching a regex pattern on the field name, or the form is explicitly using the x-autocompletetype attribute, like this (This example uses "somename" to avoid mixing issues matching on the name):
<input type="text" name="somename" x-autocompletetype="cc-number" />
Practically, you could do both, picking a name that matches, and the x-autocompletetype:
<input type="text" name="ccnum" x-autocompletetype="cc-number" />
Do you have a view-source of the input box in your screenshot? That would show if it's matching on the name or on the x-autocompletetype attribute.
The answer I linked to has several links for more information; I didn't repeat them here.
Some other comments:
I know Chrome pops a question whether to save the credit card information (I don't), but I don't know if it is popping that question regardless of how it detected it. That is, I'm not sure if Chrome will autocomplete separate fields of credit cards along with other fields, or if it needs to save the whole thing as a credit card.
Your question was how to do it, not whether to. But from the comment in your question, I agree that you might not want to autocomplete the credit card fields. Personally I find it disconcerting when it happens, even knowing it's local in my browser (I especially feel this way about the CVV, and get a surprising amount of resistance when I report it). However, there are posts that find it frustrating when a customer wants to use it, has Chrome set up with credit cards, and a website blocks it.
Thanks #goodeye for directing me to the correct answer.
To trigger the Credit Card autofill,
SSL must be enabled on your form
Most variants of standard credit card field names should work if SSL is enabled.
Here is a link to the regexes Chrome uses to trigger detection
As of 04-12-2022 (from the link above)
/////////////////////////////////////////////////////////////////////////////
// credit_card_field.cc
/////////////////////////////////////////////////////////////////////////////
// ... snipped ...
const char kCardNumberRe[] =
"card.?number|card.?#|card.?no|cc.?num|acct.?num"
"|nummer" // de-DE
"|credito|numero|número" // es
"|numéro" // fr-FR
"|カード番号" // ja-JP
"|Номер.*карты" // ru
"|信用卡号|信用卡号码" // zh-CN
"|信用卡卡號" // zh-TW
"|카드"; // ko-KR
Chrome is using autocomplete attribute in inputs for autofill. This will probably be used by other browsers in future if not yet.
autocomplete's actual use is to say whether autocomplete is enabled or not by specifying autocomplete="off". But chrome uses the same for autofill.
Autofill and autocomplete are different, so don't get confused.
Autofill is what chrome uses to fill up forms from what is stored in your autofill settings in your chrome browser.
Autocomplete is what all browsers use to remember what you may have entered previously in the same form by suggesting values as you type. So when you use autocomplete="off" on an input, browser stops suggesting these values.
Coming back to the solution, for autofill to work use cc-number for card number, cc-name for card holder name, cc-csc for cvc and cc-exp for card expiry date in your autocomplete attribute.
Here is a sample that will be compatible with chrome autofill:
<div>
<label for="frmNameCC">Name on card</label>
<input name="ccname" id="frmNameCC" required placeholder="Full Name" autocomplete="cc-name">
</div>
<div>
<label for="frmCCNum">Card Number</label>
<input name="cardnumber" id="frmCCNum" required autocomplete="cc-number">
</div>
<div>
<label for="frmCCCVC">CVC</label>
<input name="cvc" id="frmCCCVC" required autocomplete="cc-csc">
</div>
<div>
<label for="frmCCExp">Expiry</label>
<input name="cc-exp" id="frmCCExp" required placeholder="MM-YYYY" autocomplete="cc-exp">
</div>
If you have credit cards saved in your chrome browser right now, try clicking Run code snippet button above and you can see chrome autofill in action.
Source: https://developers.google.com/web/updates/2015/06/checkout-faster-with-autofill
Chrome also scans thru placeholders.
Example: <input placeholder='dd-mm-yyyy'/> will trigger it to become a credit card field.

How to prevent duplicate PayPal payments?

I have a simple Pay Now button, the code created through the button maker, with a "custom" hidden field added to identify it.
I wonder if there is some additional hidden field I can add to tell PayPal that "This transaction should not be made twice".
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="custom" value="{MYUNIQUEID}">
<input type="hidden" name="hosted_button_id" value="{MYHOSTEDBUTTONID}">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"
border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
As it is now it's unlikely that the customer should be able to pay twice, but I noticed that when the Sandbox had a glitch I succeeded in paying the same transaction twice. Something that I absolutely want to avoid. Not just for the customer, that could get refunded, sure, but also since I don't want my database messed up and I would like to avoid extensive coding to catch duplicate payments...
You would want to add a unique identifier to the "invoice" parameter; <input type="hidden" name="invoice" value="your unique invoice ID"> and enable "Block duplicate payments" within the 'Profile' > 'My selling tools' section on your account at www.paypal.com
Thanks Robert! (above post)
I actually went so far that I was going to ask PayPal Merchant Technical Support about it and just before submitting my question there found a page with the answer -
Avoiding duplicate payments:
https://ppmts.custhelp.com/app/answers/detail/a_id/165
Not sure if you have to log in to see above page so I'm quoting the page here for convenience:
You can avoid duplicate transactions by passing an invoice number to
the PayPal system. This feature is available for Website Payments
Standard, and Website Payments Pro (SOAP and NVP). The PayPal system
will check to make sure the invoice number you pass has not already
been paid in your account, as long as you have configured your profile
to block duplicate invoice numbers.
Example: Invoice 001 has been paid, therefore if 001 is passed to the
PayPal account a second time, it will be denied.
To block this in your profile:
Block accidental payments: You may prevent accidental payments by
blocking duplicate invoice IDs
Login at https://www.paypal.com
Click the 'Profile' subtab
Under 'Selling Preferences' click 'Payment Receiving Preferences'
Choose 'Yes, block multiple payments per invoice ID' if you wish to utilize this feature while passing the "invoice" variable
Scroll to the bottom and click the 'Save' button
To pass the invoice number for Website Payments Standard, you will
need to add a line of code to your existing button code. You cannot
add this code to a button originally created as encrypted. Example
below:
For Website Payments Pro, the parameter you pass depends on the type
of API calls you are making.
For SOAP: InvoiceID
For NVP: INVNUM
When using Pro, if a duplicate invoice number is detected the error
10412 will be returned. For a complete list of the API error codes,
and details regarding the 10412 error Click Here

PayPal PDT is not Returning a tx value in the Query String

I've gone through the (not so helpful) PayPal docs and can't find an easy answer to this problem. When the user returns from PayPal, the URL does not contain a query string and thus I do not receive the 'tx' value (or any other value for that matter).
This is an example of what I'm sending to PayPal:
<form accept-charset="utf-8" action="https://www.sandbox.paypal.com/au/cgi-bin/webscr" id="paypal-form" method="post">
<input type="hidden" name="business" value="dallas_bus#dallasjclark.com">
<input type="hidden" name="cancel_return" value="http://localhost/checkout">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="custom" value="155">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="notify_url" value="http://localhost/paypal-ipn">
<input type="hidden" name="return" value="http://localhost/checkout">
<input type="hidden" name="item_name" value="ABC Company - Order #155">
<input type="hidden" name="item_number" value="155">
<input type="hidden" name="amount" value="8.95">
<input type="hidden" name="discount_amount" value="0.00">
<input type="hidden" name="shipping" value="25.00">
<input type="image" src="https://www.paypal.com/en_AU/i/btn/btn_buynowCC_LG.gif" name="submit" alt="Buy Now">
</form>
Thanks in advance !
You should check the settings at https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments and make sure
Auto Return is set to ON
You have specified a Return URL
Payment Data Transfer is set to ON
There's another much less obvious thing I had to learn through experimentation: your form must not contain a "return" value, otherwise that will override the Return URL in your settings and prevent the Auto Return from working and you'll wind up without the necessary tx parameter. This is a relatively recent development (bug?) at Paypal, because it used to work.
I've just been struggling with this for some time, and another thing that seemingly causes no tx value to be returned is if you have a free trial.
So, if the cost of your service is free for the first 20 days then 4.99 thereafter you won't get a tx value back for the first free payment. If you charge one penny (or whatever your relevant currency is) for the initial 'free' period then you will get a tx value returned.
We actually logged a ticket with PayPal Merchant Technical Services to get to the bottom of this.
We found that over time, some paypal merchant accounts would appear to forget their AutoReturn/PDT settings.
Even though you could go into the Website Preferences and AutoReturn and PDT were both enabled; the account would behave as if they were not enabled.
Follow this procedure to reset the settings ....
Click on Profile.
Click on "My Selling Preferences">
Click on "Website Preferences"
(*) Direct link to this section, in case you can't found it -> https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-website-payments
Disable both Auto Return and Payment Data Transfer.
Save your changes.
Access to Website Preferences again.
Enable Auto Return and Payment Data Transfer again.
Save your changes.
I've got the same problem with sandbox during testing. To fix it I had to verify test accounts in sandbox environment. To verify them use the build-in testing e-mail service. After verifying, paypal sandbox started to sent TX parameter.
A few other reasons why you might not get a tx parameter:
For PDT to work, you must confirm the email address used as the value of business in your button code. If this email address is not confirmed, PDT will not work. If your email address is not confirmed, you will not see the PDT query string appended to your return URL.
When you enable PDT, the URL you are using as the default Auto Return URL must be a valid hostname or IP address or the user will not be auto-returned back to that URL. Make sure you use a valid URL as the URL of where you want the user to go back to or you will not see the intended result.
From: https://ppmts.custhelp.com/app/answers/detail/a_id/469
i have found a method, that worked for me - try to insert this field into your generated form code:
<input type='hidden' name='rm' value='2'>
rm means return method;
2 means post with variables
Than after the user purchases and returns to your site url, then that url gets the POST parameters as well
p.s. if using php, try to insert var_dump($_POST); in your return url(script), then make a test purchase, and when you return back to your site you will see what variables are got on your url.
I had a similar problem - where working from a local server,
i used to get instead of the 'tx' variable, i got a 'auth' variable.
After playing around with it for a while, found that (for some wired reason) if i change my vitrual host and host file, to the real domain, i get the 'tx' variable, where as in my local environment domain i get the 'auth' variable.
That fixed it for me.
Hope this helps anyone.
I also opened a PayPal Merchant Technical Services ticket for this.
For transactions initiated by a PayPal Button. The PayPal back end sometimes loses the monetary values of the pricing structure (even though it shows you, and you can edit the pricing, the back-backend will lose the values and not accept updates).
Symptoms: In Sandbox, the PayPal process will fail after login but before it can show you the screen for choosing the funding source (i.e. which back account or credit card to use). You get the "We're sorry; Things are not working" message.
Create the Button anew and hopefully the pricing is saved this time.