Receiving the Payment URL

The payment gateway returns a response in JSON format containing an HTTP success or error status code.

Success

In case of success, the payment gateway returns an HTTP status code 200 OK.

The response contains the payment URL where the mobile application must redirect the buyer.

{
	"status":"INITIALIZED",
	"redirect_url":"https://secure.payzen.eu:443/vads-payment/exec.refresh.a;jsessionid=CE2Cb9daEDe7f6dBF31FE65e.vadpayment01bdx"
}

Error

In case of error, the payment gateway returns an HTTP status code 400 Bad Request or 500 Internal Server Error.

The response will contain the details of the error.

{
	"status":"ERROR",
	"error":" {"code": "09", "value": "Missing or invalid parameter value"}"
}

For more details, see the list of error codes of the Hosted Payment Page Implementation Guide:

Excerpt from the sample code:
//If the HTTP return code is 200 (OK) we prepare the generated URL
if (httpResponseCode == 200) {
	if ("INITIALIZED".equals(responseData.get("status"))) {
		redirectionUrl = responseData.get("redirect_url");
	} else {
		//Payment could  not be created. Maybe a missing parameter, an invalid value or signature?
		//Use logs here in order to detect and fix the real cause
		throw new RuntimeException("Error in payment initialization. Returned error: " + responseData.get("error"));
	}
} else {
	throw new RuntimeException("Error in payment initialization. HTTP errorCode: " + httpResponse);
}