I'm developing an ecommerce website (as a project) and I want to integrate payment gateway in same. In this project when a user clicks on a product at index page, he's redirected to product_detail.php where there is a buy now button which directs him to payment gateway, but I always get the error "BAD_INPUT_ERROR: Things don't appear to be working at the moment. Please try again later."
Here's a part of my code
<form action="<?php echo $paypalURL; ?>" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo $paypalID; ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo $row['name']; ?>">
<input type="hidden" name="item_number" value="<?php echo $row['id']; ?>">
<input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
<input type="hidden" name="currency_code" value="INR">
<INPUT TYPE="hidden" name="charset" value="utf-8">
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='http://localhost/search/cancel.php'>
<input type='hidden' name='return' value='http://localhost/search/success.php'>
<!-- Display the payment button. -->
<input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
</form>
Am I missing something? (I'm a beginner in php and I learned this from a website), also I wasn't able to turn on Auto return in my paypal sandbox account because they weren't able to validate my return URL. Do I need to host my project first so that it accepts my return URL?
Related
I'm using paypal standard payment system to accept payment from my customers. I've made INR as primary in my paypal account.But it gives the error when I pass currency code as INR. I've already referred about this issue with some websites including,
https://www.paypal-community.com/t5/About-Business-Archive/Accepting-Indian-currency/td-p/615019
Here is my code:
<form action="<?php echo $paypal_link; ?>" method="POST">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo $paypal_username; ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo $row['name']; ?>">
<input type="hidden" name="item_number" value="<?php echo $row['id']; ?>">
<input type="hidden" name="amount" value="<?php echo $row['price']; ?>">
<input type="hidden" name="currency_code" value="INR">
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='http://.....'>
<input type='hidden' name='return' value='http:....'>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
Can anybody help to solve this issue?
Please check it which payment method you have purchased. Ex:(DoDirect, ExpressCheckout).
Particular payment method supported the INR. Review everything.
i have following problem.
I integrated Paypal to my website. Now I want to test the PayPal settings. I test it in the sandbox enviroment. So the paying is working very well and after the payment the site redirects to my success.php site.
and there i have a problem.
Normaly it should show something like mywebsite.de/success.php?tx=83437E384950D&st=Completed&amt=10.00&cc=USD&cm=&item_number=1
but it only shows
mywebsite.de/success.php
my code looks like this
paypalURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; //Test PayPal API URL
$paypalID = 'mywebsite#site.de'; //Business Email
<center><form action="<?php echo $paypalURL; ?>" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo $paypalID; ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="1 Monat Premium Mitgliedschaft">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="49.99">
<input type="hidden" name="currency_code" value="EUR">
<!-- Specify URLs -->
<input type='hidden' name='cancel_return' value='http://mywebsite.de/index.php'>
<input type='hidden' name='return' id='return' value='http://mywebsite.de/success.php/'>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynowCC_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form></center>
What did I wrong hand how do i get the invformation of paypal for my success page??
Pass the rm variable with value as 2, refer the below:
<input type="hidden" name="rm" value="2">
Once you pass rm=2 then you will see the below variables after the buyer redirect to your website:
http://mywebsite.de/success.php/?amt=10.84&cc=USD&item_name=XXXXX&st=Completed&tx=XXXXXXX
hear is my code for paypal payment it redirects to login of paypal gateway,
but i want it redirect to direct payment page so that if i haven't paypal account
i can countinue with that option.
<?php
$paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
$paypal_id = 'gohilpriyank-facilitator#ymail.com';
?>
<div class="form-group row-fluid">
<div class="span6">
<span style="font-weight: bold">Ship To Address:-</span>
<div><?php echo $ship_to['ship_address']; ?></div>
<div><?php echo $ship_to['ship_landmark']; ?></div>
<div><?php echo $ship_to['ship_city']; ?></div>
<div><?php echo $ship_to['ship_state']; ?></div>
<div><?php echo $ship_to['ship_pincode']; ?></div>
</div>
<div class="span6">
<span style="font-weight: bold">Choose Payment Mode</span>
<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="Kevalam Payment">
<input type="hidden" name="item_number" value="<?php echo count($this->cart->contents()); ?>">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="userid" value="1">
<input type="hidden" name="amount" value="<?php echo $_SESSION['grand_total']; ?>">
<input type="hidden" name="cpp_header_image" value="http://k1-pc/myriad/assets/user_temp/image/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="cancel_return" value="http://k1-pc/myriad/cancel.php">
<input type="hidden" name="return" value="http://k1-pc/myriad/success.php">
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">
</form>
</div>
</div><div class="clear"></div>
When using Payments Standard like this the Guest Checkout (direct credit card) option is displayed differently based on the cookies set for the current browser.
If you've ever signed in to any PayPal with the same browser it will find a cookie and assume that you'll be signing in again, so it will show you a landing page that really pushes the login aspect of PayPal checkout.
If you clear your browser cache/cookies (or just try a fresh browser) you should see a different landing page where the Guest Checkout option is more prominently displayed.
If you switch to the Express Checkout API instead of using Payments Standard you can force Guest Checkout to be displayed more prominently regardless of browser cookies. The SetExpressCheckout request includes parameters you can use to adjust the checkout pages accordingly.
Since you're using PHP, I'd recommend taking a look at my PHP class library for PayPal. It would make integrating Express Checkout very simple for you. Basically, it consists of the following API calls, which are included in the /templates directory with the library.
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment
The parameters you'll use to handle the Guest Checkout options are in the SetExpressCheckout request and consist of...
SOLUTIONTYPE=Sole
LANDINGPAGE=Billing
USERSELECTEDFUNDINGSOURCE=CreditCard
I'm trying to set up a button that offers buyers the option of inserting multiples
of an item and forces them to enter a shipping address here's the code:
<form action="<?php echo($paypal_url); ?>" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="<?php echo($paypal_email_address); ?>">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo($item_name3); ?>">
<input type="hidden" name="amount" value="<?php echo($item_price3); ?>">
<input type="hidden" name="currency_code" value="<?php echo($item_currency3); ?>">
<input type="hidden" name="custom" value="<?php echo($mask); ?>">
<input type="hidden" name="undefined_quantity" value="1">
<input type="hidden" name="return" value="<?php echo($paypal_return); ?>">
<input type="hidden" name="notify_url"value="http://www.mywebsite.co.uk/ipn2.php">
<input type="hidden" name="cancel_return" value="<?php echo($cancel_return); ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<!-- Display the payment button. -->
<input type="image" src="/img/PocketMask.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." />
I'm in the process of testing it in the sandbox and the quantity option works fine but there doesn't appear to be an option for shipping address, if anyone could help me with this I'd really appreciate it.
The no_shipping variable determines whether or not you receive the shipping address with the transaction details after a payment completes. There isn't a shipping address field that would appear on the checkout page. The buyer would need to log into their account to select the shipping address to use to complete the payment.
Basically I just want to turn off the button after people purchase the art and send them a receipt. I would also like to have a copy of their information. This is what I am passing through my array:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="email#mydomain.com" />
<input type="hidden" name="item_name" value="<?php echo $title; ?> (ID:#<?php echo " {$p['id']}" ?>)" />
<input type="hidden" name="item_number" value="<?php echo "{$p['id']}" ?>" />
<input type="hidden" name="amount" value="<?php echo "{$p['price']}" ?>" />
<input type="hidden" name="shipping" value="39.99" />
<input type="hidden" name="return" value="http://mydomain.com/thankyou.php" />
<input type="submit" value=" " class="button" />
</form>
How do I setup a sold field in my database and show/hide my button in php?
IPN, API which do I need to use to make it happen?
Cheers!
I would setup the IPN listener to mark the item's status as sold in it's database table (you are generating that form based on a database?) when the IPN comes back "VERFIFIED" and payment_status = 'Complete'. Then, only generate that form when the item is not sold.
If you don't know how to implement an IPN listener, here is a tutorial: PayPal IPN with PHP