Silent payment using paypal without redirecting to paypal url - paypal-sandbox

Is there a way I can pass the sellers credentials to the Paypal API and it can make a transaction without taking him to Paypal URL?
TL. DR.
I am trying to build an eCommerce website for a shop with Paypal as the payment medium. The payment for user has been implemented where he is redirected to the Paypal website and he can purchase an item. But under certain conditions he is allowed to cancel his purchase and his payment must be credited back to him.
I need this transaction to happen without navigating to the Paypal URL.The reason is that, the buyer is the one initiating the transaction. So there is no way he can authorize a transfer from sellers to buyers account. The buyer should be able to press the "Cancel Order" button and the payment should be immediately credited back to his paypal account.
I can store the sellers credentials in the server and send it to the API which should be able to authorize him but I was looking for an API which Paypal provides to make this happen.
My requirement is different from the anser provided in this question as here they still show a popup of paypal webpage.

Related

Paypal with option useraction=commit not creating transaction

i installed ezsystems/payment-paypal-bundle on ibexa commerce as a payment provider with all config and useraction=commit. so the Customer logs in from Paypal and clicks on the Pay Now button. Paypal gives no error, everything seems to be successful and customer is redirected at the RETURNURL, but no transaction is created in the buyer or in the seller account.
You are expected to show a review page on return, and run DoExpressCheckoutPayment (or equivalent) after the payer confirms the payment on your site. Setting useraction=commit will change the verbiage of the last button to say "Pay Now" instead of "Continue", indicating to the user that you are going to capture immediately (skipping the default review step) but this is only a wording change -- you still need to do a DoExpressCheckoutPayment (or newer API order capture/execution) to get a success orfailure response, and show the result.
It's worth noting that SetExpressCheckout / DoExpressCheckout payment are very old APIs....
The current v2/checkout/orders REST API does have similar capabilities if doing a redirect integration, but such redirecting is an old flow/ Keeping your site loaded and using JS for the approval instead of a redirect is always recommended nowadays (works with both current and old APIs).

Testing PayPal Donations with a Sandbox Account

I have a WordPress form that processes data and redirects to this url to complete the PayPal donation
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount= <amount>&return=http://example.local/about
However, when I submit the form I receive this error from PayPal
We can't complete your donation. This organization's account is inactive.
What am I missing? The reason I have it setup this way is because I want WordPress to save the form data and send a thank you/confirmation email after the payment is complete.
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount=&return=http://example.local/about
When testing with any sandbox account, change the domain to point to the www.sandbox.paypal.com sandbox environment , i.e.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_donations&business=sb-5mepe4127835%40business.example.com&currency_code=USD&amount=&return=http://example.local/about

Waiting for Paypal Payment Notification ASP.NET

I am implementing an ASP.NET web app where the user will fill an application that spans over multiple steps/Pages, with previous/Next buttons on each page to navigate back and forth to each step.
On the second step/page, I have a paypal payment button, so the user can pay for the services they selected on the first page.
My requirements is to wait for the user to pay with paypal and get the notification that a payment was received then navigate to the next page automatically. The user should not be able to proceed without payment.
The paypal payment button opens a new window with paypal site where the user makes the payment.
I looked at Paypal IPN (Instant Payment Notification), Paypal can send the notification to a service on the back-end in the web app, but how can I forward the user to the next page once this notification is received, since this service is not tied directly to the page that the user has opened on his browser?
The one way I am thinking to do is to store the payment in some table with the userid and a unique code and have a javascript function with setInterval(checkPayment, 5000); so every 5 seconds, it calls a service to check if there was a payment and forward the user.
Is there any better solution ?
Better solution is to NOT involve IPN in your checkout flow. As stated:
Because IPN is not a real-time service, your checkout flow should not wait for the IPN message before it is allowed to complete.
REF: https://developer.paypal.com/docs/classic/products/instant-payment-notification/
Paypal has an extensive API that handles your flow - e.g
Express Checkout
REST

PayPal asynchronous notification

Now information about the successful transaction I get with a redirect the user back to my site from paypal. And then I make additional requests to api paypal.
But if the user cancels the redirect to my site, for some reason, I do not get the information about the transaction.
Is there an asynchronous notification from Paypal for Website Payments Standard or Express Checkout?
Instant Payment Notification (IPN) works for all payment methods through PayPal. The Developer.PayPal.com document you linked is a list of variables for the Express Checkout feature and it is telling you that you can only pass the NOTIFYURL variable successfully in the DoExpressCheckoutPayment API call.
In Payments Standard transactions you'll use the notify_url variable.
You can also just enable IPN within your account to have an IPN post sent to your notification page when any payment completes - regardless of whether or not you define a URL in the button code or API request (the URL you define in the code will always override what is set in your account).

PayPal API, account verification

Use-case
I am implementing a trading application
I am using PayPal API for express checkout
Subscribers should be able to sell & buy using PayPal account
Subscriber should associate his Trading application account with his PayPal account using the e-mail address registered with PayPal
Problem
Using PayPal API, Is it possible to verify that the PayPal account e-mail address provided is registered with PayPal? ( sending an e-mail activation link will not help here )
Any help will be appreciated
Try using the Paypal AddressVerify API: https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/AddressVerify_API_Operation_NVP/
AddressVerify can also check that your user's address and ZIP/postal code are correct.
AddressVerify API isn't provided by Paypal on default. I think you have to talk to customer support to give you access to it, and then contact them again for approval to have it on your site.

Resources