PayPal Sandbox Invoice Paid but stays in SENT status - paypal

I am testing out the payment of an invoice in the PayPal sandbox environment.
I use the API to create and send the invoice. The status shows as SENT. I click the link returned by the /send method to open an view the invoice. It opens up as expected in my browser in the Sandbox environment. I click on the "Pay" link, and a popup window opens and I process a credit card payment.
However, when I then query the status of the invoice in the API, it remains in SENT status. Should this not advance to PAID?
Also, I have configured the INVOICES.INVOICE.PAID webhook as well as the PAYMENT.AUTHORIZATION.CREATED webook, but neither of them fired when payment was made.
Can anyone tell me what I am missing?

Does the receiving account have a confirmed email identifier within the sandbox environment?
Check and resend any confirmation message within https://www.sandbox.paypal.com/businessprofile/settings/email
Read any confirmation message and follow its link and steps, via https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fnotifications%2F
If that's not the issue, you'll need to post more detailed information of the responses you're getting.

Turns out the issue was that I had to use a specific credit card defined for the account in the Sandbox environment. Once that was done, all processed as expected.

Related

PayPal Express Checkout in Sandbox leaves transactions 'Pending'

I've integrated PayPal Express Checkout using the method at https://developer.paypal.com/docs/checkout/integrate/#1-set-up-your-development-environment , with the JS SDK.
Everything works fine and I am able to create a button with the amount and the transaction succeeds. However, I don't see the money coming into the sandbox business account. I do see the transaction on the sandbox personal account, but it's pending on approval from seller, which I don't see there.
Not sure if this is sandbox behaviour or if I have something wrong.
The src script which I load is:
https://www.paypal.com/sdk/js?client-id=${clientId}&currency='CAD'&disable-funding='credit,card,bancontact,blik,eps,giropay,ideal,mybank,p24,sepa,sofort,venmo'
Any help would be appreciated.
The most likely problem is that the receiving account's email address is not confirmed in sandbox.
To check, navigate to https://www.sandbox.paypal.com/businessprofile/settings/email , log in with the receiving sandbox account, and resend any necessary confirmation message
To open the confirmation message, log in with your live developer account at https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fnotifications%2F and follow the link there to do the confirmation

Did paypal change meaning of cancel url? Or is it a bug?

I maintain a PayPal integration which uses PayPal HTML Buttons and confirms payment using IPNs. This system has been in production for more than 5 years.
The system sets the cancel_return variable to a unique URL for each order. If this URL gets hit (i.e. if the customer cancels at paypal and gets sent to this URL), it first checks the session, to ensure the user hitting the URL is the same one who initiated the order, then cancels the order.
I noticed that several recent transactions have been cancelled even though the transactions at PayPal were successful.
The logs showed that customers are hitting the cancel_return URL - in some cases just after the IPN has been received, and in one case just before the IPN was received.
I found at least one way to reproduce this behaviour:
initiate the order on my site
complete the payment at paypal
return to merchant
use the back button to return to paypal
I then get a message that says "Your payment was completed. To continue shopping, please return to the merchant." One button is provided: "Return to merchant name".
Clicking this button takes the user to the cancel_return URL!!
PayPal's documentation for cancel_return says
A URL to which PayPal redirects the buyers' browsers if they cancel checkout before completing their payments. For example, specify a URL on your website that displays a "Payment Canceled" page.
Default — PayPal redirects the browser to a PayPal webpage.
My question is whether this is an intentional change by PayPal -- if so I expect it will break many sites -- or if this is a bug. I couldn't find a bug report at PayPal.
Yes, they changed the meaning of cancel_url, though they are not acknowledging this as a bug or an intentional change. This is definitely a bug in my opinion (as documented in the question above).
In addition to the steps above (reproducing using the back button), I found a customer click-trail in my server logs where the customer was sent to the cancel_url, without using the back button, soon after PayPal sent the IPN confirming their successful payment. I confirmed that the customer did not want to cancel and did nothing to intentionally cancel their order. Unfortunately I could not find a way to reproduce.
I registered at www.paypal-techsupport.com and submitted a ticket about this issue. After several exchanges, the end result I got was:
This is the information that I received from our engineer.
Its an expected behavior when the customer click on the back button, it will bring back to the cancel_url.
We would suggest you to do some modification so that the order is not being cancel when the customer go to the cancel_url.
With poor customer support like this, I will not be recommending PayPal to any of my clients in the future.
You can post it here and the PayPal folks can pick it up.....
https://www.paypal-community.com/t5/Merchant-Technical-Support/ct-p/mts

Paypal IPN not firing?

I have a question about Paypal IPN, I was wondering when does the IPN activate and send it's message to my website.
I currently have my website that has a buy button. When the client buy the service, he is directed to paypal. Once he pay the service, nothing happen. In order for me to receive the IPN notification, the user has to click "Return to merchant website" or whatever the link is, then I receive the IPN notification.
Is it normal, does it work like that for everyone?
Cause right now, most people when they are done with the payment, just close the website and I don't receive any notification.
Thanks for any help !
Your question leaves a lot of missing information so I will go through each option for you:
Read here about how to setup a sandbox account if you don't already have one: https://developer.paypal.com/docs/classic/lifecycle/sb_create-accounts/
Bare in mind that your sandbox account is entirely separate in every way from your live paypal account. All settings will need to be checked and customised as needed.
Set up your IPN URL on your sandbox account Here: https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_profile-ipn-notify
Once set up, you then need to download and set your code (PHP or something else) to the listener (referenced in the above sandbox profile link). You can find IPN code examples here: https://github.com/paypal/ipn-code-samples
When that's all set you need to set your listener to using the sandbox mode and then log in to your live account and then run the IPN simulator from here: https://developer.paypal.com/developer/ipnSimulator/
Paypal will send messages to your IPN listener and you need to do something with the messages, typically output them into some sort of log file. Any issues, you can read Paypals feedback and IPN data/delivery information here https://www.sandbox.paypal.com/uk/cgi-bin/webscr?cmd=_display-ipns-history&nav=0.3.4 [Found from History->ipnHistory on the Paypal menu] and it should list them out. You can resend any failed or queued or undelivered messages.
Paypal is a terribly documented and terribly structured system for coding with. I hate it. Use Stripe.
I love bullet points.
Paypal claims they will try and resend failed/queued IPNs 16 times over 5 days. I have yet to see this, you need to resend them manually (at least, sandbox ones)
Please remember all the settings and changes you have made to your Sandbox account will need to be also made to your live account before you make your payment system live!
Solution
My return_URL is the location of my IPN.php file which take care of the data sent and received. My problem is that the IPN is only firing when I click the "Return to merchant website" and not when the payment is actually completed
What you have done, from reading your comments, is set your IPN page to being your return from paypal page, this is NOT the way IPN is supposed to work, the IPN page should never be visited by the customer, only ever by Paypal.
Read through my anwser (points 2,3,4) and set up your IPN web link as I have described above, your return_url value should be a basic page to say to the customer "transaction complete". The IPN page is defined on your paypal accounts (sandbox and live) as I stated above.
This will fix your problem.

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?

How to configure paypal sandbox for testing

We have an IPN listener already from integration of another paypal api. Now I want am trying to intregate a payment button to a web soolution, which should then be able to report to the existing IPN listener.
I have a login to the paypal devlopers site. I see the IPN simulator there but as I understand it that allows me to create a message and send it manually. Is there any way to configure my sandbox account to send IPN notifications to the listener when I send a click from the web button to the sandbox. In other words I want the IPN message to be created based on the info I send with the web button, in the same way as it would in the live system, not to be my guess as to what message will be created then. I don't see where to configure the address I want notifications sent to other than for the simulator.
Also, is there any way to test with a currency other than USD?
Thanks,
Adam
For IPN, the easiest way is to pass the URL of your IPN handler in the notify_url variable of your button.
Currency codes can be tested by passing the currency code in the currency_code variable of your button. A list of currencies PayPal supports can be found at https://developer.paypal.com/webapps/developer/docs/classic/api/currency_codes/ .