Paypal tax_rate variable is not working - php

I have integrated Paypal standard payment in my php website now i required to send tax in Paypal payment so i have pass tax_rate variable in paypal form, all are working nice but tax is not send in paypal.
My Paypal form code is below.
<form action="<?php echo PAYPAL_URL;?>" name="paypalForm" method="post">
<input type="hidden" name="business" value="<?php echo PAYPAL_EMAIL;?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" id="item_name" value="<?php echo $mainObj->listing_title;?>">
<input type="hidden" name="item_number" id="item_number" value="<?php echo $booking_id;?>">
<input type="hidden" name="custom" value="<?php echo $mainObj->user_id.'__'.$objExtraPostData->message_to_host.'__'.$objExtraPostData->host_call.'__'.$vat.'__'.$mainObj->pay_price.'__'.$guest_invite_id.'__'.$host_invite_id.'__'.$review_guest_invite_id.'__'.$review_host_invite_id; ?>"/>
<input type="hidden" name="amount" id="amount" value="<?php echo $mainObj->pay_price;?>">
<input type="hidden" name="discount_amount" id="discount_amount" value="<?php echo $discount_price;?>">
<input type="hidden" name="tax_rate" value="<?php echo $vat;?>">
<input type="hidden" name="currency_code" value="<?php echo DEFAULT_PAYMENT_CURRENCY_CODE;?>">
<input type="hidden" name="return" value="<?php echo SITE_MOD."nct-paypal/thankyou.php";?>">
<input type="hidden" name="cancel_return" value="<?php echo SITE_MOD."nct-paypal/failed.php";?>">
<input type="hidden" name="notify_url" value="<?php echo SITE_MOD."nct-paypal/notify.php";?>">
</form>

Check if the tax_rate can be used with your payment type. In addition, it might be better when you set your tax rate in your account profile as described beneath.
Transaction-based tax override variable. Set this variable to a percentage that applies to the amount multiplied by the quantity selected during checkout. This value overrides any tax settings set in your account profile. Allowable values are numbers 0.001 through 100. Valid only for Buy Now and Add to Cart buttons. Default – Profile tax settings, if any, apply.

Related

How can Paypal redirect to my website?

I create a function for admin of my website send money back to users using Paypal. I created a button with Paypal. My problem is: when Admin login Paypal with business account then he send money to personal account, Paypal do not redirect to my website.
Here is my code
<form target="myWindowPayment" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payPalForm">
<input type="hidden" name="item_number" value="<?php echo $idProject ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="business" value="charly#zondertag.net">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="<?php echo base_url() ?>crowdpp/backingProject/3">
<input type="hidden" name="cancel" value="<?php echo base_url() ?>crowdpp/backingProject/3">
<input name="item_name" type="hidden" id="item_name" value="Pledging for <?php echo $result->title ?> project" size="45">
<input name="amount" type="hidden" id="amount" value="<?php echo $pledgeAmount ?>" size="45">
</form>
In payment integration,we get two results.
1.successful payment
2.unsuccessful payment
put success page name in return url if successful payment.put failure page name in cancelurl if unsuccessful payment.example.
$setExpressCheckoutRequestDetails->ReturnURL = "http://localhost:8080/success.php";
$setExpressCheckoutRequestDetails->CancelURL = "http://localhost:8080/cancel.php";
<input type="hidden" name="return_url" value="<?php echo urlencode(base_url().'crowdpp/backingProject/3'); ?>">
<input type="hidden" name="return" value="<?php echo urlencode(base_url().'crowdpp/backingProject/3'); ?>">

Custom Parameter for paypal direct payment rest API

I am using paypal REST API for making direct payments.
I want to create internal transaction id before initiating the transaction and use that for identifying the transactions from my end.
I am trying to set id using
$payment = new Payment();
$payment->setId($tId);
Paypal is approving the request and payment is getting done but I am not getting this id in response.
Is there any way by which I can send custom parameters to paypal and get them back in response?
You can use custom variable to pass your custom data, and paypal will return it backto you in post in response.
<input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
<input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php"/>
<input type="hidden" name="item_name" value="Image editing"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
<input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>
<input type="hidden" name="custom" value="<?php echo $sr_no; ?>" />
alternatively you can also pass your id in notify url as query string parameter and you will get it back in return url file.
<input type="hidden" name="amount" value="<?php echo $totalAmount; ?>"/>
<input type="hidden" name="business" value="your_paypal_biz_id"/>
<input type="hidden" name="notify_url" value="<?php echo site_url(); ?>/zad_notify.php?id=5"/>
<input type="hidden" name="item_name" value="Image editing"/>
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="return" value="<?php echo $paypalReturnUrl; ?>"/>
<input type="hidden" name="cancel_return" value="<?php echo site_url(); ?>/payment_error.php?id=<?php echo $sr_no; ?>"/>
Hope this help to you, :)

Trying to set up shipping address for buyers

I'm trying to set up a button that offers buyers the option of inserting multiples
of an item and forces them to enter a shipping address here's the code:
<form action="<?php echo($paypal_url); ?>" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo($paypal_email_address); ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo($item_name3); ?>">
<input type="hidden" name="amount" value="<?php echo($item_price3); ?>">
<input type="hidden" name="currency_code" value="<?php echo($item_currency3); ?>">
<input type="hidden" name="custom" value="<?php echo($mask); ?>">
<input type="hidden" name="undefined_quantity" value="1">
<input type="hidden" name="return" value="<?php echo($paypal_return); ?>">
<input type="hidden" name="notify_url"value="http://www.mywebsite.co.uk/ipn2.php">
<input type="hidden" name="cancel_return" value="<?php echo($cancel_return); ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<!-- Display the payment button. -->
<input type="image" src="/img/PocketMask.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." />
I'm in the process of testing it in the sandbox and the quantity option works fine but there doesn't appear to be an option for shipping address, if anyone could help me with this I'd really appreciate it.
The no_shipping variable determines whether or not you receive the shipping address with the transaction details after a payment completes. There isn't a shipping address field that would appear on the checkout page. The buyer would need to log into their account to select the shipping address to use to complete the payment.

Passing values or variables over to paypal cart

I am developing a website so that a customer can buy gardening products. Currently, a customer can browse products on the website. When they select an individual product, I want them to be able to add to cart using Paypal's custom button. My website is set up so that when a user selects a product, it grabs the information from the database. What do I need to do in order for the product they have added to cart to appear in the Paypal cart? (with its name, and price).
From what I understand, you have to create each individual button for each item on your website. But I do not know what product the customer has selected from the database and my website is set up so that it retrieves the product info from the db.
Hope somebody could help me
A single button can use different products , you must be in a loop. But hidden params would be different.
<input type="hidden" value="Scicssors" name="item_name">
<input type="hidden" value="return.php" name="notify_url">
<input type="hidden" value="10.00" name="amount">
...........................................
There are more than fields required to pass as hidden. You can send these along with form submission button
Refer this link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
You can use a single button for all products. You can change the item_name and amount depending upon the product selected. You can pass userid in item_number field.
When a customer selects the product, query to the database and fetch the product name and amount and update it to the hidden fields.
<?php
$amt = amt from db;
$name = product name from db;
$userid = user's id;
?>
<form name=subs action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<table cellspacing=0 cellpadding=0><tr><td>
<input type="hidden" name="on0" value="user">
<input type="hidden" name="os0" value="<?php echo $user_email; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales#yoursite.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="add">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://yoursite.com/payment-success.php"> //return to this url after payment completed
<input type="hidden" name="cancel_return" value="http://yoursite.com/payment-cancel.php"> //return to this url when payment cancelled
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="CustomValue">
<input type="hidden" name="notify_url" value="http://yoursite.com/payment-confirm.php"> //return instant payment notification to this url where you can get the response from paypal and process it
<input type="hidden" name="event" value="add">
<input type="hidden" name="mnt" value="0">
<input type="hidden" name="amount" value="<?php echo $amt; ?>" id="paypalamt"> //the product's amount
<input type="hidden" name="item_number" id="paypalno" value="<?php echo $userid; ?>"> //you can send the customer/user id with this, so that you can retrieve it after payment completion
<input type="hidden" name="item_name" id="itemname" value="<?php echo $name; ?>"> //here you can set your product name
</td></tr>
</form>

No Credit card option with paypal payment method

I am trying to learn integrating paypal for shopping checkouts. I have created a website with custom cart. Now I have added the paypal integration code after watching this http://www.youtube.com/watch?v=qDbTqeSUrQY&feature=relmfu
It works but only problem is when I try it out with sandbox, or real account from buyers perspective I can't use credit card i.e i need paypal account to perform. I have no idea whether I need to change the code or change settings in paypal. I tried going through their documents nothing is mention, it says i can accept credit card payments in express and standard accounts, but how?
The code I used
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="abhishek.salian.85#gmail.com">
<?php if($_SESSION['cart']) { $total = 0;$i=0;
foreach($_SESSION['cart'] as $product_id => $quantity) {
$product_details = get_product_details($product_id);
$row_cost = $product_details[product_price] * $quantity;
$total = $total + $row_cost; $x=$i+1; ?>
<input type="hidden" name="item_name_<?php echo $x; ?>" value="<?php echo $product_details[product_title]; ?>">
<input type="hidden" name="quantity_<?php echo $x; ?>" value="<?php echo $_SESSION['cart'][product_id]; ?>">
<input type="hidden" name="amount_<?php echo $x; ?>" value="<?php echo $product_details[product_price]; ?>">
<?php $product_id_array = $product_details[product_id]."-".$_SESSION['cart'][product_id].",";$i++; } } ?>
<input type="hidden" name="custom" value="<?php echo $product_id_array; ?>">
<input type="hidden" name="notify_url" value="<?php echo WEBSITE.'paypal/ipn.php'; ?>">
<input type="hidden" name="return" value="<?php echo WEBSITE.'products/thank_you'; ?>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Retun to Flash Shop">
<input type="hidden" name="cancel_return" value="<?php echo WEBSITE.'products/cancel'; ?>">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="currency_code" value="AUD">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"></form>
I believe that's a setting in your seller account - not something you pass in with the form.
Under Profile, fund the "Website Payment Preferences" link and then look for the "PayPal Account Optional" section. Choose "On" and save your settings.

Categories