---
schema_version: "1"
id: 1979a491892375cb4b27c22c05b0b5670cece682896d5661d8ffc306494c230d
title: PaymentError Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_RichMessaging_PaymentError.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_RichMessaging_PaymentError.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: d2b4d657395153f41d9af7ef63b7d4e2d1e65e8a9232f5c6ac7f4216796296bd
description: Represents an error that occurred during a payment transaction.The error code returned by the payment gateway.The error message describing the payment failure.
---
# PaymentError Class

Represents an error that occurred during a payment transaction.

## Namespace

[RichMessaging](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_RichMessaging.htm "Provides objects and methods for handling content in enhanced Messaging channels.")

- **[PaymentError Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_RichMessaging_PaymentError.htm#apex_RichMessaging_PaymentError_properties)**

## PaymentError Properties

The following are properties for PaymentError.

- **[code](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_RichMessaging_PaymentError.htm#apex_RichMessaging_PaymentError_code)**  
    The error code returned by the payment gateway.
- **[message](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_RichMessaging_PaymentError.htm#apex_RichMessaging_PaymentError_message)**  
    The error message describing the payment failure.

### code

The error code returned by the payment gateway.

#### Signature

public String code {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### message

The error message describing the payment failure.

#### Signature

public String message {get; set;}

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")