Paypal dynamic subscription button ipn - paypal

I am using this code I found:
<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="me#example.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<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">
</form>
When you generate a button from paypal site, it gives you the option to select the link where to send the ipn. My question is, how do I get the ipn confirmation using the code above or how do I set the link for it?

To add IPN notifications to this button specifically you can just add an additional hidden field to the form.
<input type="hidden" name="notify_url" value="http://www.domain.com/ipn-listener.php" />
That will only trigger an IPN for the initial transaction, though. If you want to get IPN's for all payments associated with this profile from there on you'll need to configure IPN in your PayPal account profile under the Instant Payment Notification Preferences section. Simply turn it on and set the URL you want to use.
At that point, the account profile setting will be sort of a default IPN that your account will use for all transactions. However, this can be overridden using notify_url (or NOTIFYURL in API requests.)
Hope that helps.

Related

PayPal instant payment notification (IPN) sandbox

I am trying to enable PayPal IPN on my website. I am now facing some issues with the tests environment - PayPal sandbox.
I am trying to integrate with PHP, so I am using the code of the file paypal_ipn.php from https://github.com/paypal/ipn-code-samples.
I have a test HTML page with which I send the POST actions to paypal_ipn.php:
<form target="_new" method="post" action="http://example.com/paypal_integration/paypal_ipn.php">
<input type="hidden" name="business" value="your#paypal_email.com">
<input type="hidden" name="item_name" value="product name">
<input type="hidden" name="amount" value="1" >
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="custom" value="CUSTOM_CODE_#...">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://example.com/paypal_integration/return.php">
<input type="hidden" name="cancel_return" value="http://example.com/paypal_integration/cancel_return.php">
<input type="hidden" name="cbt" value="description">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="http://example.com/paypal_integration/paypal_ipn.php">
<input type="submit" value="submit!" />
</form>
The result is "INVALID". How do I go through this problem, in the sandbox environment and after that in live environment? I.e. how to get "VERIFIED" actions in sandbox?
I have solved this:
in paypal account go to https://developer.paypal.com/developer/ipnsimulator/ ;
after that, fill the form: in "transaction type" choose for instance "cart checkout";
in "IPN handler URL" put the link of the IPN receiver page: http://example.com/paypal_integration/paypal_ipn.php
or:
in paypal account, create test accounts: https://developer.paypal.com/developer/accounts ;
log-in with the facilitator account, and then create a test button as indicated here: https://developer.paypal.com/docs/classic/paypal-payments-standard/ht_test-pps-buttons/ (go to: https://www.sandbox.paypal.com/pt/cgi-bin/webscr?cmd=_button-designer );
use the button code, eg.: <input type="hidden" name="hosted_button_id" value="6RNT8A4HBBJRE">, in the button of the website and then simulate a purchase.

how to change the name in the "cancel and return to" link on the express checkout

i'm creating a small marketplace where several sellers can sell their products and each has their own express checkout link, depending on their email.
my form is like this:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="form_paypal">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="bn" value="wa_dw_2.0.4">
<input type="hidden" name="business" value="receiver#gmail.com">
<input type="hidden" name="receiver_email" value="receiver#gmail.com">
<input type="hidden" name="amount" value="123.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.me.com/return.php">
<input type="hidden" name="item_name" value="Product Title Goes Here">
<input type="hidden" name="undefined_quantity" value="0">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="custom" value="12345">
<input type="hidden" name="cbt" value="Return to MY WEBSITE NAME">
<input type="hidden" name="cancel_return" value="http://www.me.com/failure.php">
<input type="hidden" name="notify_url" value="http://www.me.com/notify.php">
</form>
note that i set the "cbt" value as per https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/ but it's not working :( the return link still shows
"cancel and return to receiver#gmail.com"
which is confusing and just plain ugly for the buyer.
any ideas what i'm doing wrong here?
it's the same on the sandbox or the live version, i might add.
The document says "cbt : Sets the text for the Return to Merchant button on the PayPal Payment Complete page.For Business accounts, the return button displays your business name in place of the word "Merchant" by default. " This means you will see this text on the PayPal thank you page after the buyer completes the payments . Something like below :
First, what you're using here is Payments Standard, not Express Checkout. Eshan is correct with the information he provided regarding the parameter you're working with...it doesn't come up until after the payment is completed.
If you were actually using Express Checkout you would indeed have control over what you're asking about via the BRANDNAME parameter. It would still say "Cancel and return to" but then whatever you set for BRANDNAME would get output after that.
To my knowledge Payments Standard does not give you access to adjust the cancel link like EC does.

paypal buy button return the customer details

I am trying to do a mobile shopping cart and wish to make the process as simple as possible.
The client selects the products and I calculate the totals.
He clicks buy now and the total is sent to paypal express.
The product details are stored in our own database.
We need to only allow delivery to paypal account holder address and only verified accounts
I don't want the client to have to enter his delivery address (as it is stored at paypal).
So how can I ease the pain and get the customer details.
I am redirecting back to a page on the mobile when site when completed. Can I pass the data when this happens?
I am using a buy now button:
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" id="business" value="payment#xxxx.com">
<input type="hidden" name="currency_code" id="currency_code" value="USD">
<input type="hidden" name="item_name" id="item_name" value="Teddy Bear">
<input type="hidden" name="amount" id="amount" value="12.99">
<input name="return" type="hidden" value="http://xxxx.com?pageToJump=pagePayPalCompleted" /> <input name="cancel_return" type="hidden" value="http://xxxx.com?pageToJump=pagePayPalCancelled" />
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
MrWarby.
If you are using a Buy Now button this information is not passed back by default, you would need to enable PaymentDataTransfer: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/paymentdatatransfer/ or InstantPaymentNotification https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/

paypal IPN works with Destop web-browsers but not mobile web-browsers

Hi I have an issue where I have a PayPal form on my website when I click to pay using a Desktop web-browser, the transaction completes with all IPN Posted data from PayPal being correct! However when I use an android or IOS device the transaction completes, but there is no Posted data from PayPal when user clicks the return to business-name site? Now if I do another transaction with the Desktop web-browser using an android user-agent, I get the same results that is happening with the mobile devices (No IPN posted data from PayPal)? My form:
<form action="https://www.sandbox.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="hug33472-facilitator#hugtech.com">
<input type="hidden" name="item_name" value="Power-Ball Roller Android App">
<input type="hidden" name="item_number" value="PBRAND0114">
<input type="hidden" name="amount" value="1.37">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://hugtech.com/cgi-bin/pbandroid/secret">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cancel_return" value="http://hugtech.com/power_ball/mob">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Thanks, Larry
It sounds like you're confusing PDT and IPN. They're very similar except that PDT is meant to send data back to your return URL while IPN is meant to send data to an entirely separate script that isn't part of your checkout flow. IPN is the recommended method of updating your database, sending out emails, etc. Based on what you're saying about clicking the return link, though, you must be using PDT.
I haven't specifically tested PDT with mobile checkouts, but I know IPN does trigger regardless of the payment method or device. So make sure you're using IPN, not PDT, and you'll be fine.

Implementing PayPal IPN with custom cart use

I am trying to set up PayPal's IPN for custom cart use. But somehow it does not work. Can you guys have a look at the PayPal button code I am using? Do you notice any problems? Once I click on the Pay button, I am taking to PayPal's page that has the follow message:
We have detected a problem with this shopping cart. If the problem persists, please contact the merchant.
Questions:
What is the right way to name these variables: item_numberX or item_number_X? And the same with variables responsible for: price, name, and quantity. Do I need to add the underscore?
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="item_name_1" value="Service 1">
<input type="hidden" name="amount_1" value="148.00">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="mc_gross_1" value="148">
<input type="hidden" name="item_number_2" value="2">
<input type="hidden" name="item_name_2" value="Service 2">
<input type="hidden" name="amount_2" value="30.00">
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="mc_gross_2" value="30">
<input type="hidden" name="return" value="http://www.sitename.com/thank-you/">
<input type="hidden" name="notify_url" value="http://www.sitename.com/ipn.php">
<input type="hidden" name="first_name" value="Peter" />
<input type="hidden" name="last_name" value="James" />
<input type="hidden" name="payer_email" value="alex111#gmail.com" />
<input type="hidden" name="item_number" value="144" / >
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"
border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
Thank you.
You have most of the button right, the only variables I see issues with are "mc_gross_x", "payer_email" and "item_number". I am not sure where you got mc_gross_x at, but this would not be used in a button, you may have it confused with an IPN variable. As for payer_email, again you may have this confused with an IPN variable. If you are trying to populate the buyers email address on the PayPal payment page, it would just be "email". Also, you do not need to pass "item_number", since you are using the cart upload method, you would just use the format that you are already using up above in your code"item_number_x".
If the button still does not work for you, I would need to see the rest of the bottom code to see why it is not working.