PayPal Rest API Update transactions - paypal

I am using the PayPal Rest API to implement PayPal into my website. The flow for my site is below.
Users selects PayPal to pay
Create payment in code
Send to PayPal to approve
Sent back to Step 2 of my order process
User can update the shipping method or apply a coupon code
User Submits the order
As you can see the amount and details of my order can be changed after I create the initial payment in Step 2 of my process. Also a user could update items/amounts on their order as well.
How do I update the transactions of a payment after it gets approved?

you should use Payment authorization:
PayPal Authorization & Capture is a settlement solution that provides increased flexibility in obtaining payments from buyers. During a traditional sale at PayPal, the authorization and capture action is completed simultaneously. PayPal Authorization & Capture separates the authorization of payment from the capture of the authorized payment.
Authorization & Capture is for merchants who have a delayed order fulfillment process and who typically make a $1 USD authorization at checkout. It enables merchants to modify the original authorization amount due to order changes (such as taxes, shipping, or item availability) that occur after the buyers place the initial order. This chapter discusses the authorization and capture process and provides steps to help you authorize, capture, reauthorize, and void funds.
Paypal doc
you need to impelemnt instant update callback:
Here is how the Instant Update API works
When a buyer logs in to PayPal, the PayPal server calls your callback server with the buyer's default shipping address, which is stored in the PayPal system.
Your callback server responds with the shipping options available for that address, along with any insurance options and tax adjustments on the order.
PayPal displays this information in the cart review area so buyers can choose from the options.
The buyer's final choices are returned in the GetExpressCheckoutDetails response.
https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECInstantUpdateAPI/
hope this helps you

Related

How can I prevent merchants from capturing pending Paypal authorizations?

We're running a marketplace with merchants that sell services to customers. Payments go directly from the customer to the merchant, and our server facilitates this, through the Authorize & Capture mechanism in Paypal Express Checkout.
In checkout, when the customer's Paypal is authenticated an authorization is created, and at the end of the interaction with the merchant the payment is captured by our server on behalf of the merchant.
There is, however, a back door enabling the merchant to intervene directly on Paypal and to capture the funds in the pending authorization before the order is completely delivered. We'd like to prevent that, or at least insert a notice somewhere in the merchant's Paypal account not to capture the payment, and to instead let our server do that for them when the order is delivered. Any ideas?
Normally, you can't do that. But you can read IPN Paypal message to know if transaction are effectives. Take a look to Paypal IPN Guide, retrieve informations and compare to your informations database transaction to check if all is right.

Can i use pre-approval using PayPal website payments pro?

I am making a system in which user permits pre-approval of amount. I've used pre-approval with chained payment. But the problem is that my customer gets redirected to PayPal site and also he/she must have a PayPal account or need to create one. So can i make pre-approval payment using PayPal website payment pro? So my customers will not get redirected to PayPal account. And the process becomes more fast? Note :- I don't want to use authorization and capture method. Thanks.
Edit
One more question :- If i make the website in the UK and the currency in GBP, can I still use the American Paypal account for this?
Auth and Capture is what you're asking for, but then you say you don't want it..?? That's what gives you the functionality you're after, though.
You could do a $0 auth and then run DoReferenceTransaction when you're ready to process the payment as opposed to capturing an actual auth if you want.
Those are your only options when working with Pro, though, and it would give you the same sort of preapproval experience for the buyer.
Here are the steps to accomplish what you're after.
Use DoDirectPayment to run a $0 Authorization (card verification). Users will enter their credit card details directly into a form on your site without any redirection to PayPal (and without any knowledge PayPal is being used at all unless you notify them some way.)
Save the transaction ID that you get form this card verification into your transaction history for the customer in your database. This ID is what will be used to process future payments using that credit card.
When you're ready to process a payment for this customer, pull the ID out of the database and use it with a DoReferenceTransaction request to process any amount you need to.
So the card verification is your preapproval, and then running reference transactions are the same as running Pay requests with a Preapproval key. Both methods accomplish the same thing, but one is with direct credit cards and the other is not.
If you're using PHP you can use this PayPal PHP SDK to make all of the API calls very quick and easy for you. If you're using some other language then there are SDKs available for those as well I'm sure.
Please correct me if i am wrong, #Andrew Angell #Ved Pandya
Auth and Capture or Capture payments later method allows you to do direct payment, but it comes with additional charges, which might not suitable for crowdfunding model as refund/ cancel payment is very frequent
Auth and Capture: You are required to pay $0.30 for each "Card Verification Transactions"
Capture payments later: You are required to pay $0.30 for each "Uncaptured Authorization" that you triggered
https://www.paypal.com/us/webapps/mpp/merchant-fees

PP REST API charge tax and shipping without sending address?

Using the REST API, how can I charge tax or shipping if I send the user to PayPal to collect shipping information (and pay, of course)?
Doing some research it almost seems like that isn't possible, but I can't imagine that being the case. If I have to collect shipping information myself, the value prop for using PP is greatly reduced.
With the REST API, just like the Classic API, a PayPal payment is executed in three steps:
1) Send initial information to PayPal to get a token. Redirect customer to PayPal. Customer authorizes payment.
2) Get payment details (like the shipping address)
3) Confirm payment.
So, in this case, after getting the shipping address, you display an order review page to the customer where it will generate the shipping options and tax amount to the customer. They then have to select a "Confirm Order" button which will then finalize the charge to PayPal with the new tax/shipping and final amount.
In API terms, the final step is done with the /execute command. This accepts the payer_id you received in step 2, and a transactions array that supports a new amount object.
The amount object includes a details object that includes shipping, tax, handling fee, insurance, etc.
Include the details the customer decides on your review page and PayPal will charge the updated amount to the customer's funding source of choice.

Paypal Subscription Details

Can you help me. I need to know if PayPal has an API call to get subscription details like the enddate of the subscription?
I do the request to PayPal and get the response,
SUCCESS
transaction_subject=Name20
payment_date=10%3A42%3A50+Mar+28%2C+2014+PDT
txn_type=subscr_payment
subscr_id=I-MWMMATTBSY2M
last_name=jls
....
but I need details from suscription as enddate.
Sounds like you're using Standard Subscriptions and the "response" you're referring to would be an Instant Payment Notification (IPN)..??
Unfortunately, the standard subscriptions system doesn't have any API's to access details directly. You could switch to Express Checkout and the Recurring Payments API, though, and this would give you access to API's to obtain details and manage the profiles programatically.
If you're working with PHP you can setup Express Checkout and Recurring Payments very easily using my class library for PayPal.
The flow you'll be setting up would be as follows...
1) Call SetExpressCheckout to obtain a token and redirect the user to PayPal. The SEC request will also include a ReturnURL which is where PayPal sends the user after they've signed in and agreed to continue. You also need to make sure to include the Billing Agreement parameters in your SEC request so that the token you get will be compatible with recurring payments.
2) The user ends up back at your ReturnURL, and this is where you'll call GetExpressCheckoutDetails to obtain details about the buyer that the system now knows since they've signed in. This gives you info like the payer's name, email, address, etc. It also gives you the Payer ID you'll need for the final request.
3) Right after obtaining the details via GECD you'll call CreateRecurringPaymentsProfile to finalize the subscription profile creation.

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.