I created a webhook on a Stripe page that returns a response when cards are created.
Now I want to get this Event data into my Apex method for further work.
I created an Apex class but the problem is that when I try to call a method in the Apex class I get an error : “System.NullPointerException: Attempt to de-reference a null object”
(I understand that my response from webhook does not reach apex)
@RestResource(urlMapping='/stripeWebhook/*')
global with sharing class StripeWebhookHandler {
@HttpPost
global static String handleWebhook() {
String requestBody = RestContext.request.requestBody.toString();
System.debug('=== requestBody ===');
System.debug(requestBody);
return 'error';
}
}
Tell me what I have wrong or if it is correct what should I do to get the answer from the stripe to my apex method