I am trying to integrate paypal for one time donation save data to database and then mark paid/unpaid using Paypal IPN, I was working with below code yesterday, it was working fine and was redirecting me to sandbox page to pay and then come back. below is my php form <form method="post" action="<?php echo base_url(); ?>controller/function" name="DonationForm" id="DonationForm" class="mt-20">
<input type="number" min="1" placeholder="Amount" id="amount" name="amount" class="form-control"> <!------ here i have some more variables to insert in database--> </form> and below is my codeigniter function $UniqueIdGenrated=md5(uniqid(mt_rand(), FALSE)); $UniqueId=$UniqueIdGenrated; $paypal_email = 'my_sandbox_bussiness_email[at]gmail.com';$return_url = 'https://my_domain.com/controller/payment-successful'; $cancel_url = 'https://my_domain.com/controller/payment-cancelled';$notify_url = 'https://my_domain.com/paypal/listener.php';$currency_code='USD'; $item_name='Donation for a cause'; $item_number=$UniqueId; $amount=$_POST['amount'];$cmd='_xclick';
//$lc='UK';
//$bn='PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest';$querystring = ''; $querystring .= "?business=".urlencode($paypal_email)."&"; $querystring .= "item_name=".urlencode($item_name)."&"; $querystring .= "amount=".urlencode($amount)."&"; $querystring .= "item_number=".urlencode($item_number)."&"; $querystring .= "currency_code=".urlencode($currency_code)."&"; $querystring .= "cmd=".urlencode($cmd)."&";
// Append paypal return addresses $querystring .= "return=".urlencode(stripslashes($return_url))."&"; $querystring .= "cancel_return=".urlencode(stripslashes($cancel_url))."&"; $querystring .= "notify_url=".urlencode($notify_url); header('location:https://www.sandbox.paypal.com/cgi-bin/webscr'.$querystring);
exit(); However today when I started testing again, paypal says "Things don't appear to be working at the moment. Please try again later." I tried keeping below as header, live paypal header('location:https://www.paypal.com/cgi-bin/webscr'.$querystring); then it has taken me properly on paypal payment page below is the screen shot Can anyone please help me, am i missing something 😞
... View more