We tested payment of an invoice with a fraudulent card, but the error message returned did not appear to include an indicator that the card was fraudulent - or the id of the [failed] charge.
It would be helpful for the error to include both these pieces of information.
We tried this on the test system using card number 4100000000000019.
Below are the details of the response.
Thanks very much.
Robin
type: "StripeInvalidRequestError",
stack: "Error: Your card was declined.
at Error._Error (/opt/app-root/src/node_modules/stripe/lib/Error.js:12:17)
at Error.Constructor (/opt/app-root/src/node_modules/stripe/lib/utils.js:99:13)
at Error.Constructor (/opt/app-root/src/node_modules/stripe/lib/utils.js:99:13)
at Function.StripeError.generate (/opt/app-root/src/node_modules/stripe/lib/Error.js:57:14)
at IncomingMessage.<anonymous> (/opt/app-root/src/node_modules/stripe/lib/StripeResource.js:154:39)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)",
rawType: "invalid_request_error",
code: "card_declined",
param: undefined,
message: "Your card was declined.",
detail: undefined,
raw: {
type: "invalid_request_error",
message: "Your card was declined.",
code: "card_declined",
headers: {
server: "nginx",
date: "Wed, 09 Aug 2017 12:04:25 GMT",
content-type: "application/json",
content-length: "128",
connection: "close",
access-control-allow-credentials: "true",
access-control-allow-methods: "GET, POST, HEAD, OPTIONS, DELETE",
access-control-allow-origin: "*",
access-control-max-age: "300",
cache-control: "no-cache, no-store",
idempotency-key: "scr.invoices.pay.20170809120425036",
original-request: "req_gnrDygz0MLDpkX",
request-id: "req_gnrDygz0MLDpkX",
stripe-version: "2017-06-05"
},
statusCode: 402,
requestId: "req_gnrDygz0MLDpkX"
},
headers: {
server: "nginx",
date: "Wed, 09 Aug 2017 12:04:25 GMT",
content-type: "application/json",
content-length: "128",
connection: "close",
access-control-allow-credentials: "true",
access-control-allow-methods: "GET, POST, HEAD, OPTIONS, DELETE",
access-control-allow-origin: "*",
access-control-max-age: "300",
cache-control: "no-cache, no-store",
idempotency-key: "scr.invoices.pay.20170809120425036",
original-request: "req_gnrDygz0MLDpkX",
request-id: "req_gnrDygz0MLDpkX",
stripe-version: "2017-06-05"
},
requestId: "req_gnrDygz0MLDpkX",
statusCode: 402,