0
votes

I dont get the idea. If Classic api have DoExpressCheckout methods... what Rest API have for it? On that image we have the way how it should work for classic way enter image description here

So for my case Express Checkout steps are: 1) Customer put items in cart and click on PayPal checkout button I run

var payment = new PayPal.Api.Payment();
var createdPayment = payment.Create(apiContext);

so make the payment and redirect customer to paypal site

2) Customer go thu the paypal process and return back to my site. From his pay pal transaction I should get Shipment address and his email (without submit that payment!) and based on his shipment address calculate shipment cost

3) After customer select shipment method I need update his transaction (add shipment cost) and only then sumbit it.

So the questions here

1) how to get payment (transaction) info with C# lib based on paymentId (like PAY-21A17783AU475540MKYGAM5Q) because PayPal.Api.Payment() have methods only Creare, Execute and Update?

2) How to Update current transaction (add some new data like shipment cost) and then submit it?

PS. In the documents a lot of mess and a lot of people dont understand how they should use that api properly.

Duke

1

1 Answers

1
votes

Based on your post, you'd create an Order - strongly suggest you use their library in this link (it includes samples, should get you going quickly, is very well maintained, and the maintainers are great/responsive)

  1. Create it - this would map to classic SetExpressCheckout

  2. Redirect to Paypal to obtain user approval. The redirect URL is part of the response (no longer just a token)

  3. if the user "approves", Paypal redirects back just like in classic

    • you'll see this handled in the sample in the else block
    • just like in classic PayerID is in the querystring
  4. Execute the payment

    • the response will contain the data you need as you will see in the lines below the execute statement, so this maps to GetExpressCheckoutDetails
    • you will also see your options on what to do next (Auth, Capture, etc.) in the commented lines. These would map to "finalizing" the payment
    • you can "adjust" for shipping/tax in the above after obtaining the details and will have same rules as classic IINM as far as the maximum additional amount you can add - 115% not to exceed $75)

If you have a sandbox account, I have a debug page here that shows the data io that maybe helpful.

Note that I'm only partially capturing ("is_final_capture": false) so if you check your sandbox (buyer) account, the total charged wouldn't be the full amount

Hth..