PlexySDK DOCS

Result Codes

Test different payment result scenarios

Result Codes

Test how your integration handles various payment outcomes.

Success scenarios

Card NumberResult
4242424242424242Payment succeeds
5555555555554444Payment succeeds (Mastercard)
378282246310005Payment succeeds (Amex)

Decline scenarios

Trigger specific decline reasons:

Card NumberDecline Reason
4000000000000002Generic decline
4000000000009995Insufficient funds
4000000000009987Lost card
4000000000009979Stolen card
4000000000000069Expired card
4000000000000127Incorrect CVC
4000000000000119Processing error
4000000000000101Invalid number

Handle decline responses

try {
  const payment = await plexy.payments.create({
    amount: 5000,
    currency: 'USD',
    payment_method: {
      type: 'card',
      card: {
        number: '4000000000009995', // Insufficient funds
        exp_month: 12,
        exp_year: 2030,
        cvc: '123',
      },
    },
  });
} catch (error) {
  if (error.type === 'card_error') {
    switch (error.code) {
      case 'insufficient_funds':
        // Ask customer to try different card
        break;
      case 'card_declined':
        // Generic decline message
        break;
      default:
      // Handle other declines
    }
  }
}

CVC check results

CVCResult
123CVC check passes
000CVC check fails

AVS check results

Postal CodeResult
12345AVS passes
00000AVS fails

Response structure

Failed payments include detailed error information:

{
  "id": "pay_abc123",
  "status": "failed",
  "failure_code": "insufficient_funds",
  "failure_message": "The card has insufficient funds.",
  "decline_code": "insufficient_funds",
  "outcome": {
    "type": "issuer_declined",
    "reason": "insufficient_funds",
    "ripr_level": "normal"
  }
}

Map to customer messages

CodeCustomer Message
insufficient_funds"Your card has insufficient funds. Please try a different card."
card_declined"Your card was declined. Please try a different card."
expired_card"Your card has expired. Please use a valid card."
incorrect_cvc"The security code is incorrect. Please check and try again."
processing_error"An error occurred. Please try again."

See also

On this page