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.
Related
My paypal payment completed successfully but after payment,I don't get transaction detail like transaction id, currency, price, item,receipt no etc...
before 15 days its working properly. but now its not working.
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-
bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="kin#kinskards.com">
<!-- Specify a PayPal Shopping Cart Add to Cart button. -->
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Birthday - Cake and
Candle">
<input type="hidden" name="amount" value="3.95">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="cancel_return"
value="http://localhost/PayPalDemo/PayPalDemoCancel.php">
<input type="hidden" name="return"
value="http://localhost/PayPalDemo/PayPalDemo/Succes.php">
<!-- Display the payment button. -->
<input type="image" name="submit"
src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_addtocart_120x26.png"
alt="Add to Cart">
<img alt="" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif">
</form>
You must pass notify_url parameter like cancel_return.
<input type="hidden" name="notify_url" value="http://localhost/PayPalDemo/PayPalDemoPayment.php" />
Also you must set this URL in sandbox account in IPN section. Refer this https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimulator/
Paypal have CUSTOM param in its API... I want multi-dimension array pass in CUSTOM field...
<form id="paypal_form" action="https://sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="user#paypal.com">
<!-- 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="Hot Sauce-12 oz. Bottle">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="currency_code" value="USD">
<!-- Prompt buyers to enter their desired quantities. -->
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="notify_url" value="http://www.myurl.com" />
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online" />
<input type="hidden" value="1" name="custom[]" />
<input type="hidden" value="11" name="custom[]" />
</form>
its working fine with single custom field but multi custom field is not working...
you should pass all values like 1,2,3,4,5,6....
return url you will get custom string and convert it to array of string
I am developing a website so that a customer can buy gardening products. Currently, a customer can browse products on the website. When they select an individual product, I want them to be able to add to cart using Paypal's custom button. My website is set up so that when a user selects a product, it grabs the information from the database. What do I need to do in order for the product they have added to cart to appear in the Paypal cart? (with its name, and price).
From what I understand, you have to create each individual button for each item on your website. But I do not know what product the customer has selected from the database and my website is set up so that it retrieves the product info from the db.
Hope somebody could help me
A single button can use different products , you must be in a loop. But hidden params would be different.
<input type="hidden" value="Scicssors" name="item_name">
<input type="hidden" value="return.php" name="notify_url">
<input type="hidden" value="10.00" name="amount">
...........................................
There are more than fields required to pass as hidden. You can send these along with form submission button
Refer this link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
You can use a single button for all products. You can change the item_name and amount depending upon the product selected. You can pass userid in item_number field.
When a customer selects the product, query to the database and fetch the product name and amount and update it to the hidden fields.
<?php
$amt = amt from db;
$name = product name from db;
$userid = user's id;
?>
<form name=subs action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<table cellspacing=0 cellpadding=0><tr><td>
<input type="hidden" name="on0" value="user">
<input type="hidden" name="os0" value="<?php echo $user_email; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales#yoursite.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="add">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://yoursite.com/payment-success.php"> //return to this url after payment completed
<input type="hidden" name="cancel_return" value="http://yoursite.com/payment-cancel.php"> //return to this url when payment cancelled
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="CustomValue">
<input type="hidden" name="notify_url" value="http://yoursite.com/payment-confirm.php"> //return instant payment notification to this url where you can get the response from paypal and process it
<input type="hidden" name="event" value="add">
<input type="hidden" name="mnt" value="0">
<input type="hidden" name="amount" value="<?php echo $amt; ?>" id="paypalamt"> //the product's amount
<input type="hidden" name="item_number" id="paypalno" value="<?php echo $userid; ?>"> //you can send the customer/user id with this, so that you can retrieve it after payment completion
<input type="hidden" name="item_name" id="itemname" value="<?php echo $name; ?>"> //here you can set your product name
</td></tr>
</form>
I am developing a website so that a customer can buy gardening products. Currently, a customer can browse products on the website. When they select an individual product, I want them to be able to add to cart using Paypal's custom button. My website is set up so that when a user selects a product, it grabs the information from the database. What do I need to do in order for the product they have added to cart to appear in the Paypal cart? (with its name, and price).
From what I understand, you have to create each individual button for each item on your website. But I do not know what product the customer has selected from the database and my website is set up so that it retrieves the product info from the db.
Hope somebody could help me
A single button can use different products , you must be in a loop. But hidden params would be different.
<input type="hidden" value="Scicssors" name="item_name">
<input type="hidden" value="return.php" name="notify_url">
<input type="hidden" value="10.00" name="amount">
...........................................
There are more than fields required to pass as hidden. You can send these along with form submission button
Refer this link https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
You can use a single button for all products. You can change the item_name and amount depending upon the product selected. You can pass userid in item_number field.
When a customer selects the product, query to the database and fetch the product name and amount and update it to the hidden fields.
<?php
$amt = amt from db;
$name = product name from db;
$userid = user's id;
?>
<form name=subs action='https://www.paypal.com/cgi-bin/webscr' method='post'>
<table cellspacing=0 cellpadding=0><tr><td>
<input type="hidden" name="on0" value="user">
<input type="hidden" name="os0" value="<?php echo $user_email; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="sales#yoursite.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="add">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://yoursite.com/payment-success.php"> //return to this url after payment completed
<input type="hidden" name="cancel_return" value="http://yoursite.com/payment-cancel.php"> //return to this url when payment cancelled
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="CustomValue">
<input type="hidden" name="notify_url" value="http://yoursite.com/payment-confirm.php"> //return instant payment notification to this url where you can get the response from paypal and process it
<input type="hidden" name="event" value="add">
<input type="hidden" name="mnt" value="0">
<input type="hidden" name="amount" value="<?php echo $amt; ?>" id="paypalamt"> //the product's amount
<input type="hidden" name="item_number" id="paypalno" value="<?php echo $userid; ?>"> //you can send the customer/user id with this, so that you can retrieve it after payment completion
<input type="hidden" name="item_name" id="itemname" value="<?php echo $name; ?>"> //here you can set your product name
</td></tr>
</form>
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