Affirm uses HTTP response status codes to indicate the success or failure of your API requests. If your request fails, Affirm returns an error using the appropriate status code.
In general, there are three status code ranges you can expect:
2xx success status codes confirm that your request worked as expected.
4xx error status codes indicate an error because of the information provided (e.g., a required parameter was omitted).
5xx error status codes are rare and indicate an error with Affirm's servers
Some 4xx errors that could be handled programmatically include an error code—a short string with a brief explanation—as a value for code. Below is a list of possible error codes that can be returned, along with additional information.
|Charge authorization hold declined.|
|Cannot capture charges on this instrument for more than the authorization hold amount.|
|Cannot capture charges on this instrument for an amount unequal to the authorization hold amount.|
|Cannot capture voided charge.|
|Cannot partially capture charges on this instrument.|
|Exceeded maximum refund.|
|Cannot refund a charge that hasn't been captured.|
|Cannot refund a voided charge.|
|Charge capture declined.|
|Exceed maximum capture amount on charge.|
|Cannot capture a charge with an expired authorization hold.|
|Charges on this instrument must be refunded within N days of capture.|
|An input field resulted in invalid request.|
|Please provide a public API key.|
|Please provide a valid public API key.|
|Please provide a live public API key when not using the sandbox environment.|
|Please provide an active public API key.|
|Please provide an API key pair.|
|Please provide a valid private API key.|
|Please provide a live API key pair when not using the sandbox environment.|
|Please provide an active API key pair.|
|Could not find the resource(s) specified in the request.|
Updated almost 2 years ago