PayPal discount can't make it work - codeigniter

I'm trying to setup a discount for a the whole cart using PayPal + Codeigniter, I got this working withouth the discounts.
As far as I've read the only thing that I would need to do is set a hidden field discount_amount_cart as I saw here
Here is my form:
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="paypal_form">
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="business" value="biz_1271300483_biz#xxxx.xx" />
<input type="hidden" name="return" value="http://xxxxxx.com/website/pt/paypal/success/8/4c237a03897e0" />
<input type="hidden" name="cancel_return" value="http://xxxxxxx.com/website/pt/paypal/cancel/8/4c237a03897e0" />
<input type="hidden" name="notify_url" value="http://xxxxxx.com/website/pt/paypal/ipn" />
<input type="hidden" name="custom" value="" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="cpp_header_image" value="http://xxxxxxxxx.com/images/logo.png" />
<input type="hidden" name="image_url" value="http://xxxxxxxxx.com/images/logo.png" />
<input type="hidden" name="invoice" value="4c237a03897e0" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="discount_rate_cart" value="10.00" />
<input type="hidden" name="first_name" value="Foo Bar" />
<input type="hidden" name="city" value="xxxx" />
<input type="hidden" name="address1" value="xxxxxx" />
<input type="hidden" name="zip" value="xxxxxx" />
<input type="hidden" name="lc" value="pt" />
<input type="hidden" name="email" value="xxxxx#xxx.pt" />
<input type="hidden" name="country" value="PT" />
<input type="hidden" name="item_name_1" value="Cloud Hosting WIN Business 25GB" />
<input type="hidden" name="item_number_1" value="200.00000003" />
<input type="hidden" name="amount_1" value="156" />
<input type="hidden" name="quantity_1" value="1" />
<input type="hidden" name="tax_rate_1" value="20" />
<p><input type="submit" name="pp_submit" value="Pagar" class="submit" /></p>
</form>
But when I "post" the fields the discount line won't appear, do I need to activate something in the merchant account, am I doing something wrong?
Cheers

Got it,
From the PayPal documentation:
When you use consolidated discount amounts, you should specify a consolidated tax value in tax_cart. If you do not specify a tax value and your profile specifies a tax rate, your profile tax rate is applied after the consolidated discount value is applied.
So I need to define my "global" tax amount for the cart with tax_cart.

The name of your discount input appears to be wrong:
<input type="hidden" name="discount_rate_cart" value="10.00" />
should be:
<input type="hidden" name="discount_amount_cart" value="10" />
Use discount_amount_cart to charge a
single discount amount for the entire
cart.
Use discount_amount_x to set a
discount amount associated with item x
Use discount_rate_cart to charge a
single discount percentage for the
entire cart.
discount_rate_cart - Applies to
entire cart however, this variable
will only work with the "Upload"
Method. Not the standard Add to Cart
variables.
This variable will be ignored if you
are including any individual sales tax
amount or rate in your upload method
code. This is because the sales tax
needs to be calculated after the
discount is applied to your items
therefore, the discount is applied to
the item Subtotal, not the Total.
Note, If you just using the standard
Add to Cart buttons, there no Discount
variables for the entire cart. as
they "only" apply a Discount to an
individual item.

Related

Transfer data in Thymeleaf

I have two input value like this
<input type="text" th:field="*{itemID}"placeholder="Bidding id" class="form-
control" required />
------------
<input type="hidden" th:field="*{item.id}" />
okay so how can i put the value of item.id field into itemID ?. I tried like below but it didn't work
<input type="hidden" th:field="*{itemID}" th:value="*{item.id}"
placeholder="Bidding id" class="form-control" required />
update
i tried to make it like this, but it still not work
<input type="hidden" th:name="*{itemID}" th:value="1"
placeholder="Bidding id" class="form-control" required />
Try this :
<input type="hidden" th:field="*{itemID}" th:value="${item.id}" placeholder="Bidding id" class="form-control" required />
replace the * by $ in th:value attribute

Grails ajax radio buttons

I'm looking to have two radio groups within a single form. When you select a radio button (product type) form the first group, I'd like to update the second group (quantity) and adjust the price using Ajax. Does Grails offer an Ajax radio solution?
<form>
<div>
Product Type
<input type="radio" name="q1" value="1"/>
<input type="radio" name="q1" value="2"/>
<input type="radio" name="q1" value="3"/>
</div>
<div>
Quantity
<input type="radio" name="q2" value="1"/> ${price}
<input type="radio" name="q2" value="2"/> ${price}
<input type="radio" name="q2" value="3"/> ${price}
<input type="radio" name="q2" value="4"/> ${price}
<input type="radio" name="q2" value="5"/> ${price}
</div>
<input type="submit" name="submit" id="submit" />
</form>
Take a look at the g:formRemote tag:
http://grails.github.io/grails-doc/2.1.0/ref/Tags/formRemote.html

Validation of prefilled contact form fields in Magento fails

My Magento contact form has the field names prefilled, not labelled.
<input name="name" id="name" value="Name" class="required-entry input-text" type="text" />
Since the field is prefilled, the validation "required-entry" fails.
Is there a not-so-dirty way to get the validation working with prefilled values?
just try to use. Placeholder to make prefilled text
<form action="demo_form.asp">
<input type="text" name="fname" placeholder="First name"><br>
<input type="text" name="lname" placeholder="Last name"><br>
<input type="submit" value="Submit">
</form>
that would sure help you.

How can I redirect a customer back to my website after a successful payment with Google Checkout?

I am doing a shopping cart with Google Checkout. I integrated Paypal already like below:
<form name="frmpay" method="post" action="success.php">
<input type="hidden" name="business" value="" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="image_url" value="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" />
<input type="hidden" name="return" value="success.php" />
<input type="hidden" name="cancel_return" value="error.php" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="item_name" value="<?=$res_item[name]?>" />
<input type="hidden" name="amount" value="<?=$_SESSION['amt']?>" />
<?php /*?><input type="hidden" name="shipping" value="<?=$_POST["shipping"]?>" /><?php */?>
<input type="hidden" name="quantity" value="1" />
</form>
How can I integrate Google Checkout like this? How can I return success page after payment in Google checkout? What is the input type for redirect url after successful payment in Google Checkout? I tried a lot for this but I did not get anywhere.
Here is my code:
<form method="POST" action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID" accept-charset="utf-8">
<!-- No product -->
<!-- No tax code -->
<!-- No shipping code -->
<input type="hidden" name="_charset_" />
<!-- Button code -->
<input type="image"
name="Google Checkout"
alt="Fast checkout through Google"
src="http://sandbox.google.com/checkout/buttons/checkout.gif?merchant_id=REPLACE_WITH_YOUR_SANDBOX_MERCHANT_ID&w=180&h=46&style=white&variant=text&loc=en_US"
height="46"
width="180" />
</form>
There is no automatic re-direct for the buyer after the Google Checkout transaction finishes. However, you can provide a link that the user can click and get back to your site after completing the order.
See the continue_url paramenter:
http://code.google.com/apis/checkout/developer/Google_Checkout_HTML_API_Parameter_Reference.html#tag_continue-shopping-url
I have the same problem.
My rough variant is to sell a link to a user, and after the user has successfully paid for the link, he will be redirected to the "thank you" page on Google Checkout, where he will see my link and a message from me, then he clicks on the link and gets back to my site
A link looks like mysite.com/orderhasbeenpayd/1342
but as I said it is a rough variant

Programmatically pass a url to an anonymous proxy like http://www.trycatchme.com

I'm using .net httpwebrequest &/or webclient class
How can i Progamatically pass a url to an anonymous proxy like http://www.trycatchme.com and get back a result
<form method="post" action="/index.php">
<input id="address_bar" type="text" name="q" value="http://www." onfocus="this.select()" />
<input id="surf_button" type="image" value="Surf Now" src="images/surfnowbtn.gif" />
<input type="hidden" name="hl[include_form]" value="1" />
<input type="hidden" name="hl[remove_scripts]" value="1" />
<input type="hidden" name="hl[accept_cookies]" value="1" />
<input type="hidden" name="hl[show_images]" value="1" />
<input type="hidden" name="hl[show_referer]" value="1" />
<input type="hidden" name="hl[base64_encode]" value="1" />
<input type="hidden" name="hl[strip_meta]" value="1" />
<input type="hidden" name="hl[session_cookies]" value="1" />
</form>
The HttpWebRequest.Proxy Property might be what you want.

Resources