From the Java SDK code examples, I could only find how to validate a received webhook event.
Anyone knows how to parse received HTTP request body posted by PayPal to my webhook handler servlet into an Event object?
I initially figured sth like that, which seems clumsy:
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(requestBody).getAsJsonObject();
JsonElement idAsJsonObject = o.get("id");
String id = idAsJsonObject.getAsString();
Event event = Event.get(apiContextStore.create(), id);
Context: I want to use Payments API in asynchronous mode to move funds from our PayPal account to customer's PayPal account. I am creating a handler for the Webhook notifications to move the payment into completed state on our side.