Error Codes
Learn more about common error codes.
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.
Error codes | Description |
---|---|
auth-declined | Charge authorization hold declined. |
capture-greater-instrument | Cannot capture charges on this instrument for more than the authorization hold amount. |
capture-unequal-instrument | Cannot capture charges on this instrument for an amount unequal to the authorization hold amount. |
capture-voided | Cannot capture voided charge. |
partial-capture-instrument | Cannot partially capture charges on this instrument. |
refund-exceeded | Exceeded maximum refund. |
refund-uncaptured | Cannot refund a charge that has not been captured. |
refund-voided | Cannot refund a voided charge. |
capture-declined | Charge capture declined. |
capture-limit-exceeded | Exceed maximum capture amount on charge. |
expired-authorization | Cannot capture a charge with an expired authorization hold. |
refund-expired | Charges on this instrument must be refunded within N days of capture. |
invalid_field | An input field resulted in invalid request. |
public-api-key-not-specified | Please provide a public API key. |
public-api-key-invalid | Please provide a valid public API key. |
public-api-key-wrong-environment | Please provide a live public API key when not using the sandbox environment. |
public-api-key-inactive | Please provide an active public API key. |
api-key-pair-not-specified | Please provide an API key pair. |
private-api-key-invalid | Please provide a valid private API key. |
api-key-pair-wrong-environment | Please provide a live API key pair when not using the sandbox environment. |
api-key-pair-inactive | Please provide an active API key pair. |
not_found | Could not find the resource(s) specified in the request. |
Updated 3 months ago