Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
When working with marketplace redemption APIs, it's crucial to have robust error handling. This article explores best practices for handling errors, from understanding common error codes to implementing graceful error recovery strategies.
Errors are returned using the standard PlayFab Error Wrapper
APIErrorWrapper
The APIErrorWrapper is a wrapper around every failed API response.
| Name | Type | Description |
|---|---|---|
| code | integer | Numerical HTTP code. |
| error | string | PlayFab error code. |
| errorCode | integer | Numerical PlayFab error code. |
| errorDetails | object | Detailed description of individual issues with the request object. |
| errorMessage | string | Description for the PlayFab errorCode. |
| status | string | String HTTP code. |
For any marketplacemrelated issues, we return a Key-Value Pair (KVP) in the errorDetails object.
| Name | Type | Description |
|---|---|---|
| MarketplaceErrorCode | string[] | The error code returned from the marketplace if a call to the marketplace failed. The first string in the array will be the error code. The second string will be the error message if it’s available. |
Note
This is a passthrough of the error code and error code message returned by the marketplace.
The error response will appear as shown below. Developers should verify that wrapper.errorDetails['MarketplaceErrorCode'] is not null and then parse the first element to handle different marketplace error codes accordingly.
"{
"code":503,
"errorDetails":
{
"MarketplaceErrorCode":["1234","sample error code"]
},
...
}"
Public Failure HTTP Status Codes
This section lists the error codes returned by redeem APIs.
- 400 - Bad Request
- All request and input validation failures
GenericErroCodes.InvalidRequest - All configuration validation failures
GenericErrorCodes.InvalidServiceConfiguration - All marketplace authorization failures
GenericErrorCodes.InvalidServiceConfiguration- Related to service identity failures.GenericErrorCodes.InvalidAuthToken- Related to player identity failures.
- All catalog item configuration failures
GenericErrorCodes.InvalidCatalogItemConfiguration
- All request and input validation failures
- 401/403 - Not Authorized/Forbidden
- PlayFab authorization failures
GenericErrorCodes.NotAuthorized
- PlayFab authorization failures
- 503 - MarketplaceUnavailable
GenericErrorCodes.DownstreamServiceUnavailable