PayPal Sandbox Negative Testing of PartialSuccess - paypal

Does the PayPal Sandbox API Negative Testing allow you to produce a "PartialSuccess" result?
I am attempting to reproduce in the PayPal Sandbox a situation in production that is causing problems. The situation is that we have orders with items from multiple sellers, which results in multiple payments. Sometimes when we call DoExpressCheckoutPayment some of those payments fail (generally with error code 13113), while others succeed. The Ack from DoExpressCheckoutPayment == "PartialSuccess" in this case.
It appears there are problems in our logic to deal with this situation. Therefore, I want to troubleshoot this in the sandbox, and I have turned on Negative Testing.
However, the Sandbox is not behaving as expected. If I create an order with two items from different sellers, the first item seems to control the whole transaction.
If item #1 has a price which corresponds to an error code (e.g. $131.13), then the transaction comes back as Ack == "Failure" even if item #2 does not cause any error.
If I switch the order of the items, so the non-error item is #1 and the error item is #2, the whole transaction goes through with Ack == "Success" with no error triggered at all.
I can't find any documentation about the combination of Negative Testing and PartialSuccess. Am I doing something wrong, or does PayPal Sandbox just not support testing this situation?

Related

Paypal - CHECKOUT.ORDER.APPROVED but no PAYMENT.CAPTURE.COMPLETED

I'm using Paypal Orders API (v2) on a website and multiple times there has been an approved order that are missing captures complete.
I get this event for all orders:
CHECKOUT.ORDER.APPROVED
But for some orders, this event does not occur:
PAYMENT.CAPTURE.COMPLETED
How does this happen, is it because a customers credit card got declined?
Make sure the actions.order.capture() function is being called properly.
I had the issue where I wanted my server to validate the payment was successful. So, I replaced the onApprove function, with a call to my server. When my server requested the order, it always said it was APPROVED, but no money was ever transferred.
The issue was that you don't replace the onApprove function, rather, the onApprove function still needs to call actions.order.capture(). This method will then transfer the money, and mark the order as COMPLETED.
A decline is one possible scenario.
Reaching an order review page and not clicking on the final action that triggers the capture, is another.
Those are both normal events and not indicative of any problem.
Theoretically some type of technical error could also interrupt the process and contribute to this type of drop off, but that is not likely unless you receive specific reports of an issue.

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

paypal IPN - how to know when money has moved?

I'm using a basic HTML form to call PayPal (webscr) and I am successfully getting IPN callbacks.
There is plenty of documentation about the contents of each individual variable that can be returned in an IPN. There is something important missing, or else I have missed it:
What paypal transaction types and payment statuses reflect actual changes in my account balance? For example, a "Completed" status certainly does, and a "Pending" status certainly does not.
However, there appear to be five or six relevant transaction types and eleven different payment statuses possible. Other than trying all 55 or 66 combinations in the IPN simulator, is there any document that clearly shows for which ones I should accumulate the mc_gross amount?
Or to put it another way, some IPN messages are just "in case I need to know", and some mean "money has changed hands; adjust your accounts accordingly". It's not clear to me which combinations of transaction type and payment status indicate the latter.
Thanks and Best Regards,

Testing Paypal errors, Always Transaction Response code always 36

I'm trying to test a few failure conditions using the test version of our pay-pal api. Specifically a recuring payment with an initial payment. Therefor I'm using the recurring payment adding an additional transaction. When testing for success (amounts less than $1000 for both recuring and initial transaction) everything works as expexted. According to the paypal documentation using amounts over $1000 should result in a response code that is the amount over $1000. regarless ov the amount I use the response code is 36.
I've also tried amounts over $2000 which should result in a response code of 12. However I still get 36.
The only details changing between the call that works as expected and those that don't is the amount.
Update
Upon further investigation, the recurring transaction response is 12, as expected. However the transaction response, which I'm assuming is what I need for the additional transaction is still 36. This is what I need to be testing against.
I've also tried different test card numbers as supplied by pay-apl.
On a side note... I realise this is not a programing question per-se, but I've been bounced here by pay-pal as their "Forum"!!!
Further Information
I am using the .net api(SDK) as provided by paypal

PayPal partial parallel payment: Three payments OK, one errored with “The Buyer returned without completing the payment. (13114)”

Basically, how is this kind of a scenario possible?
One payment (of four) of a single transaction failed as returned without completing although three other payments of the same transaction were completed allright. Overall transaction status is PaymentActionCompleted.
How can user “return without completing” for just one payment? I suppose this must be some timing issue? I know that the parallel payments aren't transacted, but I was under impression that at least the commitment (clicking “Pay Now”) would be atomic, and that — for example — clicking cancel right after commit would do little.
To repeat the error message (for the single failed payment): The Buyer returned without completing the payment. (13114).
I've seen lots of “partial successes” with other error messages, but this is the first message that doesn't make much sense.