Paypal sandbox - test payment - php

I am developing online store application with Laravel 4.2 + Knockoutjs and I want to make test payments with paypal. So I have created new Paypal Sandbox account. Then I login and go to Dashboard->Accounts where I created buyer and seller accounts: test-facilitator#gmail.com and test-buyer#gmail.com. Following this documentation https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/ this is my form:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<fieldset>
<input id="buy" name="submit" type="submit" class="btn btn-primary" value="Buy" id="">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="test-facilitator#gmail.com">
<input type="hidden" name="item_name" value="My online store">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="amount" data-bind="value: amount">
<input type="hidden" name="notify_url" value="my_notify_url">
<input type="hidden" name="return" value="my_return_url">
<input type="hidden" name="cancel_return" value="my_cancel_url">
</fieldset>
</form>
So I am clicking the button, redirected to paypal and I am trying to login with my test-buyer#gmail.com with the password I have set in the sandbox account. And here is the problem - Paypal says that my credentials are wrong. How should I proceed my test payment, what am I doing wrong ?

The problem is that your form action is posting to https://www.paypal.com/....
Your action url should be https://www.sandbox.paypal.com/cgi-bin/webscr

Related

Working with Paypal cancel_return

I'm doing my project with laravel 5 and here I have to do payment with paypal. I got this code and doing well with my payments. But when someone goto paypal and if he return without doing payment cancel_return works.It's fine. But I don't know how to handle the $_GET when return Here is my route also
Route::get('/paypal/cancel','Paypal\PaypalController#paypalCancel');
I'm using this code to move to paypal page with my sandbox account.
form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="cbt" value="Return to example" />
<input type="hidden" name="business" value="xxx#gmail.com" />
<input type="hidden" name="item_name" value="{{$data['p_name']}}" />
<input type="hidden" name="amount" value="{{$data['tot']}}">
<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="return" value="{{url('/paypal/return')}}" />
<input type="hidden" name="notify_url" value="{{url('/paypal/notify')}}"/>
<input type="hidden" name="cancel_return" value="{{url('/paypal/cancel')}}" />
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="image_url" value="" />
<input type="hidden" id="custom" name="custom" value="{{$data['id']}}"/>
<input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
</form>
Just tell me what should I have do when user cancel his payment in paypal login and return..Thanks..
If a user cancels payment in PayPal, the next action is up to you. You can either display a "Payment was canceled" page to inform the user that they canceled the payment, or you can prompt them to try payment again.
The cancel_return URL is purely there so developers can show a friendly message when payment has been canceled.

Paypal payment works on sandbox but not live paypal?

We are facing some issue with paypal business account, under sandbox everything is working fine, bellow is the form we are using for live:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" id="paypalForm">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="email#email.com" name="business">
<input type="hidden" value="1" name="quantity">
<input type="hidden" value="website" name="item_name">
<input type="hidden" value="MDAW" name="item_number">
<input type="hidden" value="0.3" name="amount">
<input type="hidden" value="0" name="shipping">
<input type="hidden" value="http://www.website.com/ipn.php" name="notify_url">
<input type="hidden" value="USD" name="currency_code">
<input type="hidden" value="http://website.com/orderconfirm.php" name="return">
<input type="hidden" value="12" name="custom"> <a class="btn btn-primary" href="selectpixel.php"><i class="fa fa-angle-double-left"></i> Back</a>
<button id="btnOrderForm" class="btn btn-success" type="button">Make Payment via PayPal</button>
</form>
Bellow is the IPN URL where we are receiving custom values correctly while go through sandbox:
http://www.website.com/ipn.php
But we're not sure what is happening with live paypal, we are not able to go back to our site and not even receive custom variable on ipn.php file even after successful transaction.
IPN url is same as sandbox and other then that everything is same.
When the user clicks a 'pay now' button, that will redirect you on paypal and then from payal after payment it messed in case of live paypal transaction, the user can pay successfully but it is not returing back to website and IPN is not hit back to http://website.com/ipn.php url for updating information.
Firstly, your link (http://www.website.com/ipn.php) showing "HTTP 404 - File not found" when access. So, you are quested to modify this page to the available one. You can go to the link (https://github.com/paypal/ipn-code-samples) for PayPal's latest IPN sample code, and then update accordingly to your IPN script page.
Secondly, you can refer to the link (https://developer.paypal.com/docs/classic/button-manager/integration-guide/ButtonManagerHTMLVariables/?mark=html) for the HTML variable for PayPal button. The variable "return" is for the function to redirect your customers to a page after they finish the payment. The variable "notify_url" is designed for PayPal IPN which is for the function to notify the back end of your web server about the transaction information. You can go to the link below for the detais about PayPal IPN (https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/)
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="email#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Test_Item">
<input type="hidden" name="item_number" value="MDAW">
<input type="hidden" name="amount" value="0.3">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="return" value="http://website.com/orderconfirm.php">
<input type="hidden" name="notify_url" value="http://website.com/orderconfirm.php">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="weight_unit" value="lbs">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

paypal notify_url not working and tx ID variable not pass to thank you page

Here is my paypal buy now html code:
<form name="_xclick" action="https://www.paypal.com/ca/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="alex#xumanii.com">
<input type="hidden" name="item_name" value="Bewolf Shooping Cart">
<input type="hidden" name="amount" value="<? echo $grandtotal2;?>">
<input type="hidden" name="add" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="member_id" value="<? echo $info['member_id'];?>">
<input type="hidden" name="return" value="http://www.bewolfclothing.com/thankyou.php">
<input type="hidden" name="notify_url" value="http://www.bewolfclothing.com/notify_paypal2.php">
<input type="hidden" name="cancel_return" value="http://www.bewolfclothing.com/mycart.php">
<input type="hidden" name="undefined_quantity" value="0">
<div class="submit-container"><input class="submit-button" type="submit" name="submit" value="CHECK OUT" /></div>
</form>
In my paypal account, under profile, my selling tools, I have set the AUTO RETURN to ON and I put the thankyou page in there.
After the purchase, it goes to the thankyou page, but the $_REQUEST['tx'] for the paypal transaction ID is not working and the notify_url NEVER gets called.
I searched online and saw that lots of people seem to have trouble with that, but I couldn't find a solution.
notify_url is used to Instant Payment Notification and the url should always be a live URL.
To get the tx ID, you need to
-Auto Return is set to ON
-Valid Return URL
-Payment Data Transfer is set to ON
and in your "http://www.bewolfclothing.com/thankyou.php"
$tx_id = $_GET['tx']; //gives you tx id

PayPal Return URL not working while transferring payment to personal account

It is possible to enable return url for business account editing user website preference, but if I want to transfer money to personal account on paypal, then return url is not working
Please suggest
The HTML code for redirecting to paypal
<html>
<head><title>Processing Payment...</title></head>
<div id="loading_image" style="position:absolute; left:600px; top:300px;">
<img src="themes/theme1/images/waiting.gif" /> Redirecting to Paypal.
</div><form method="post" name="paypal_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="success_url" value="http://url/admin/transactions/index/successfull"/>
<input type="hidden" name="cancel_return" value="http://url/admin/transactions/index/failed"/>
<input type="hidden" name="notify_url" value="http://url/quotes/paypal_ipn"/>
<input type="hidden" name="custom" value="3|4|1|3"/>
<input type="hidden" name="item_name" value="Payment for Job Completion"/>
<input type="hidden" name="amount" value="11.4"/>
</form>
</body></html>
There is no any return url in paypal for success response you have to send success_url variable to paypal to respond back

The link you have used to enter the PayPal system is invalid. Please review the link and try again

I'm trying to test a paypal form through the sandbox, and have created a preconfigured test account.
However, when I go through my paypal form and enter the password I am proceeded with this error:
"The link you have used to enter the PayPal system is invalid. Please review the link and try again."
I am unsure what this error means. I removed my email address I am aware it shows as xxxxxxxx#gmail.com in the example below.
My form is below:
<form name "_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
SteamID: <input type="text" name="item_number" value="<?php echo $steamid;?>" size="45">
<br> <?php echo $possible;?>
<input type="hidden" name="item_name" value="Seriouspants Donation <?php echo $steamid;?>">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="business" value="xxxxxxxx#gmail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://seriouspants.net/customs/paypal/complete.php">
<input type="hidden" name="a3" value="5.00">
<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="sra" value="1">
<br /><br />
<input type="submit" name="Submit" value="Submit">
</form>
The payment email for receiving payment might be on a personal account. Upgrade it to Business account. That worked for me.
My problem was that I hadn't checked my business account.
To get the email sent with code for the test account, you need to access to notifications (https://developer.paypal.com/developer/notifications/)
You needs to create seperate Sandbox account in https://developer.paypal.com (not in the sandbox.paypal.com) where you can create multiple test account inside with fake balance.

Categories