0

I am using a PaypalPayment Pro to make some direct payments with the paypal API in Java and I am using the DoDirectPayment class for this purpose. Now I am searching a way to cancel a payment but it seems that the API does not offer this possibility. I searched through the documentation but I did not see anything convincing. I saw the class DoVoid which may correspond to what I am searching but I am not totally sure. What is the current class / or method for cancelling a payment with the Paypal API?

Thanks for your suggestions !!

Dimitri
  • 8,122
  • 19
  • 71
  • 128

1 Answers1

2

It depends on what you mean by "cancel".

If you ran an authorization (e.g., if you set PaymentAction=Authorization in your DoDirectPayment call), the payment is on hold until you capture it, void it, or 29 days have passed. If you don't need the authorization, you can either let it expire on its own, or you can call DoVoid to void it. If you call DoVoid, set AuthorizationID to the transaction ID you received from the DoDirectPayment call.

If you ran a sale (e.g., if you set PaymentAction=Sale, or if you didn't set it at all), or if you captured the transaction (either through the PayPal account or by calling DoCapture), the payment has been completed. To "cancel" a completed transaction, you'll need to refund it. To do this, call RefundTransaction, and set TransactionID to the transaction ID you received from the DoDirectPayment call.

Matt Cole
  • 2,552
  • 1
  • 13
  • 21
  • So I have a related question for you, Matt, on the proper workflow. The transaction was started in my case via the subscription button, and then renewed once, and then the customer wants a refund. http://stackoverflow.com/q/43901069/105539 – Volomike May 10 '17 at 19:31
  • Responded on your original question. – Matt Cole May 11 '17 at 19:44