OK response that returns a Bango ID straight away. You can use this mechanism to trigger testing scenarios that you don’t usually encounter naturally or can’t simulate, such as failures by payment providers.
To force certain responses, include one or two special HTTP headers in the API request:
Prefer: specifies which HTTP status code to respond withpreference-extension: specifies values you need in the response body, to disambiguate responses with the same HTTP status code
Prefer header to force a particular response. If you can’t, you may alternatively be able to use Bango TestPay to force that response.
Never include a Prefer or preference-extension header in production.
Prefer header
Use this header with a Bango Payment API request to force a response with the specified HTTP status code. For example, if you specify
Prefer: status=401 with an API request you’ll always receive an HTTP 401 response, and the response body will specify responseCode as UNAUTHORIZED to match the appropriate API definition.
Some HTTP status codes correspond to more than one responseCode in the response body. For example, HTTP status 202 might mean a responseCode of USER_CANCELLED or NOT_AVAILABLE or others, depending on the API in use. To choose which responseCode to receive, include the preference-extension header.
preference-extension header
Use this header together with
Prefer to select the response you want if the HTTP status code matches multiple possible responses. See Bango Payment / Merchant API reference for details of status codes and how they relate to responseCode values.
Examples
ForceUNAUTHORIZED:
Force
CLIENT_ACTION_REQUIRED with action REDIRECT (for those API calls supporting this response):
Force
DECLINED (for those API calls supporting this response):

