Paypal integration with Braintree - javascript

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.

Related

Azure AD B2C separating Sign Up from Sign In

Frustrated!
I've can get Sign In and Sign Up to work with UI customizations and API connector integrated to a JavaScript SPA, using the latest Microsoft Authentication Library for JavaScript (MSAL.js) 2.0 for Browser-Based Single-Page Applications, version 2.28.1 and OAuth 2.0 Authorization code flow (with PKCE).
Sign In works.
Sign In, then click "Don't have an account? Sign up now" and Sign Up works.
What I can't do, is get directly to Sign Up to work. I'm utilizing User Flow, and soo close to getting past this hurdle and finishing up with the migration.
When I pass in prompt="create" to the loginRequest, I get is "create" is not an allowed option, but it's in the MSAL documentation in one place, but in another it states that only "login" is allowed. Bu there's GOT to be a way to load the Sign Up page first and NOT have to go through the Sign In page.
https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_browser.html#popuprequest
e.g. error returned: error=invalid_request&error_description=AADB2C90043%3a+The+prompt+included+in+the+request+contains+invalid+values.+Expected+%27none%27%2c+%27login%27%2c+%27consent%27+or+%27select_account%27.
Other docs I found state I have to Enable guest self-service sign up via user flows... When I go to the AAD B2C tenant, this screen doesn't look like the one that is available, so the docs are old because everything changes so often:
https://learn.microsoft.com/en-us/azure/active-directory/external-identities/self-service-sign-up-user-flow
I tried doing another route, and setup a Sign Up only user flow. When it returns back to my app, it returns nothing. The User is created, but NOT signed in. There's pre-request values stored in the sessionStorage. But nothing to tell me if it worked or failed, just nothing. But, if the user clicks on Login, then it auto logs them in and then bounces back and the user is fully logged in.
And there was this:
https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/FAQ.md#how-do-i-implement-self-service-sign-up which at the end states "Please note that that self-service sign-up is not available in B2C and test environments." What?!? So is what I am trying to do NOT supported? Makes no sense why not. What's the point of offering B2C if a user can't Sign Up????
Any help is greatly appreciated, thank you!
Rob Bramhall

How could I get payments via google pay

I need a payment solution for my chatting app. Since I checked all the documentation of the google there is no sign solves my problem.
As I understand google only doing tokenization for credit cards. I think I need A payment gateway for that. But I couldn't understand what is DIRECT means.
However, on google, as I can see where you can create products in console, so why should I put products and prices in code lines?
What is difference between the gateway and direct?
Thanx for all!
Google Pay does not process payments. You need to either refer to one of the supported payment gateways in the configuration, or go for DIRECT if you are processing payments yourself on your own servers.

linking 3rd party payees to paypal

I am trying to create a website that will allow people to post items for sale and then receive a payment through paypal once the item is purchased. Ideally I would have them link their paypal account to my website, before they post any items, and user would checkout via paypal. This would be a very similar setup to what ebay has with paypal. Can someone point me to what type of integration this is? Also could someone point me to the proper docs? I don't think i'm using the correct terminology so I'm not finding anything. I am a developer so i'm not afraid to code this up. Thanks
If you want to create this kind of integration you will need to make a few user experience decisions first. The flow of Ebay allows a person to link a payment method to their system and upon purchase directs them to an Ebay paypal checkout page that acts as a payment using stored credentials to do a transaction with the Ebay paypal account. Internally Ebay then performs other transactions from their account with other user's registered payment information to mediate the exchange. It is not directly user-to-user. The first question you as a developer need to answer is : Do you want to use the pre-built paypal experience or design your own with paypal integration?
The simplest pre-built experience causes your users to be directed away from your website to paypal where they handle their transactions and then are returned to your site along with a REST payload that informs your site whether a transaction was successful or not.
Another service offered by paypal is called Paypal Payment Advance which allows them to provide you with a template integration on your website which performs the transactions on your domain. To learn more about that, see here.
The custom experience requires you to learn the Paypal developer API and how Paypal operates and stores credentials which can be found here. This option is only if you really want to have complete control of everything and are willing to put in the work. It is also the most difficult option, but gives you the greatest control over the end experience.

Paypal won't send sandbox transaction data to IPN

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

Regarding PayPal Pro payment

Well I have a website for which I have implemented PayPal Pro's dodirectpayment (For accepting payment using credit/debit card)
Now I want to move my code live but under account eligibility there is a message saying:
"Direct credit card processing is not available for you when using REST APIs. Your live credentials are inoperable for direct credit card processing for your country but your test credentials are enabled for sandbox testing."
I have an Australian PayPal account. I also read some PayPal documentation saying PayPal Pro is only available for UK and Canada. Can someone suggest the alternate of this or how to resolve this problem?
PayPal offers several hosted solutions in Australia. If you require direct credit card processing read about Payflow. The Payflow Gateway SDKs should help you get started. Also, you can find php SDK and code samples here.

Categories