PayPal IPN, how to get chosen price from dropdown menu - paypal

PayPal button can have drop down menu, like:
Option 1 - $5
Option 2 - $10
Option 3 - $15
When I'm processing payment by IDN, how will I get which option user chosen? I'm not sure if I can do it only based on paid price, since tax/fees/currency could change. Does PayPal somehow pass chosen value?
{"address_city":"San Jose","address_country":"United States","address_country_code":"US","address_name":"John Smith","address_state":"CA","address_status":"confirmed","address_street":"123 any street","address_zip":"95131","business":"seller#paypalsandbox.com","custom":"xyz123","first_name":"John","invoice":"abc1234","item_name":"something","item_number":"AK-1234","last_name":"Smith","mc_currency":"USD","mc_fee":"0.44","mc_gross":"12.34","mc_gross_1":"9.34","notify_version":"2.1","payer_email":"buyer#paypalsandbox.com","payer_id":"TESTBUYERID01","payer_status":"verified","payment_date":"13:07:48 Feb 11, 2020 PST","payment_status":"Pending","payment_type":"instant","quantity":"1","receiver_email":"seller#paypalsandbox.com","receiver_id":"seller#paypalsandbox.com","residence_country":"US","shipping":"3.04","tax":"2.02","test_ipn":"1","txn_id":"561648507","txn_type":"web_accept","verify_sign":"AzMNkTxgBvm9UMEVF6xwI2k3UvAsAl6Uv1oAXhmEDejTPin9MM39F2Td"}

PayPal does. Why don't you create an actual sandbox button with a dropdown menu at https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_button-designer&button_type=buynow and test with it, so you can look at the IPN of an actual such button?
You will need to log in to a sandbox business account at www.sandbox.paypal.com first , if you want the IPN to be sent to the one in that account's profile URL. Alternatively, in the button's advanced variable's you can set notify_url= to your IPN listener.

Related

PayPal Checkout API - Defining payments as a donation

I have set up the option to pay payments from my site with the PayPal system API. Everything has been fine for several months.
In a conversation with PayPal customer service I was told that I am sending the payments in a state of payment (for the purchase of a product) and not a donation
And that makes for mistakes
The problem is that because these are non-profit organizations it should be defined as a donation and not a payment
In this guide I have not found how to set it up: https://developer.paypal.com/docs/checkout/integrate/
You are using a Checkout flow, probably with a Smart Button.
If you want to use the Donation flow instead, you can create a Donate button via https://www.paypal.com/buttons
If you want the button to be editable so as to change the email of the receiving 'business' account, in step 2 uncheck the option to save the button at PayPal, and when viewing the code click the option above to remove code protection.

Paypal: Pending payments with Express Checkout

I have implemented Paypal Express Checkout on my website. So far everything seems to work in my sandbox, except that the payments are not processed. Every payment is "pending".
The only reason I get is
RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION
in the API response after executing the payment via API.
I cannot find any documentation on the reason, does anyone know how to fix it?
You have probably already solved the problem, but maybe someone else has similar problem.
I believe the reason for this is because the payments are in a currency that you do not hold, you need to configure your Payment Receiving Preferences in your PayPal account. Otherwise, your payment status might be pending until you manually approve the payment in your PayPal account.
Log in to your PayPal business account at www.paypal.com. Click the profile icon (Profile menu) on the top right side of the page. From the Business Profile menu, select Profile and Settings. (Note: If you do not see the profile icon on the top right, select Profile which appears in the top menu when the My Account tab is selected.)
From the left menu, click My selling tools.
In/under the Getting paid and managing my risk section, click the Update link for the Block Payments item.
Update Allow payments sent to me in a currency I do not hold to "Yes, accept and convert them to U.S. Dollars") and click Save.

Update database after paypal payment successful

i want get transaction id from paypal after customer already paid by paypal account to update my database Please Help.
if you want to get the transaction ID from your PayPal account just login into your PayPal account and go to the "Transaction History", now next to each transaction you can click on details and you can see the transaction ID. If you mean to get this detail through customized code please explain in details your request, Thanks, Andre.
IPN is a message service that notifies you of events related to PayPal transactions. You can use it to automate your back-office and administrative functions and get information on transactions.
In order to use this feature you need first to activate it on your account.
1) Access your PayPal account (www.paypal.com)
2) Click on Profile
3) Click on Instant Payment Notification Preferences
**Please note that if you have new Layout on your PayPal account you need to click on My selling preferences and then on Update just beside Instant payments notifications
4) Click on Choose IPN Settings
5) Add a Notification URL (you must have a listener ready, examples below)
6) Make sure to check IPN messages on Receive IPN messages (Enabled)
7) Click on Save
Make sure also to check every value of the variable notify_url (if you use WPS) in every PayPal button or PAYMENTREQUEST_n_NOTIFYURL (if you use Express Checkout). Their value can overwrite the value you wrote on your PayPal profile for Notification URL.
Please find below some useful links:
Instant Payment Notification:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/
Setting up IPN:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/

How To Make Paypal Return URL Visible Only To Payers?

I need a solution to prevent visitors to reach pay-pal return url ( success page ) if they did not pay or paid but want to visit again .
How can I make a visitor see this returl url only 1 time right after paid via pay-pal ?
Thank you for your helps
You have to enable auto return in your PayPal account, otherwise it will ignore the return field.
From the documentation (updated to reflect new layout):
Auto Return is turned off by default. To turn on Auto Return:
1 - Log in to your PayPal account at https://www.paypal.com. The My Account Overview page appears.
2 - Click the Profile subtab. The Profile Summary page appears.
3 - Click the My Selling Tools link in the left column.
4 - Under the Selling Online section, click the Update link in the row for Website Preferences. The Website Payment Preferences page appears
5 - Under Auto Return for Website Payments, click the On radio button to enable Auto Return.
6 - In the Return URL field, enter the URL to which you want your payers redirected after they complete their payments. NOTE: PayPal checks the Return URL that you enter. If the URL is not properly formatted or cannot be validated, PayPal will not activate Auto Return.
7 - Scroll to the bottom of the page, and click the Save button.
IPN is for instant payment notification. It will give you more reliable/useful information than what you'll get from auto-return.
Documentation for IPN is here: https://www.x.com/sites/default/files/ipnguide.pdf
Online Documentation for IPN: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
The general procedure is that you pass a notify_url parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.

Paypal response slow

This is the process flow of a customer buying our service:
Create campaign
Select a payment method (credit card or paypal). User selects paypal
User is redirected to www.paypal.com and makes the payment
User is redirected to www.mywebsite.com/dashboard (return_url)
User sees his new campaign on the dashboard
When using the sandbox everything is working fine. When using the real service, when the user is redirected to www.mywebsite.com/dashboard, then the new campaign doesn't show up among the records.
I made extensive testing and found that with the live service PayPal gives me the response about 5-10 seconds later than when I am using the sandbox. So when the user is redirected to the his dashboard, the new purchase is not yet inserted into the database that's why it doesn't show up! They need to manually hit F5 after a couple of seconds to display the new record.
What can I do about it?
EDIT
I managed to bring up this delay problem with the sandbox as well. I found that there is a difference between the demo and the live payment:
In the sandbox, after the payment I see a window with the title Your payment is complete saying that I completed the payment, this is the transaction code, and the details will be sent to my email address soon, with two options: Back to the seller account (Back to [sandbox seller account]) and go to the paypal account overview. When I click the first one, it opens another window with the title Thanks for your order saying
Your payment of $0.99 USD is complete
If you are not redirected within 10 seconds, click here.
In the live system after I click Pay Now and the payment is complete, then the first screen does not show up, meaning right after the payment the Thanks for your order page is seen then I am redirected to my website (dashboard) within a few seconds.
How could I generate this delay problem in the sandbox?
In the sandbox when the screen shows up about the completed payment when I click quickly the Back to the seller account link, then I click quickly the click here link on the next screen in order to skip the redirection time, the new purchase does not show up on my dashboard on my website, because the data is not yet written into the database.
So the loading of the Your payment is complete window in the sandbox plus the time I click the Back to the seller account link is enough for paypal to give me the necessary data and for me to insert it into the database.
I guess the solution could be to activate that first screen in the live system, but how? What do you think?
I thought the solution would be to turn off Auto return but I can't. When I turn it off and click Save, I receive an error You have not turned on Auto Return. You must turn on Auto Return in order for Payment Data Transfer to work properly.
Start with adding Payment Data Transfer and Auto Return to PayPal Payment Data Transfer Information.
This is from the official PayPal Documentation:
Payment Data Transfer allows you to receive notification of successful payments as they are made. To use Payment Data Transfer, you need to turn on Auto Return. Here's how:
Log in to your PayPal account.
Click Profile.
Click My selling tools.
Click Update near "Website preferences".
Select On under "Auto Return for Website Payments", and enter your Return URL below.
Select On under "Payment Data Transfer".
Click Save.
The identity token will then appear in the Website Payment Preferences page of your PayPal account under the "Payment Data Transfer" section. For security purposes, we do not email you the identity token.
You'll need to pass this identity token along with the transaction token to us so you can receive confirmation that the payment is complete.
The slow load can be caused be a number of factors. One of which may be code related. Can you please post some code if you have already enabled Payment Data Transfer, and Auto return?