updated card and bank error handling messages
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
const DECLINE_MESSAGES = {
|
||||
authentication_required: {
|
||||
ownerMessage: "The renter's card requires additional authentication.",
|
||||
renterMessage: "Your card requires authentication to complete this payment.",
|
||||
renterMessage:
|
||||
"Your card requires authentication to complete this payment.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: false,
|
||||
requires3DS: true,
|
||||
@@ -20,7 +21,7 @@ const DECLINE_MESSAGES = {
|
||||
requiresNewPaymentMethod: false, // renter might add funds
|
||||
},
|
||||
card_declined: {
|
||||
ownerMessage: "The renter's card was declined by their bank.",
|
||||
ownerMessage: "The renter's card was declined.",
|
||||
renterMessage:
|
||||
"Your card was declined. Please contact your bank or try a different card.",
|
||||
canOwnerRetry: false,
|
||||
@@ -81,7 +82,7 @@ const DECLINE_MESSAGES = {
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
incorrect_zip: {
|
||||
ownerMessage: "Billing address verification failed.",
|
||||
ownerMessage: "Renter's billing address couldn't be verified.",
|
||||
renterMessage:
|
||||
"Your billing address couldn't be verified. Please update your payment method.",
|
||||
canOwnerRetry: false,
|
||||
@@ -96,7 +97,7 @@ const DECLINE_MESSAGES = {
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
do_not_honor: {
|
||||
ownerMessage: "The renter's card was declined by their bank.",
|
||||
ownerMessage: "The renter's card was declined.",
|
||||
renterMessage:
|
||||
"Your card was declined. Please contact your bank or try a different card.",
|
||||
canOwnerRetry: false,
|
||||
@@ -104,41 +105,170 @@ const DECLINE_MESSAGES = {
|
||||
},
|
||||
invalid_account: {
|
||||
ownerMessage: "The renter's card account is invalid.",
|
||||
renterMessage:
|
||||
"Your card account is invalid. Please use a different card.",
|
||||
renterMessage: "Your card account is invalid. Please use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
new_account_information_available: {
|
||||
ownerMessage: "The renter's card information needs to be updated.",
|
||||
renterMessage: "Your card information needs to be updated. Please re-enter your payment details.",
|
||||
renterMessage:
|
||||
"Your card information needs to be updated. Please re-enter your payment details.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
card_not_supported: {
|
||||
ownerMessage: "The renter's card type is not supported.",
|
||||
renterMessage: "This card type is not supported. Please use a different card.",
|
||||
renterMessage:
|
||||
"This card type is not supported. Please use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
currency_not_supported: {
|
||||
ownerMessage: "The renter's card doesn't support this currency.",
|
||||
renterMessage: "Your card doesn't support USD payments. Please use a different card.",
|
||||
renterMessage:
|
||||
"Your card doesn't support USD payments. Please use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
try_again_later: {
|
||||
ownerMessage: "The payment processor is temporarily unavailable. Please try again.",
|
||||
renterMessage: "A temporary error occurred. The owner can try again shortly.",
|
||||
ownerMessage:
|
||||
"The payment processor is temporarily unavailable. Please try again.",
|
||||
renterMessage:
|
||||
"A temporary error occurred. The owner can try again shortly.",
|
||||
canOwnerRetry: true,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
|
||||
// Additional Card Declines
|
||||
call_issuer: {
|
||||
ownerMessage: "The renter needs to contact their bank.",
|
||||
renterMessage:
|
||||
"Please call your bank to authorize this transaction, then try again.",
|
||||
canOwnerRetry: true,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
do_not_try_again: {
|
||||
ownerMessage: "The renter's card has been permanently declined.",
|
||||
renterMessage:
|
||||
"This card cannot be used. Please add a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
isPermanent: true,
|
||||
},
|
||||
duplicate_transaction: {
|
||||
ownerMessage: "This appears to be a duplicate charge attempt.",
|
||||
renterMessage:
|
||||
"This looks like a duplicate charge. Please wait a moment before trying again.",
|
||||
canOwnerRetry: true,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
issuer_not_available: {
|
||||
ownerMessage: "The renter's bank is temporarily unavailable.",
|
||||
renterMessage:
|
||||
"Your bank is temporarily unavailable. Please try again in a few minutes.",
|
||||
canOwnerRetry: true,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
restricted_card: {
|
||||
ownerMessage: "The renter's card has restrictions.",
|
||||
renterMessage:
|
||||
"This card has restrictions. Please contact your bank or use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
withdrawal_count_limit_exceeded: {
|
||||
ownerMessage: "The renter has exceeded their card's daily limit.",
|
||||
renterMessage:
|
||||
"You've reached your card's daily limit. Please try tomorrow or use a different card.",
|
||||
canOwnerRetry: true,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
not_permitted: {
|
||||
ownerMessage: "This transaction is not permitted on the renter's card.",
|
||||
renterMessage:
|
||||
"This transaction is not permitted on your card. Please use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
invalid_amount: {
|
||||
ownerMessage: "The payment amount is invalid.",
|
||||
renterMessage:
|
||||
"There was an issue with the payment amount. Please contact support.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: false,
|
||||
},
|
||||
security_violation: {
|
||||
ownerMessage: "The payment was blocked for security reasons.",
|
||||
renterMessage:
|
||||
"Your payment was blocked for security reasons. Please contact your bank.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
stop_payment_order: {
|
||||
ownerMessage: "A stop payment order exists on this card.",
|
||||
renterMessage:
|
||||
"A stop payment has been placed. Please contact your bank or use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
transaction_not_allowed: {
|
||||
ownerMessage: "Renter's card does not allow this transaction type.",
|
||||
renterMessage:
|
||||
"This transaction is not allowed on your card. Please use a different card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
|
||||
// ACH/Bank Account Declines
|
||||
bank_account_closed: {
|
||||
ownerMessage: "The renter's bank account has been closed.",
|
||||
renterMessage:
|
||||
"Your bank account has been closed. Please add a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
bank_account_frozen: {
|
||||
ownerMessage: "The renter's bank account is frozen.",
|
||||
renterMessage:
|
||||
"Your bank account is frozen. Please contact your bank or use a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
bank_account_restricted: {
|
||||
ownerMessage: "The renter's bank account has restrictions.",
|
||||
renterMessage:
|
||||
"Your bank account has restrictions. Please contact your bank or use a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
bank_account_unusable: {
|
||||
ownerMessage: "The renter's bank account cannot be used.",
|
||||
renterMessage:
|
||||
"Your bank account cannot be used for payments. Please add a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
bank_account_invalid_details: {
|
||||
ownerMessage: "The renter's bank account details are invalid.",
|
||||
renterMessage:
|
||||
"Your bank account details appear to be invalid. Please re-enter your bank information.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
debit_not_authorized: {
|
||||
ownerMessage: "The renter's bank account is not authorized for debits.",
|
||||
renterMessage:
|
||||
"Your bank account is not authorized for automatic debits. Please enable ACH payments or use a card.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
},
|
||||
};
|
||||
|
||||
// Default error for unknown decline codes
|
||||
const DEFAULT_ERROR = {
|
||||
ownerMessage: "The payment could not be processed.",
|
||||
renterMessage: "Your payment could not be processed. Please try a different payment method.",
|
||||
renterMessage:
|
||||
"Your payment could not be processed. Please try a different payment method.",
|
||||
canOwnerRetry: false,
|
||||
requiresNewPaymentMethod: true,
|
||||
};
|
||||
@@ -179,7 +309,10 @@ function parseStripeError(error) {
|
||||
};
|
||||
}
|
||||
|
||||
if (error.type === "StripeAPIError" || error.type === "StripeConnectionError") {
|
||||
if (
|
||||
error.type === "StripeAPIError" ||
|
||||
error.type === "StripeConnectionError"
|
||||
) {
|
||||
return {
|
||||
code: "api_error",
|
||||
ownerMessage: "A temporary error occurred. Please try again.",
|
||||
|
||||
Reference in New Issue
Block a user