How do you test for errors in PayPal sandbox mode.
I would like to test for payment declined, card expired, etc.
I am using the js method for payments as below, but can only find reference to the call of onError, which only gives answers to server or other errors not related to payments errors.
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'paypal'
},
createOrder: function (data, actions) {
return actions.order.create({
... onError ?????
Yes but it is a question of how you invoke an error.
That page on not very clear on how to invoke failed payments in the first place to get the individual responses.
So… you went to that page, clicked on the relevant link at the bottom for the type of negative testing you want to do, read that, looked at the list of error codes, and came up with question marks?
2 Likes
Yes, the question marks have been coded in and not working.
The onError only fires if there is a server error.
Prior to this I need to test orders for invalid credit cards, expired cards, or any other errors.
Yes I can clearly read the error responses and codes provided by PayPal
And yes error testing is turned on in my account.
It is a question of how you input faulty data into paypal to analyse the order result. Not very clear on any paypal developer links anywhere.
So… again… you read this:
Followed by the example that gave:
and beneath it:
and then you read the error codes, and… did what with that information that you definitely have told me you read at this point.
Yep
And response of order: (orders)
{
"id": "30L57261GW298550N",
"intent": "CAPTURE",
"status": "CREATED",
}
Transaction goes through: (capture)
{
"id":"30L57261GW298550N",
"intent":"CAPTURE",
"status":"COMPLETED",
}
items: [
{
name: "Purchase",
description: "purchased.",
sku: "web",
note: "ERRPYO002",
unit_amount: { currency_code: "GBP", value: paynetamount },
quantity: "1",
tax: { currency_code: "GBP", value: payvatamount },
category: "PHYSICAL_GOODS"
}
]