Notifica S2S
Richiesta
{
"externalId":"TR_1",
"checkoutState":"000"
}
Risposte
200 Success
{
"status":"000"
}
400 Errore Validazione
{
"status":"001",
"errorCode":"XXX"
}
// The request body as an associative array
$requestBody = json_decode($request->body, true);
$callbackRequest = CheckoutStateCallback::parse($request->body)
$valid = $client->verifyCallback($callbackRequest);
if($valid) {
$successResponse = new CallbackSuccessResponse();
// Return the response as json
$responseBody = json_encode($successResponse->toArray());
/*
* Send the response as JSON with $responseBody as payload.
* The following line is for example purpose only.
*/
return response()->json($responseBody, 200);
}else {
// Handle error
}
Per l’SDK PHP completo visitare questo link
from sdk.callbacks import CheckoutStateCallback
from sdk.exceptions import ValidationError
try:
callback = CheckoutStateCallback.create(request.json())
# handle callback
# return a response with body {"status": "000"}
except ValidationError:
# handle exception
Per l’SDK Python completo visitare questo link