Paypal won't send sandbox transaction data to IPN - javascript

I have spent 9 hours today working with Paypal, and I have an issue that I can't find the solution for.
I am using the Paypal Javascript Buttons github script for creating dynamic page generated buttons for simple Buy Now transactions.
The button example output is generated by PHP (so is dynamic) and looks like this (featuring sandbox details):
<script src='https://site-addr/includes/js/paypal-button.min.js?merchant=siteemail-facilitator#gmail.com'
data-callback='https://site-addr/account/listener.php'
data-tax='0'
data-env='sandbox'
data-shipping='0'
data-currency='GBP'
data-amount='1.00'
data-quantity='1'
data-custom='$2y$10$BdA/7xN2S/fzRq8X9p4pFOmzYBpia/u7sWsAcWN/4w9NZVXduaUzu'
data-number='20165'
data-size='Large'
data-locale='UK'
data-host='www.sandbox.paypal.com'
data-type='button'
data-cancel_return='https://site-addr/account/basket.php'
data-return='https://site-addr/account/complete.php'
data-name='Site Name Tickets'
data-button='buynow'
async='async'></script>
This generates a perfectly good simple click form for purchasing via the Paypal interface.
Meanwhile, I have downloaded the IPN listener from the Paypal Github and updated the details as required, also downloading the cacert.pem file
from here.
I have run the Paypal IPN simulator which gives me correct results via my listener.php file, giving a correct feed out of full data and VERIFIED each time I run the test.
The Issue
But, when I run the sandbox purchase using the above details, the purchase runs correctly but I get no feedback to my IPN listener, I also get no transaction details on my sandbox Transaction notifications. But I DO get details on the sandbox Paypal account that the purchase was successful and the purchase has completed ok.
Things I've tried
I have read a lot of Paypals documentation and found their approach to providing a clear and concise guide to setting anything by Paypal up, very fraught. I have read about 40 pages of their documentation including finding out various ueful posts from Stack Overflow (whom Paypal directly reference for helpful solutions rather than providing their own).
Solutions that have tried and failed:
This similar question did not provide any clear solution.
This question gives some help and confirms that the transactions should be the acceptable web_accept type.
This question (answer) gives clear advise to use data-notify_url rather than the data-callback as specified on the JavascriptButton github
data-notify_url='https://site-addr/account/listener.php'
But the above replacing data-callback does not work. The transaction still appears to succeed but not transaction or IPN data is recorded.
removing / replacing various data- entities, with no success.
I have full PHP error reporting throughout my site and no errors of any form are generated.
Further considerations
I'm sure some of you will be saying, well I should use the SDK downloads for doing this sort of thing, but the scope of the SDK is huge and my need is relatively simple, and the Paypal documentation leaves an awful lot to be designed. Also their (on a range of Paypal github deposits) are using MySQL_ requests on example code as well as addslashes and other things that are years out of date.
Also it's worth noting that while the Paypal documentation for the Javascript Button generator accepts the account email or the account Code, giving the account code causes a critical error and prevents payments (real or sandbox) being processed.
Coupled with this the finding of only piecemeal guidance information as well as "loops" in the documentation such that I'm on one topic, and it says "oh if you want to find out how to do this, follow this link", and then following the link it's more verbose text written for non-developers (on the developer portal) and then a link to another text block before a link back to the text to start with.
Sorry this is turning into a Paypal moan, but as far as possible I would like to avoid using the huge SDK system for what should amount to a straight forward send and recieve data operation.
Any helpful examples with solving this issue?
Final note:
Last month I made a payment system on Stripe that does exactly the same thing, it took four hours and works perfectly.
(I can't use Stripe here as client has an existing Paypal account and won't change).
Solution:
With the help from David Nguyens answer below, I found the issue in my case was that I had set up the IPN and enabled the IPN
and given the correct address for it, but this was on the Live
account rather than the sandbox account, despite only setting up
the sandbox account after all the details on the live one had been applied.
Paypals Live and Sandbox profiles are entirely mutually exclusive
and sandbox creation will not import any data from the live account
it is associated with.

Troubleshoot the issue further on Paypal
investigate IPN logs on Sandbox Paypal to see what and where the data is sent to, linked are the production URL and sandbox URL.
check the status code, if you are getting 5xx type error - debug your script
this should tell you WHERE the IPN is sent to, if it isn't what it should be check:
ipn URL in the button
ipn URL in profile is overriding

Related

How can I get attachment content from an Outlook mail in a Node.js Outlook add-in?

First of all, being a student, I lack some experience to understand everything about what I tried and what I try. But still, I feel like I've tried pretty much every solution available on the net.
I'm developing a Yeoman based Outlook add-in (full javascript with Node.js) for my company, and I came to the point where I need to get the attachments from a mail, not just the informations like size, file type or name of the attachments, I need the full content, in base64 if possible (in order to produce a .eml file containing the mail body and attached files).
I've found multiple ways to do so, problem is none of them work :
first I tried with the messy microsoft documentation, and the first solution that I found is this one : https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/get-attachments-of-an-outlook-item, problem is that with this solution I need to make use of c#, but my add-in is full js, and I need to find a solution that works with JS and Node.js
then I looked for a solution that allows me to communicate a way or another with the Exchange Server to get the attachments content, and I found this : https://github.com/gautamsi/ews-javascript-api, but this was not working with browser oriented add-in (and I need my add-in to work on both client and browsers), so I made use of this : https://github.com/gautamsi/ews-js-api-browser. I found some code samples in the first link and here : Save outlook Email attachment using ews-javascript-api npm in node JS that helped me build something (using the second link's example's syntax on the third link's sample code) that was supposed to work, but coming to the point where I'm trying to get the attachments from the mail, I get a lot of informations from the attachment, but anything related to it's content is null, and the next step where I "Load" the file returns an error 500 from the "service" with "the document is empty", and I still don't know why yet.
finally, I tried to take a step back, looking on google for office api and how to get attachment content, and I've found this link : https://blog.mastykarz.nl/office-365-unified-api-mail/ that almost looked to good to be true, and I was right : according to microsoft doc, I need a token in order to make work the office 365 api url, token given by Azure AD when an administrator authorizes you to obtain it (or so do I think, this is the part where the microsoft doc is the messier). Problem is, while connecting on Azure AD, I get an error displaying on the screen from the website (absolutely no details about the error), and some places that I need to access in order to get my token just wont work, displaying another error message without any details or just never loading.
I've reduced as much as possible the size of my question, not wanting to drown you under informations, sample codes, links and pics so, sorry if it may look both too long and too poor in details.
Thank you for your time, feel free to give any solution, suggestion or advice that come to your mind !
doing the same thing, solution I found:
Get exchangeToken in client (Office.context.mailbox.getCallbackTokenAsync())
Send token, attachmentsIds, emailID to server (C# in my case, nodejs in your case)
Use EWS Managed API 2.0 or in your case ews-javascript-api to handle loading email mimecontent (contains email + attachments) or attachment mimecontent.
Upload file to another service or do whatever you want with it.
Before I switched to C# for serverside I was using a nodejs one for testing, so if you have questions feel free to ask.

Firebase Authentication via "Magic-Link"

I want to send notification mails to users of my community platform coded with react and firebase. I was wondering is there is a way to authenticate the user via a magic link which is contained in his or her personal notification mails.
E.g. You've got 5 new comments on your post click HERE to read them
Clicking "here" should redirect the user to the page and automatically authenticate him without having to enter their individual passwords or usernames.
Due to the cancelation of the privacy shield framework and Schrems II, you might no longer be able to store customer details in the GCP.
A solution for it can be pseudonymization.
I am running an open-source project that can help you with that.
Check out the following article for more information:
https://databunker.org/use-case/schrems-ii-compliance/
I think your question can be divided into 2 different questions.
1. How do I send notification mails to my community platform?
I have never used notification mails in Firebase, I usually use google's SMTP server directly and send a request to the server to send an email on behalf of me. So, in your case, I would search up the library on your tech stack (for me it was Go's gomail), then you can use Google's SMTP server (host:smtp.gmail.com, port:587).
2. How do I make a link that automatically authenticate your users whenever they click the link?
I feel like this is the harder question. I think you need to consider a few things:
Your links need to be short lived. Why? to prevent unauthorized brute force login attempt (this also depends on the structure of your link). However, best practices suggests that links should be short lived (less than 24 hours).
Given that links are short lived, this depends on whether the user checked their email frequently for notification from you! There's a pretty good chance that they will miss that email in the 24 hour window.
I'm pretty much against sending time sensitive notification like that through emails. But if it is something that you still want to do, it is pretty easy to create the link, the simplest way I did it was:
Generate a random uuid for a link.
Associate it to the user who will login with the link. You should save this association in a persistent data storage.
Create an endpoint for magic link, for example /magic/:link_id that takes link_id then checks what user should be logged in.
Voila! You got yourself a magic link!
Finally, you can send the link through email like the first part of the problem!

Paypal integration with Braintree

I am trying to integrate braintree for payments in Nodejs and Javascript.
I have created an account on https://sandbox.braintreegateway.com and now I am trying to integrate my braintree payment with my website using "drop in" integration, I followed all the steps given on site, with which I get a paypal button, which on click opens up a paypal pop up window in which I enter my account details, After which it asks to agree on various terms. After clicking Agree it says :
"Sorry we cannot connect to PayPal. Please try again in a few minutes. Try Again"
I am not sure why I am getting this.
Looks like a problem of setting up my profile of Paypal with Braintree (though in sandbox it doesn't really matters). I tried to follow set up of paypal with braintree as instructed on braintree portal, but with no success I am still at the same Error Message.
Code used is from following Braintree documentation:
https://developers.braintreepayments.com/javascript+node/guides/drop-in#paypal
Please help me out with this.
I was able to contact braintrees support and they configured my sandbox account.
This is what they said:
Hey Johhan,
Thanks for reaching out to Braintree support. I’d be happy to help.
I took a look at your Sandbox account and it looks like you weren’t
set up with a processor connection to test out PayPal. This can happen
sometimes when Sandbox accounts are created outside of the United
States.
We have corrected this setting and your Sandbox is now set up to
process PayPal. You can verify that PayPal is a valid payment method
in your Sandbox by logging into your Sandbox Control Panel and
clicking on Settings > Processing. You’ll see a list of accepted
payment methods next to your Merchant Account.
Hope that helps! Let us know if there’s anything else we can do for
you.
Best,
Basically, you have to verify that PayPal is a valid payment method in your sandbox account.
I contact their support team. this was their response
"I believe you’re running into this issue because your sandbox was created in Pakistan, which is not a supported country with PayPal. If you are a developer working for a US based merchant on an integration, you will need to signup for a US sandbox account. You can do this on our website by selecting United States as your country using the drop down menu on the bottom left of the page"
Remember: bottom left of signup page >> Select Country as US
i signed up for another sandbox account on Braintree using US as my country and it worked perfectly.

How to read data from a private google spreadsheet in javascript -- Nov 2014?

I would like to use a google spreadsheet as a simple read-only data source for a prototype. I want to make an ajax request of some kind for the data and then play with it within a web page. I see lots of conflicting blog posts, old documentation, etc, but nothing simple and definitive.
Ideally, I would be able to do this without making the sheet public, and without using any kind of auth within my page, just requiring that the user of my page be logged into an account with access to the sheet.
Can anyone point me to a simple tutorial or documentation that shows how to do this?
I wound up using tabletop.js. The tricky bit was setting permissions: I shared the document so anyone at my company could edit (view probably would work, too). I also selected File > Publish to web... and made sure that was enabled, but the "Require viewers to sign in with their [Company] account" checkbox was not checked.
I'm not actually sure what level of security I currently have; I suspect that it's less than I'd like.

Incorporate LinkedIn to a webpage

I'm trying to create a webpage that can incorporate LinkedIn info's (profile,people,company, etc...).
The things that it can/would do are the following:
When the user enters a name that is registered in LinkedIn, he gets the following
*Name, Company, Email
*List of LinkedIn messages that are waiting for reply
The same process goes on everytime the user adds a profile, I'm planning to use the Profile API of LinkedIn to get the Name, Company and Email but I can't find a working example to be my basis.
As for the 2nd one I still don't know how to get the LinkedIn messages.
Here's my Layout and expected result.
How can I achieved this? Opinions and Suggestions are highly appreciated tnx
This is far to broad a question for me to invest the necessary time in to figure the answers (multiple) for you, but do let me give you some hints. First of all, from my experience with the linkedin API not all the data you wish to access is available (do double check this though, I used the API quite awhile back and stuff might have changed in the meantime). As this data is not available through the API the only alternative would be to somehow bypass the cross domain policy, which in conclusion would require the user to install a chrome extension/firefox plugin which will function as a proxy for your application or even 'better', make you entire application a browser plugin based web app. Not that I am a fan of those whatsoever but if you application is meant in any way whatsoever as a linkedin (dedicated) plugin (probably as part of a greater service you're developing) then it might make most sense.
The whole system you are describing is very long winded and requires a large amount of development time. Alot of the data is not accessible directly or indirectly too. You cannot get email address's out from the API as a security feature (bots could just harvest emails for marketing campaigns).
First of all, you will need to make an application that allows for oAuth2 connections with the linkedin API service. People will log onto your website, click to join their linkedin account with your website and your website will receive back an access token to do the calls.
You will then need to build the queries which will access the data you require. The linkedin API documentation (http://developer.linkedin.com/) isn't greatly indepth but it gives you a good understand and points you where you need to go. There are also a couple of pre-done php API's around such as https://code.google.com/p/simple-linkedinphp/.
I have worked with many API's from twitters, facebooks and LinkedIn's and they all require a lot of back-end work to make sure that they are secure and get the correct data.
It would take me hours to go through exactly how to do it and has taken me many hours to get a solid implementation in place and working with all the different calls available.
If you have minimal coding knowledge, it would be best to go to an external company with a large amount of resources and knowledge in the field who can do it for you. Otherwise it may take many months to get a working prototype.

Categories