Problems with posting Paypal values - php

It is assumed that using the form, variables are passed by post method to return page, but it is not doing that, and I don't know what I can do about it, since transit through the Paypal website is out of my control.
Any idea?
This is my button. I have the same situation with another one.
<form name="_xclick" 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="name#dom.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="item_name" value="Algo">
<input type="hidden" name="amount" value="8.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="item_number" value="<?php echo $_GET['id'];?>">
<input type="hidden" name="custom" value="<?php echo $_GET['sub'];?>">
<input type="hidden" name="return" value="http://www.web.com/ok.php">
<input type="hidden" name="cancel_return" value="http://www.web.com/ko.php">
<input type="image" src="http://www.paypal.com/img/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal">
</form>

You can pass the variables by setting them as url parameters in the return page. Like this:
<input type="hidden" name="return" value="http://www.web.com/ok.php?id=<?php echo $_GET['id'];?>&custom=<?php echo $_GET['sub'];?>">

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 - PHP SDK vs simple form

Are there any advantages with PHP SDK over simple form like:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="business" value="buisnesstest#bla.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="produktname">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.bla.com/?whopay=123"/>
<input type="hidden" name="cancel_return" value="http://www.bla.com"/>
<input type="image" name="submit">
</form>
When it's only for a membership and not like multiple shopping items with many details and quantities and so on?

paypal success url return null

i have simple paypal checkout form when i post it to paypal with sandbox credential when the paypments success, it gives me nothing like transaction and currency, i did print GET, but there is nothing. i am using codeigniter
below is the form code
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_click">
<input type="hidden" name="business" value="dev1#ferozitech.com">
<input type="hidden" name="item_name" value="test" class="slug">
<input type="hidden" name="item_number" value="2" class="proposalId">
<input type="hidden" name="custom" value="" class="userId">
<input type="hidden" name="amount" value="40" class="amount">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="<?php echo base_url('payment/payment_complete/') ?>">
<input type="hidden" name="cancel_return" value="<?php echo base_url('payment/payment_cancel') ?>">
<input type="image" name="submit" src="<?php echo base_url('images/checkoutpaypal.png'); ?>" alt="PayPal - The safer, easier way to pay online">
</form>
Try this code:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="dev1#ferozitech.com">
<input type="hidden" name="item_name" value="test" class="slug">
<input type="hidden" name="item_number" value="2" class="proposalId">
<input type="hidden" name="custom" value="" class="userId">
<input type="hidden" name="amount" value="40" class="amount">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="lc" value=""/>
<input type="hidden" name="no_note" value="1"/>
<input type="hidden" name="return" value="<?php echo base_url('payment/payment_complete/') ?>">
<input type="hidden" name="cancel_return" value="<?php echo base_url('payment/payment_cancel') ?>">
<input type="hidden" name="notify_url" value="<?php echo base_url('payment/payment_complete/') ?>" />
<input type="image" name="submit" src="<?php echo base_url('images/checkoutpaypal.png'); ?>" alt="PayPal - The safer, easier way to pay online">
</form>
Return url notify_url payment_complete function
print_r($_REQUEST);die;

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 IPN unable to change currency type from USD to GBP

Here's the form...
<form method="post" name="paypal_form" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="business" value="email_address"/>
<input type="hidden" name="return" value="URL"/>
<input type="hidden" name="cancel_return" value="URL"/>
<input type="hidden" name="notify_url" value="URL"/>
<input type="hidden" name="item_name" value="item_name"/>
<input type="hidden" name="amount" value="30.00"/>
<input type="hidden" name="mc_currency" value="GBP"/>
<input type="submit" value="Pay online now.">
</form>
Problem is it's always in USD, despite the mc_currency value and I've tried a whole bunch of permutations to no effect. Ideas?
Use currency_code
<input type="hidden" name="currency_code" value="GBP">

Categories