Paypal dynamic return url not working - php

I am trying to make a paypal payment and I have a problem when returning to my page after the payment is completed.
I want to do it dynamically (so I do not want to set it in the paypal's account option, as I may use this account for other things). This is the form I send to paypal:
<form id="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="notify_url" value="http://zopomobile.es/pruebas/modules/rmaforsat/ipn_paypal.php">
<input type="hidden" name="item_name_1" value="Pago de su orden a Zopomobile.">
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="amount_1" value="259.12">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="custom" value="152">
<input type="hidden" name="business" value="admin-facilitator#zopomovil.es">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="return" value="http://zopomobile.es/pruebas">
<input type="hidden" name="cancel" value="http://zopomobile.es/pruebas/NO">
<input type="hidden" name="rm" value="2">
</form>
I have tried changing the "return" variable to "return_url", still not working.

If you want to automatically re-direct to "http://www.zopomobile.es/pruebas/"
then you need to turn on "Auto Return" on your PayPal profile.
Right now, Auto Return is "OFF" in your profile.
The return parameter is return
https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments
Check above link to turn on the "Auto Return" feature.

Related

Paypal Not working on localhost

I am working a codeigniter project on localhost and In which I am using paypal sandbox payment method for payment.
In which I am facing a problem, The return url is not redirect automatically and also when I click on return merchant button then It is not returning any parameter to my url.
I have set all setting of paypal, I have set the auto return on from paypal account and also set the return url but still i am not getting any response.I am usging this form and parameters.
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr';
<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="PHPGang Payment">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="userid" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="amount" value="20">
<input type="hidden" name="cpp_header_image" value="http://112.196.5.114/psychics/component/images/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://112.196.5.114/psychics/dashboard/profile/return_url">
<input type="hidden" name="cancel_return" value="http://112.196.5.114/psychics/dashboard/profile/cancel_return">
<input type="hidden" name="return" value="http://112.196.5.114/psychics/dashboard/profile/return_url">
<button type="submit" class="btn btn-success"> Add Funds</button>
</form>
I did not get where is my fault.
Your code is fine, just add below line in your code, clear your browser's cache-cookies and try again:
< input type='hidden' name='rm' value='2'>
NOTE 1: After adding above code, PayPal will return response in POST method.
NOTE 2: Recheck and confirm that auto return must be enable from your PayPal business verified account.
You can check response by adding below line in your return page within PHP tag:
print_r($_REQUEST); OR print_r($_POST);
For more help about PayPal button parameters: check documentation

PayPal IPN - Changing from Sandbox to Live stops working

I am using the PayPal IPN System which works perfectly in sandbox mode. All the payments went through successfully and my site updated as required. So, being ready to go live, I change my sandbox links to live links:
$action = 'https://www.paypal.com/cgi-bin/webscr';
But now, whenever the payment form is posted to this address, it ends up at
https://www.paypal.com/webapps/hermes?token=...
which just shows a blank page. No error_log is created on my server.
Here is my form data before the link to PayPal is clicked.
<form name="frm_payment_method" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="business" value="payments#domain.com">
<input type="hidden" name="notify_url" value="http://domain.com/ipn.php">
<input type="hidden" name="cancel_return" value="http://domain.com/cancelled.php">
<input type="hidden" name="return" value="http://domain.com/success.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="lc" value="">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="page_style" value="paypal">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="item_name" value="1 Credit">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" name="amount" value="1.50">
<p><button type="submit" name="submit" class="btn btn-primary">Proceed to PayPal</button>
Cancel</p></form>
Of course, replacing domain.com with my own correct domains.

unable to get paypal post pramenters in the return url

I have one code for passing some custom variables to PayPal and these were collected in the return page, but when trying to get these values it is not working
I have a PayPal form like this :
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="submit.png" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="custom" value="IP"/>
<input type="hidden" name="cmd" value="_cart"/>
<input type="hidden" name="business" value=""/>
<input type="hidden" name="item_name" value=""/>
<input type="hidden" name="item_number" value=""/>
<input type="hidden" name="amount" value=""/>
<input type="hidden" name="page_style" value=""/>
<input type="hidden" name="no_shipping" value="1"/>
<input type="hidden" name="return" value="index.php?action=success"/>
<input type="hidden" name="notify_url" value="index.php?action=ipn"/>
<input type="hidden" name="cancel_return" value=""/>
<input type="hidden" name="rm" value="2"/>
<input type="hidden" name="cn" value="Additional Information"/>
<input type="hidden" name="currency_code" value="AUD"/>
<input type="hidden" name="bn" value="PP-ShopCartBF"/>
</form>
I am successfully returning to the URL after payment. and there I am just trying to print the POST Variable for now and It is not giving me any values.I have tried by both enabling and disabling 'auto return'. In both case I don't get values. Please help me, thanks in advance.
The "notify_url" will be contacted by paypal asynchronously (directly), without you having anything to do with this transaction. So you will never see in your browser any results whatsoever. You should use some kind of logging in your script to see what is actually being sent. Check your web server's access log to see if paypal is actually contacting your script (and make sure it's not "localhost" you're trying from)
If I remember correctly only the transaction id is sent back to the return_url. The notify_url receives that id also. From there you should be able to communicate both pages to fill your needs.

Paypal Integration with PHP

I am using this code to create my subscription for PayPal.
But it is not recognizing any of my input fields. Would you be able to shed some light on why not?
<form method="POST" name="gateway_form" action="https://www.sandbox.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"/>
<input type="hidden" name="currency_code" value="CAD"/>
<input type="hidden" name="return" value="http://www.URL.com/payment/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://www.URL.com/payment/paypal_failure.php"/>
<input type="hidden" name="notify_url" value="http://www.URL.com/payment/paypal_ipn.php"/>
<input type="hidden" name="item_name" value="Monthly Subscription"/>
<input type="hidden" name="discount_amount" value="0.00"/>
<input type="hidden" name="a3" value="49.00"/>
<input type="hidden" name="t3" value="M"/>
<input type="hidden" name="p3" value="30"/>
<input type="hidden" name="src" value="1"/>
<input type="hidden" name="sra" value="1"/>
<input type="hidden" name="srt" value="1"/>
<input type="submit" value="Click Here"></p>
</form>
You need to tell PayPal who is submitting the request by submitting the required URL parameters user, pwd, version, and (recommended but optional) signature, along with the other parameters you're sending in the POST request. See API Overview.
Take a look at this link:
Subscriptions and Recurring Payments Variables
https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside
Also, I suggest you use a hosted button. It makes the whole process very easy.
Well both you guys were right, but the issue that came about was because on my 3rd line there
<input type="hidden" name="cmd" value="_xclick"/>
needs to become
<input type="hidden" name="cmd" value="_xclick-subscriptions"/>
Thanks for your help!

PayPal with IPN enabled invoking error on cmd = "_cart"

I am using PayPal Website Payment Standard with IPN enabled.
Before I was setting cmd variable like this
<input type="hidden" name="cmd" value="_xclick">
but then I canged it to
<input type="hidden" name="cmd" value="_cart">
Also I changed some other variables inside my form
<input type="hidden" name="item_name_1" value="Item1">
<input type="hidden" name="amount_1" value="2">
<input type="hidden" name="item_name_2" value="Item2">
<input type="hidden" name="amount_2" value="2">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="quantity_2" value="2">
<input type="hidden" name="item_number_1" value="121">
<input type="hidden" name="item_number_2" value="122">
But when the form is Posted to PayPal I am getting this error.
Thanks in Advance...
did you add target="paypal" in the form opening tag?
could you show the entire form?
I think that you have to include the upload variable to identify the form as a cart:
<input type="hidden" name="upload" value="1">

Categories