Add shipping cost after user authorizes PayPal payment - paypal

I'm using PayPal Checkout, which isn't well-documented but doesn't support automatically adding shipping costs in the account dashboard as far as I can tell. I need to charge users different amounts for shipping depending on their location, which I don't receive from PayPal until the user authorizes a payment. Without re-authorizing, how can I charge an additional fee for shipping? I saw this behavior implemented on this site recently while making a purchase – I authorized a payment using what appears to be PayPal Checkout, after which I was able to select a shipping method (some of which cost up to $30 extra) and it seemed I was able to complete my payment without reauthorizing.
I haven't found anything in the PayPal Checkout documentation or by inspecting the object passed into onAuthorize that seems to expose this functionality. I did find a PATCH /payments/payment/{id} endpoint in the docs for the Payments API, but I have no idea how to access this from the PayPal Checkout flow on my website, nor whether my site is considered a "Third Party Provider in the context of PSD2 regulation."
How can I add a shipping cost to a payment after authorization using PayPal Checkout?

You can find more required info here :https://developer.paypal.com/docs/checkout/integration-features/shipping-callback
paypal.Buttons({
onShippingChange: function(data, actions) {
console(data);
}
}).render('#paypal-button-container');

Related

Paypal checkout for marketplace where buyer pays seller directly

I am running a marketplace for video games. When a buyer buys an item they can directly pay the seller through Paypal by setting the 'business' variable to the Paypal account of the seller in the link that will send the buyer over to Paypal to complete the purchase.
While this works most of the times, there are downsides to this approach as the website fully depends on receiving the IPN of the transaction. In very rare cases, Paypal fails to send the IPN (server logs show that there was no such request to the listener script – even hours later).
Is there a way to integrate a direct payment from buyer to seller where the website immediately gets feedback that the purchase has been completed (via JS-API or similar), so the website does not only depend on the IPNs?
I have seen a few similar questions on StackOverflow, but the solutions mentioned in answers have been deprecated as far as I can see (Adaptive Payments are no longer supported for new projects).
Integrate PayPal checkout with a server-side pattern. Here is the front-end UI: https://developer.paypal.com/demo/checkout/#/pattern/server , which will call two routes on your server.
Those routes will in turn call the PayPal API to 'Set Up Transaction and 'Capture Transaction', respectively: https://developer.paypal.com/docs/checkout/reference/server-integration/
The above has no dependency on asynchronous IPN or webhooks.
Since the buyer will be paying the seller and not your account, you can use the custom 'payee' object to specify this: https://developer.paypal.com/docs/checkout/integration-features/custom-payee/

using paypal express checkout API to handle payments for third parties?

i am creating a small marketplace where sellers can sell their products and receive payments to their PayPal account directly from the buyer.
i've previously been using "website payments standard" but am looking to switch to the express checkout API to generate a one-time payment token each time someone purchases something and which then allows buyer#email.com to send a payment directly to seller#email.com without the involvement of my PayPal account.
is that possible?
i've only found one option in the documentation at https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/ called "PAYMENTREQUEST_n_SELLERPAYPALACCOUNTID", but is that the correct way to send the entire payment from the buyer to the seller without any amount going to me?
also, do i NEED to have my own "USER" and "PWD" to generate an API token each time if I am receiving no payment mysefl?
Think you are looking for Adaptive payments.
Adaptive payments handles payments between a sender of a payment and one or more receivers of the payment. You are an application owner, such as a merchant that owns a website, the owner of a widget on a social networking site, the provider of a payment application on mobile phones, and so on. Your application is the caller of Adaptive Payments API operations.
So, in general if you want to act as API caller and to felicitate the money transfer between buyer and seller, Adaptive payment is the way to go.
Steps to go live with Adaptive Payments

PayPal Payment Methods

I hope that someone can shed some light on this.
We have developed with PayPal using Website Payments Standard, Website Payments Pro (DoDirectpayment).
There are several other methods like Advanced Checkout, Express Checkout, Payflow Pro, etc. What does each one do? Is there some place where one can see all of these and the differences between them?
To give you a quick and brief overview of some of the main differences.
Website Payments Standard - Uses HTML buttons buttons that you generate from your PayPal account, or you can use a 3rd party cart, or build your own. The buyer is basically redirected to the PayPal payment pages, to enter in their information. You have some control over the checkout flow but are limited in what you can control. There is no monthly fee for this services. The buyer is on the PayPal site when they complete the payment.
Website Payments Pro - There is a monthly fee for this service. With this service, you have full control over the checkout flow. The buyer stays on your site when they enter in their billing information. Instead of using HTML and redirecting the buyer over to PayPal, you will be using API calls to send the data over to PayPal and get a response back.
Express Checkout - This is usually used in conjunction with Pro or by itself. This allows the buyer to checkout with PayPal instead of using their credit card directly on your site. The buyer is redirected over to the PayPal site to sign in or to pay with a credit card. No billing information is entered in on your site. This method uses API call similar to Pro, and allows for some control over the checkout flow. You will have more control with this than you would with Website Payments Standard. The buyer will be back on your site when they actually complete the payment. There is no monthly charge for this service.
Payflow Pro - This is similar to Website Payments Pro. There is a monthly service charge for this service. You can either use the API's and keep the buyer on your site where they enter in all of the information and complete the payment. Otherwise you could also use the hosted checkout pages and have the buyer enter in their billing information on PayPal's pages allowing you to be PCI compliant. Also with Payflow, you can use your own processor as long as it is one that is compatible with Payflow. So don't have to use PayPal as your processor if you choose not to.
Hope this helps.

How to check Payment failure for Paypal Express Checkout

We are using Paypal recurring billing service (using Express Checkout) at our website for monthly subscription.
Since we have an Australian account so we are not able use the DPRP (Direct Payment Recurring Payment) service offered by Paypal because it seems, DPRP service is limited
to only few countries (US, UK and Canada).
In Express checkout payment details are received at Paypal Website. So we do not have any information, whether the payment failed, user pressed the Back button in browser or He/She intentionally clicked the cancel payment.
After speaking to Paypal support team we get know that there could be multiple possible reason for Payment failure, and seller has to contact Paypal by themself. So we can
not provide any troubleshooting for that at our website.
So we want to know, Is there any possible solution to avoid this or atleast can we diffrentiate between the user for whom payment failed and who intentionally moved to
our website back without doing payment because this way we are not only unable to followup with them but also loosing a part of the customer base, interested in our service.
Any help in this is Appreciated.
Thanks
You should implement the Pay Pal IPN (Instant Payment Notification).
You configure the IPN url address on your PayPal merchant account settings. This page is simple HTML page with server-side programming that is listening for requests coming from PayPal.
There's no need to do something extra in the checkout process for making IPN work. Once you set this up, it will automatically work.
Every time something happens with a transaction in your merchant account, e.g. transaction completed/failed/canceled, PayPal will send an HTTP Post to your IPN listener URL.
Here you can get all the relevant information about the transaction, like the payer ID, the payment status. With this information you can decide what to do with your customer's order.

How to reset the shipping address paypal while checkout?

I'm integrating PayPal into my web application. Here I want to make complete checkout process.It has direct payment and express checkout.
In Express checkout we need only PayPal account like
1)Clicking Check out with PayPal
2) Logs into PayPal to authenticate
3)Reviews the transaction on PayPal
4)Confirms the order and pays from your site
5)Receives an order confirmation
In Direct checkout(A generic checkout flow),
1)Checks out from the shopping cart page
2)Provides shipping information
3)Chooses a payment option and provides
4)billing and payment information
5)Reviews the order and pays
6)Receives an order confirmation
This the flow. In Direct checkout when you choose payment option as PayPal(step 3) you need to login and make payment. Any way there is one default shipping address available in PayPal account and also you must give shipping address in step 2.
Now I want to send the complete cart details and shipping address to PayPal?
and I want make the direct checkout(A generic checkout flow) here? Can any one help me to do this?
Use Express Checkout and DoDirectPayment (Website Payments Pro). Express Checkout gives you the redirect-to-PayPal-and-login functionality, whereas DoDirectPayment allows you to take card payments directly on your site.
In addition, you can override the PayPal Profile shipping address of the buyer by specifying ADDROVERRIDE=1 in the SetExpressCheckout API call. Remember you'll need to pass in the appropriate shipping address details information as well.
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout