Can users repay transaction when the status of PaymentDetails is ERROR? - paypal

Users of my app can create and pay transaction via AdaptivePayments API.
In various cases the transactions ended up being in ERROR status (so the request for PaymentDetails says). What can be the cause of this?
And is the user then able to retry the payment of this transaction with the same paykey or is it necessary to create a completely new transaction?
Thanks.

The reason for the return of the "ERROR" status can be determined from when you originally submitted the API call. You would have received a failure notice with an error code and an actual error message.
You can't retry the payment, unfortunately. If the "ERROR" was caused by a decline the sender would need to update their funding source or address whatever caused the decline but you wouldn't be able to try and complete it again with the same paykey.

Related

We get paypal error 10423 with no clue what is wrong

We are a big webshop provider, and we have thousands of webshops in our system.
We have a case where we get an error in DoExpressCheckout with PaymentAction of Authorization here is the error
Ack: FAILURE
Build: 000000
Version: 117.0
Timestamp: 2017-04-06T08:54:36Z
CorrelationID: 4d6d16d1d30fa
ErrorCode: 10423
SeverityCode: ERROR
ShortMessage: Transaction refused because of an invalid argument. See additional error messages for details.
LongMessage: This transaction cannot be completed with PaymentAction of Authorization.
We have no clue what is wrong. Because it happens for specific paypal account of a specific customer.
We have two shops / one of a customer of us. Where we get the error. We made another shop in our system where we connected a paypal verified business account and then with another real personal account we bought an item from that shop and it all works. No errors.
We tried to the the same for this problematic customer and we get the error. We are sure that the code we use is the same in both cases and there is no difference in our handling. So the question is what could be wrong on the other paypal business account?
Could it be an SDK problem?
Did you even try to google it? I googled 'paypal 10423' and found:
Issue PayPal returned API error code 10423 - This transaction cannot be completed with PaymentAction of Authorization. Cause You set PaymentAction to "Sale" with SetExpressCheckout at the first API call.
Not sure if this article may help you:
https://www.paypal-knowledge.com/infocenter/index?page=content&expand=true&locale=en_US&id=FAQ1015
Apparently its because your setting the payment action to sale on a SetExpressCheckout then switching to Authorization. Paypal doesn't allow this and advises to set the PaymentAction to Authorization with the SetExpressCheckout then swap to Sale when setting the DoExpressCheckout call.
This is how we post the request to SetExpressCheckout:
SetExpressCheckoutRequestDetailsType req = new SetExpressCheckoutRequestDetailsType();
.....
PaymentDetailsType paymentDetails = new PaymentDetailsType();
paymentDetails.PaymentAction = PaymentActionCodeType.AUTHORIZATION;
paymentDetails.ShipToAddress = ....
req.PaymentDetails.Add(paymentDetails);
So we are 100% sure we use Authorize, and we do the same for DoCheckout, so it seems like PayPal is thinking we did Sale as PaymentAction why is that?

API errors out if I try to look up an order or payment that is completed. How can I get a definitive status of a payment?

I have the following flow with Paypal:
I create a payment with intent "order", and I redirect the user to Paypal's website.
Once the user returns, I execute the payment.
Then, I authorize the order.
At this point, I can still look up the payment or the order and I get expected result.
Finally, I capture the order.
After I capture the order, I can't lookup the payment with /v1/payments/payment/PAY-XYZ or retrieve the order with /v1/payments/orders/O-ABC. I get a 500 Internal Service Error.
Before you tell me to send debug id to Paypal because I stumbled upon their bug: I tried, but they are not responding. I had them on the phone, sent support requests, etc. I got no reply from them, so I have to turn to community.
After capture, I can still lookup a payment by listing payment resources. Since I store paypal's create time, I send a GET request that looks like:
/v1/payments/payment?start_time=2016-06-21T09:08:56Z&end_time=2016-06-21T09:08:58Z
Sure enough, I can get the payment object back, but that looks awfully hacky to me.
The reason why I need the entire payment object is because I need a definitive information about the status of the payment. E.g. I can stumble upon a network error when I send a capture request and I won't get capture ID, so I can't check what's going on. Or I can miss a webhook event (for any reason, e.g. bug in my code), and the payment can become refunded without me knowing, so it would be ver nice to be able to fetch a payment.
I noticed the REST API documentation here https://developer.paypal.com/docs/api/payments/#payment_get says that I should use that endpoint for incomplete payments, but I don't understand why I can't check the order, or why list payment resources works, but fetching a single payment doesn't.
Retrieving the payment used to work though, so I could look up related_resources of transactions of the response (like I can do now with listing all payments by date).
My question is: what is the recommended way to get the definitive information about a payment?
Also, if someone from Paypal is reading this, here are some debug_id's so you can perhaps look into it: 3ffa3007a7561 (result of https://api.sandbox.paypal.com/v1/payments/orders/O-3PA36862ST053572T) or 85576d66784cd (response from https://api.sandbox.paypal.com/v1/payments/payment/PAY-7N237030X85089344K5UQIKI)
This happens on both sandbox and live.
Thanks,
Dejan

Reject transaction after receiving IPN

Is it possible to reject / auto refund after receiving IPN message with COMPLETED status but the txn_id is duplicated or the price value is incorrect?
Or manual investigation need to be done to refund
If you are verifying your IPN calls with PayPal, this should (in theory) be impossible. PayPal never duplicates transaction IDs.
Is it possible to reject / auto refund after receiving IPN message with COMPLETED status but the txn_id is duplicated or the price value is incorrect?
You can't reject the transaction with IPN. You aren't in a transaction. You're getting notification that a transaction has already occurred.
You may be able to use another API to reverse the transaction, as suggested by #geewhiz.

How to test Failed/Denied transactions in paypal sandbox

I am performing tests in SANDBOX.
I am implementing Website Payment Standard on my website.
I have tested successfully Completed transactions (payment_status Completed) .
I need to test Failed and Denied transactions but I am not able to do it.
If there is a test card for Failed or Denied transactions in Sandbox, please provide.
I tried with an invalid credit card to create a Failed or Denied transaction and I got an error that appeared on the same page (I imagine that was a result of Javascript validation) but I did not receive any reply to my IPN listener on the server and there should have been a redirection to an URL specified in the HML form as URL for invalid operations.
I understand that a result of each transaction independently of its payment status should be received by my IPN listener. It receives Completed transactions so I imagine it should received Failed or Denied ones too.
I used IPN simulator (developer.paypal.com) to create Failed/Denied transactions and I did receive them with my IPN listener so I imagine it is not a problem with the listener. I just cannot create these transactions from my page directly.
Thanks and best regards,
Anna
You will have to enter error code at the place of amount https://developer.paypal.com/docs/classic/api/errorcodes/
When you will set error code number at the place of amount paypal detect what type of transaction it is.
profile = PAYPAL_EXPRESS_GATEWAY.recurring(10502, nil,
:description => plan.description,
:start_date => Time.now,
:period => 'Day',
:frequency => 1,
:auto_bill_outstanding => false,
:token => params[:token],
:max_failed_payments => 1
)
in above code I set 10502 at the place of payment and when you see the doc https://developer.paypal.com/docs/classic/api/errorcodes/
error code details are:
10502 Invalid Data This transaction cannot be processed. Please use a valid credit card. The credit card used is expired. Recurring Payments
and you will get APN with failed transction.
I hope this will help you

Paypal API doesn't send info when transaction is canceled

is there a way to detect canceled transactions?
My API is working fine, but someone is cheating somehow, transaction pass verification and API get the info and credits are added to account, but after 30-45 sec transaction is canceled and I see only this message
"The payment was cancelled and the money was returned to the sender's account."
Thank you.
That's what IPN is for. If a payment status changes, you get a notice sent to you when it happens.