I'm integrating Paypal with CakePHP 3.x. but I'm facing problem to get IPN response from PayPal. my site is running on port number 4902.
My form is
<form method="post" accept-charset="utf-8" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<div style="display:none;">
<input type="hidden" name="_method" value="POST">
</div>
<input type="hidden" name="business" value="mypaypalemail#domain.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Test Item">
<input type="hidden" name="amount" value="18">
<input type="hidden" name="cpp_header_image" value="http://example.com/images/logo.jpg">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="shipping" value="4.99">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" id="quantity" value="1">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="custom" value="21">
<input type="hidden" name="cancel_return" value="http://example.com:4902/payments/cancel">
<input type="hidden" name="notify_url" value="http://example.com:4902/payments/ipn">
<input type="hidden" name="return" value="http://example:4902/payments/success">
<div class="submit">
<input type="submit" class="button greenbtn" value="Pay Now">
</div>
</form>
It is working fine if I run this code without any port number. but if I use port number then I get success and cancel response from PayPal but not get IPN response, I had tried with Paypal IPN Simulator, it says me that We're sorry, URL with port number is not allowed for IPN.
And I can't use any other port. can anyone help me please to resolve this issue?
---Edited-----
Like PayPal IPN on a port other than 80 I am not using Nginx server
Thanks.
Related
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.
I have using paypal in my desktop website and it worked. Below is my code:
<?php
......
echo '<form name="form1" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"><div>
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="charset" value="UTF-8">
<input type="hidden" name="cancel_return" value="'.$host.'/my-order-history">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="'.$host.'/payment-done?nid='.$node->nid.'&order='.date("YmdHis",$time).'">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="currency_code" value="HKD">
<input type="hidden" name="handling_cart" value="0.00">
<input type="hidden" name="invoice" value="'.date("YmdHis",$time).'">
<input type="hidden" name="tax_cart" value="0.00">
<input type="hidden" name="business" value="'.$paypal.'">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="amount" value="'.$total_amount.'">
<input type="hidden" name="item_name" value="'.$company_name."-".date("YmdHis",$time).'">
<input id="go_pay" type="submit" name="next" value="confirm" />
</form>';
......
?>
and in payment-done page, I can get the txn_id with $_POST["txn_id"]. But When I use above code in my mobile website, I can pay with paypal by I can't get the txn_id in payment-done page. What can I do to change the code to work in mobile site?
Thank you.
Paypal says the txn_id value is:
The merchant's original transaction identification number for the payment from the buyer, against which the case was registered.
So this seems to imply that if you are not getting a txn_id value back from your transaction, then you're not supplying one to Paypal to use. So this means that you're loosing some data placement in your display flow for transitioning between desktop and mobile display of your website.
This is in a custom PHP eCommerce application. I have no problem receiving and verifying a PayPal IPN response, but it never returns with seller protection eligibility.
This is the generated IPN submission form:
the data has been replaced with dummy data for this question, but it is legitimate data in the application
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name" value="Order #123456789">
<input type="hidden" name="item_number" value="123456789">
<input type="hidden" name="invoice" value="123456789">
<input type="hidden" name="amount" value="50.00">
<input type="hidden" name="first_name" value="John">
<input type="hidden" name="last_name" value="Smith">
<input type="hidden" name="contact_phone" value="123 123 1234">
<input type="hidden" name="payer_email" value="customer#gmail.com">
<input type="hidden" name="address_country" value="Canada">
<input type="hidden" name="address_country_code" value="CA">
<input type="hidden" name="address_city" value="Test City">
<input type="hidden" name="address_name" value="John Smith">
<input type="hidden" name="address_state" value="Provice">
<input type="hidden" name="address_street" value="123 Test Street">
<input type="hidden" name="address_zip" value="A1B 2C3">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="address_status" value="confirmed">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="return_url" value="http://custom-ecommerce-app.com/thank-you.html">
<input type="hidden" name="protection_eligibility" value="SellerProtection">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="notify_url" value="http://custom-ecommerce-app.com/paypal-ipn-notify.php">
<input type="hidden" name="custom" value="">
<input type="hidden" name="business" value="payments#custom-ecommerce-app.com">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="bn" value="PP-BuyNowBF">
</form>
In the IPN response received, protection_eligibility is always Ineligible. This occurs with or without the sandbox. The business/recipient account is configured for seller protection.
I've tried entering generating the submission form with address information that is identical to the profile information of the sandbox customer account, and I get the same result (Ineligible).
What do I need to change in my account or submission form for this to work?
SOLUTION
no_shipping must have a value of 0 (prompt for optional shipping address) or 2 (prompt for required shipping address). Orders with no shipping cannot be eligible for seller protection.
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
.I am developing a site where users can login with paypal and pay for a specific service. Money is transferring correctly. But i always get the status as Pending and reason as paymentreview or reason as unilateral. Is there any way to get the status when it is completed. I am testing this in sandbox. my code is
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST" name="_cart" id="paypal_form">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mybusiness#gmail.com" />
<input type="hidden" id="custom" name="custom" value=""/>
<input type="hidden" id="on0" name="on0" value="0"/>
<input type="hidden" id="amount_1" name="amount_1" value="10" />
<input type="hidden" name="currency_code" value="<?php echo $cntry; ?>" />
<input type="hidden" name="item_name" value="Account Deposit" />
<input type="hidden" id="amount" name="amount" value="10" />
<input type="hidden" name="return" value="RETURN URL AFTER TRANSACTION" />
<input type="hidden" name="notify_url" value="URL FOR UPDATING STATUS AFTER PAYMENT" />
<input type="hidden" name="cancel_return" value="MYSITE.COM" />
</form>
Thank you..
That's what IPN is for. You get a notice sent to you by Paypal that will notify you when you get paid or when your payment status changes. So Paypal will notify you when your payment status goes to Completed