# Code and Formats source: https://developer.mastercard.com/pclo-presentment/documentation/code-and-formats/index.md Note: Mastercard supports OAuth 2.0 for authenticating application HTTP requests. Refer to the following resources for guidance and documentation: * [Offers for Publishers (Legacy) OAuth 2.0 authentication and first call tutorial](https://developer.mastercard.com/pclo-presentment/documentation/tutorials-and-guides/index.md) * [Using OAuth 2.0 to Access Mastercard APIs](https://developer.mastercard.com/platform/documentation/authentication/using-oauth-2-to-access-mastercard-apis/) * [Offers for Publishers (Legacy) Reference Application](https://static.developer.mastercard.com/content/pclo-presentment/uploads/offers-for-publishers-legacy-ref-app.zip): The reference application supports OAuth 1.0a request signing and OAuth 2.0 using FAPI 2.0 with `private_key_jwt` client authentication and DPoP-bound access tokens. Refer to the `README.md` file in the root directory of the application for authentication mode details. * [Offers for Publishers API](https://developer.mastercard.com/presentment/documentation/release-history/) updated documentation
Support for OAuth 1.0a authentication remains available. ## Errors Overview {#errors-overview} Resource requests use HTTP response codes to provide a coarse grain indication of the result of each request. The most common expected response codes for the supported HTTP methods are as follows: | Status Code | Response | Description | |-------------|--------------------|---------------------------------------------------------------------------------------------------------------------------| | 200 | OK | The request was completed successfully. | | 201 | CREATED | Successful creation occurred using a POST request. The Location header will contain a link to the newly created resource. | | 400 | BAD REQUEST | General error when the request could not be fulfilled due to errors such as validation errors or missing required data. | | 401 | UNAUTHORIZED | Missing or invalid authentication token. | | 403 | FORBIDDEN | The user is not authorized to perform the operation. | | 404 | NOT FOUND | The requested resource was not found. | | 405 | METHOD NOT ALLOWED | The requested URL exists, but the requested HTTP method is not applicable. | ## Gateway Error Codes {#gateway-error-codes} For further information about the error message fields, 4xx/5xx response codes and possible resolutions, see [Gateway Error Codes](https://developer.mastercard.com/platform/documentation/errors-troubleshooting/gateway-error-codes/). ## Error Structure {#error-structure} 4xx/5xx error response messages have one of the following formats (the `Error` array may contain multiple error items): Single Error : ```json { "Errors": { "Error": [ { "ReasonCode": "", "Source": "", "Description": "", "Details": "", "Recoverable": true/false } ] } } ``` Multiple Errors : ```json { "Errors": { "Error": [ { "ReasonCode": "", "Source": "", "Description": "", "Details": "", "Recoverable": true/false },{ "ReasonCode": "", "Source": "", "Description": "", "Details": "", "Recoverable": true/false } ] } } ``` | Field | Description | |-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ReasonCode | A unique constant identifying the error case encountered during transaction processing. For example, `INVALID_SIGNATURE` is used when the request signature does not match the expected one. | | Source | The application that generated this error. Every error message that is generated and returned by the gateway will have this field equal to `Gateway`. When the value of the source field is something else, it means that the error was generated elsewhere. | | Description | Short description of the `ReasonCode` field. | | Details | Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors. | | Recoverable | Indicates whether this error will always be returned for this request, or if retrying could change the outcome. For example, if the request contains an invalid signature, retrying will never result in a success. However, if the error is related to some unexpected timeout with the service, retrying the call could result in a successful response. | ```json { "error": "error_code", "error_description": "Human-readable error description", "details": "Type of the error", "source": "Source of the issue", "recoverable": true/false } ``` | Field | Description | |-------------------|-------------------------------------------------------------------| | error | The standard OAuth 2.0 error code that identifies the error type. | | error_description | Additional details about the error to assist in troubleshooting. | | details | An optional detailed description of the error. | | source | The source of the error. | | recoverable | Indicates whether retrying could change the outcome. | ## Offers for Publishers API-Specific Errors {#offers-for-publishers-api-specific-errors} Sample of Offers for Publishers API error object : ```json { "Errors": { "Error": [ { "ReasonCode": "400", "Source": "PCLO API", "Description": "FId is not provided or Value provided is invalid", "Details": "Bad Request", "Recoverable": true } ] } } ``` The Offers for Publishers API-specific error codes are as follows: | Reason Code | Description | Tip to resolve | |-----------------------|-----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------| | INVALID_USER_TOKEN | Invalid User Token. | The provided User Token is invalid. Please provide a valid User Token. | | INVALID_FID | Invalid FID | The provided FID is invalid. Please provide a valid Financial Institution Identifier (FID). | | INVALID_OFFER_ID | Invalid offer ID. | The provided offer ID is invalid. Please provide a valid offer ID. | | INVALID_ACTIVATION_ID | Invalid offer activation ID. | The provided offer activation ID is invalid. Please provide a valid offer activation ID. | | SC_ACTIVATION_FAILED | Offer activation failed. For example, the offer is already activated. | Activation attempt for the offer failed. For example, if the offer is already activated, please activate an offer that is not yet activated. | | INVALID_FEEDBACK | Invalid feedback | The feedback provided is invalid. Please provide valid feedback. | | OFFER_UNAVAILABLE | Offer no longer available. | The provided offer is no longer available or is invalid. Please request an available and valid offer. | | USERTOKEN_UNAVAILABLE | User Token is not available for the provided user. | Please make sure that the User Token is created and available for the user. | ## Activation Response Status Codes {#activation-response-status-codes} The Activation Response Status Codes indicate that the activation request is either QUEUED, IN_PROGRESS, COMPLETED, or FAILED. ## Next Steps {#next-steps} Proceed to the [Support](https://developer.mastercard.com/pclo-presentment/documentation/support/index.md) section to access frequently asked questions and access technical support.