Paypal Payment Integration not returning any values - php

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

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/

Can't get item_name from PayPal return data array

Good morning!
I have an issue with my PayPal payment.
There is my PayPal form:
<form id="upsell_form_paypal" name="_xclick" action="https://www.paypal.com/it/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="admin#test.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="return" value="https://test.com/thank-you.php?type=upsell&payment=paypal">
<input type="hidden" id="upsell_notify_url" name="notify_url" value="https://test.com/payment.php?type=upsell">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name" id="item_name" value="Upsell-1">
<input type="hidden" name="amount" id="paypal_amount" value="0.01"><!-- PRICE -->
<input type="hidden" name="custom" id="paypal_custom" value="170907265"><!-- DEAL ID-->
<input type="hidden" name="payment_type" id="paypal_type_1234565" value="upsell"><!-- DEAL ID-->
<input type="image" class="image" style="margin-top:0" src="https://www.test.com/wp-content/uploads/2016/08/pagadesso.gif" border="0" name="submit" alt="Pay via PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
This array I get after payment. In my notify_url file, I can get all variable values except item_name. item_name is empty and I can't get it value.
What could it be? On Friday item_name working fine and I got its value, but from yesterday I can't get it anymore...

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 info not completing on live version

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.

Categories