If a customer chooses to store their card details we call the V1 "create customer" endpoint which will save customer data as well as the token. We then can call the "create charge" endpoint and charge the same token with no issues.
If we use one of the test "decline" cards we get inconsistent errors (see results below). We pass the error messages back to the customer to allow them to correct the issue but the message from the "create customer" endpoint would mean nothing to them.
If we ignore the "create customer" endpoint error and attempt the charge anyway we then get:
"You cannot use a clover token more than once unless it is marked as multipay."
which also would mean nothing to the customer.
Is there a better way to do this without having to parse all the errors before presenting them to the customer?
The "create customer" endpoint returns:
{
"message": "402 Payment Required",
"error": {
"type": "card_error",
"code": "card_declined",
"message": "Token verification failed for token clv_1TSTS8QxKbg85ZEdGQNHdsNE"
}
}
The "create charge" endpoint returns:
{
"message": "402 Payment Required",
"error": {
"code": "card_declined",
"message": "DECLINED: No reason provided.",
"charge": "5CVE6JBPM3MXA",
"declineCode": "issuer_declined"
}
}