paypal info not completing on live version - php

Im having difficulty with paypal, i can get it working perfectly in test mode but not in live mode....
<form class="paypal-form" action=" https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="live#email.ie">
<input type="hidden" name="item_name" value="qparcel">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" id="amount" value="<?php echo $paypal_amount; ?>">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="custom " value="<?=$orderid?>">
<input type="hidden" name="custom_more" value="<?php echo 'test2'; ?>">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="<?php echo get_site_url(); ?>/payment-complete">
<input type="image" src="<?php echo get_option("siteurl"); ?>/wp-content/themes/qparcel/images/pay-with-pp.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
RESPONSE PAGE
if ( isset($_POST['mc_gross']) ) {
// do stuff
}
When Im in test mode this works perfectly, in live mode it does not.
Is there a chance $_POST['mc_gross'] doesnt appear on the live version?

You didn't really explain much here, but it looks like you're trying to use PDT and get transaction data back to your return URL..??
You just need to make sure that's all configured in your live account the same way it's configured in your test account. Those are completely separate from each other, of course, so you have to set them up separately.

Related

How to make sure the paypal notify_url being called from paypal server?

I was working with paypal recurring payment subscription form and using sandbox account for testing
here is my form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="testacc#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Standard Pack">
<input type="hidden" id="item_number" name="item_number" value="1233434-23213">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="user_id" value="13692">
<input type="hidden" id="package_id" name="package_id" value="<?php echo $package_type; ?>">
<input type="hidden" name="a1" value="0">
<input type="hidden" name="p1" value="1">
<input type="hidden" id="t1" name="t1" value="M">
<input type="hidden" id="a3" name="a3" value="10">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input name="return" type="hidden" value="<?php echo base_url();?>package/new_payment_success" />
<input name="notify_url" type="hidden" value="<?php echo base_url();?>package/new_payment_notify" />
<input name="cancel_return" type="hidden" value="<?php echo base_url();?>package/new_payment_cancel" />
<div class="paypal-btn">
<input type="image" src="pay-with-paypal.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style='width: 125px'>
</div>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
and it's working totally fine and sends a success information to notify_url url
now for security purpose im checking HTTP_USER_AGENT from $_SERVER variable but this can be modified too.
so how can i make sure that transection is done successfully before i update my database?
I think that you can verify the whole POST content by appending cmd=_notify-validate and sending it to PayPal. They will answer you with a Verified or Not verified response.
Please, check the link below for more information:
https://developer.paypal.com/docs/classic/ipn/gs_IPN/

Paypal Payment Integration not returning any values

This is my code in PHP for paypal payment integration.Payments are being done successfully. The response URL should be http://codaty.com/success.php?tx=83437E384950D&st=Completed&amt=10.00&cc=USD&cm=&item_number=1 .But I am getting the URL as http://codaty.com/success.php. I am not getting any parameters in return. Is this the right method for integration. Can I get a sample code for reference.
$paypal_url='https://www.paypal.com/cgi-bin/webscr';
$paypal_id='codaty#outlook.com';
<form action="<?php echo $paypal_url; ?>" method="post" name="frmPayPal1">
<input type="hidden" name="business" value="<?php echo $paypal_id; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="QR Code">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="userid" value="<?=$session_userid?>">
<input type="hidden" name="amount" value="0.10">
<input type="hidden" name="cpp_header_image" value="http://codaty.com/images/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="cancel_return" value="http://codaty.com/cancel.php">
<input type="hidden" name="return" value="http://codaty.com/success.php">
<input type="image" src="images/card03.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" class="img-responsive">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Add addition Return method input hidden field <input type="hidden" name="rm" value="2">
1 — the buyer's browser is redirected to the return URL by using the GET method, but no payment variables are included.
2 — the buyer's browser is redirected to the return URL by using the POST method, and all payment variables are included.
And then in success.php :
echo "<pre>";
print_r($_POST);
More details : HTML Variables for PayPal Payments Standard

Paypal Pay Now Button with language support

When the user click on the paypal pay button in my site, it will redirect to paypal payment page, which require the user to enter their paypal credentials. Currently, the paypal payment page is in english. I want it to be in Spanish or other language based on my site language. Below is the post data that i send to paypal.
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $paypal['merchant_account']; ?>">
<input type="hidden" name="return" value="<?php echo $paypal['webpage_url'].$language_path.$paypal['return_url']; ?>">
<input type="hidden" name="currency_code" value="<?php echo $currency; ?>">
<input type="hidden" name="item_name" value="<?php echo $itemName; ?>">
<input type="hidden" name="amount" value="<?php echo number_format((float) $order->getTotal(), 2, '.', ''); ?>">
i tried to do something like :
<input type="hidden" name="locale" value="es_es">
But it does not work. How can I achieve this?
You should be using lc=es_es
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="vimaluk#gmail.com">
<input type="hidden" name="lc" value="es_es">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

How to get Paypal 'Add to Cart' button response?

I m trying to add a Paypal Add to cart button in my application. For that i create code from paypal sanbox. This is my form,
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="EGZD52TPWUERY">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Fees">
<input type="hidden" name="item_number" value="255">
<input type="hidden" name="amount" value="85.00">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:" />
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="my-application/paypal/success">
<input type="hidden" name="tax_rate" value="0.000">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="item_id_<?php echo $res_1->id; ?>" value="<?php echo $res_1->id; ?>" />
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_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>
The payment transaction is completed successfully and the redirect is done perfectly to my application. But the problem is i didn't get any response in that page. I tried var_dump($_POST). It retruns null. Don't know why i didn't get any response. Any help is appreciated.
Check the following link and update your paypal account.The response is in $_GET
https://developer.paypal.com/webapps/developer/docs/classic/products/payment-data-transfer/

Paypal Payment Notification

I would like to have the Notification like if the transaction made is success or failure.
My Code :
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<!--<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="T4ETNVYF7D898">
-->
<input type="hidden" name="business" value="uresh._1304751477_biz#yahoo.com">
<input type="hidden" name="item_name" value="Ramakdu">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="15.00">
<input type="hidden" name="return" value="http://localhost/paypal/">
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_US/i/btn/btn_buynow_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/WEBSCR-640-20110429-1/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<?php
print_r($_REQUEST);
?>
Try this:
<input type="hidden" name="return" value="http://example.com/paymentsuccess" />
<input type="hidden" name="notify_url" value="http://example.com/paymentsuccess">
<input type="hidden" name="cancel_return" value="http://example.com/paymentfailure" />
Return should be a link and not "localhost".
Keep in mind that "notify_url" must be a publicly accessible URL. Return will work for testing, but notify_url is a POST initiated from the PayPal-side, and must thus be publicly acc

Categories