How to make a request for sandbox paypal using jQuery? - ajax

https://www.paypalobjects.com/en_US/ebook/PP_Sandbox_UserGuide/testing_ec_with_nvp.html
I created paypal sandbox account both buyer and seller. In seller account i created one buy button then i include in my application. the NVP is working fine and give's ack but How to call the webservice in $.ajax. How to set the header and how to pass as JSOn? thanks in advance

You can't use the PayPal API's through jQuery. This sort of thing must be processed server-side.

Related

Paypal rest api get order details for an order palced with nvp api

I have a Magento2 shop with default checkout module that is placing orders using nvp api. I need to later get the order from paypal and do some action based on its status but from the rest api (
/v2/checkout/orders/{id}) i only get results for orders created with the same rest api, not the ones that are placed during checkout (with nvp api).
I have configured a sandbox account on paypal and the business account that is used for nvp api calls have access to the app created in paypal for rest.
Is this mix of api calls allowed at paypal? Or it might be a problem with the paypal sandbox configuration?
Thanks
You wouldn't use the v2/orders API for this, as orders are only used for creating transactions, not referencing them after the fact.
For later referencing completed transactions you would use the v2/payments API, particularly a 'get' for a completed capture. Here is the documentation.
Whether this works for transactions made with the NVP API is not something I've tested; if not, you would need the NVP GetTransactionDetails.

PayPal integration in Laravel site

I need to implement PayPal payment in my Laravel site. I was going for the server side integration, in order to save all the data, transactions and know what they actually bought. But turns out that [the older] server-side integration method [that I was looking at] is archived, and not really the preferred method anymore. Instead, they suggest using the smart buttons, with front end integration only.
Questions:
Is front end only safe? what prevents the user from messing with the JavaScript and editing the sum with whatever they want?
How do I know what they ordered if it is all front end?
What would I have to do if the payed sum does not correspond to the articles in the cart?
What should I be aware of with this system?
Smart Payment Buttons can be used with or without a server-side component.
Here is the front-end pattern that communicates with a server-side integration: https://developer.paypal.com/demo/checkout/#/pattern/server
Notice the fetches to two '/demo/...' placeholder endpoints, which need to be replaced with actual routes of yours. The first should create a v2/order via API and return the orderID. The second should capture that order after the payer approves it via Smart Payment Buttons.
The answers to your questions re: a serverless (client-side only) pattern are:
Nothing
Only what you program the JavaScript to tell you and which it actually successfully tells you, or what you read via email or in your PayPal account or app notifications
Refund the transaction
It's for people who don't want to do the work of implementing server-side routes and API calls.

Google Analytics Issue for Magento to PayPal

So, having discovered that customers are not returning to our website after making their PayPal payments, our Google Analytics reports are wonky as the landing page (success.phtml) which generates the order completion history/goal is never achieved.
Is there a PayPal APi callback to Magento which can generate the correct Google Analytics data? Is there a way to generate GA code at the PayPal end?
Any pointers appreciated!
Thanks, Joe.
a better question for you is why are your customers not reaching the success.phtml?
Go to Website Payments under Profile on the PayPal website. Setup your return URL and enter the succes url there...
If your customers don't return because they close their browser before returning to the shop:
You could remove the script from success.phtml and add a serverside-call to GA using something like serversidegoogleanalytics but you'll have to implement this for all paymentmethods you are accepting... This serversidecall would be done in the success-action within the controller of the paypal module

Hiding paypal button from Braintree's dropin ui

Is it possible to hide paypal button from braintree dropin UI ? I am thinking to have custom paypal button for paypal (based on client demand and design) and would like to use interface provided by braintree dropin for credit card payment processing.I am using PHP and javascript.
Thanks.
I work at Braintree. If you have more detailed questions, please get in touch with our support team.
In the current major version of the drop-in, showing the PayPal button is a configurable option.
In previous versions, f you're using Braintree for your PayPal integration, and you're using the drop-in UI, the PayPal button will show up. If you don't want the PayPal button to show up because you don't want to use PayPal through your Braintree integration, and you haven't yet updated to the current version, email support#braintreepayments.com and they'll disable it for you.
Apparently this is possible since in v2.15.0 they added a headless option.
Example code: https://gist.github.com/danielwu426/70eac6b34ab7491610f0
If you remove below from Braintree's Javascript code (from braintree.dropin.create function) It will remove PayPal button from Drop-in UI.
paypal: {
flow: 'vault'
}
Whatever clienttoken is being provided in the braintree , just provide some invalid or null value to it , it will then show
You can use disablePayPal() method in latest version of BrainTree.
DropInRequest dropInRequest = new DropInRequest().clientToken(token).amount(amount);
dropInRequest.collectDeviceData(true);
dropInRequest.vaultManager(true);
dropInRequest.disablePayPal(); <-- this will disable Paypal Button
startActivityForResult(dropInRequest.getIntent(_context), CARD_REQUEST_CODE);

codeigniter paypal url

I have downloaded the codeigniter paypal lib. I have few questions regarding this library.
My paypal url is set to this, $this->paypal_url = 'https://www.paypal.com/cgi-bin/webscr', Is it for testing!? How can I change it for actual transactions?!
My return url is set to a success controller, but I am not able to view the post information returned by paypal. Could anyone tell, what exactly is the problem?!
I want to store the transaction details (Amount paid,paid by whom, on what date and for which product), How exactly I can achieve this?
thanks
A lot of my answers relate to the Adaptive Payments API, so apologies if it doesn't correspond 1:1 but hopefully it will point you in the right direction.
The URL you're pointing to is the live site I believe, if you want to run api calls against the sandbox the proper URL is https://www.sandbox.paypal.com/cgi-bin/webscr
The return URL is the page that Paypal redirects to after a transaction or cancel. There is no POST request associated with this, however..you can pass parameters into the URL (such as http://mysite.com/succes.php?amount=xxx) so that you can retrieve them later. This is a rather inconsistent way of doing things, though. Which leads to...
Look up the IPN documentation on Paypal (starting point: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro) This allows you to specify a URL which Paypal will POST the transaction details to after a transaction request.
Before you can store these details you need to do send back a request to Paypal to validate that the IPN was generated from Paypal (this is in the docs). After that you can store the details into your database.

Resources