#johnm2023_webhooks

1 messages ยท Page 1 of 1 (latest)

mint jungleBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1387435295447715930

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

pallid flicker
#

Hi there ๐Ÿ‘‹ can you confirm which version of stripe-java you're using?

scenic mulch
#

29.2.0

idle cosmos
#

Hi taking over here and looking into it

scenic mulch
#

Thanks...

idle cosmos
#

Hm yeah there's no api version mismatch between your account default and the sdk version you're using

#

That's a common cause of the error

#

Can you share more of your webhook endpoint code?

#

Are you getting an exception?

scenic mulch
#

@PostMapping("/webhook/stripe")
public ResponseEntity<?> processStripeWebhook(@RequestHeader("Stripe-Signature") String signatureHeader,@RequestBody String payload) throws Exception {
Event event = null;
if (stripeWebhookSecurity) {
try {
event = Webhook.constructEvent(payload, signatureHeader, stripeSecritySecret);
} catch (SignatureVerificationException e) {
log.error("security exception processing webhook.");
}
} else {
event = ApiResource.GSON.fromJson(payload, Event.class);
}
webHookService.processWebHook(event);

    return ResponseEntity.ok("success");
}
#

@Transactional
public void processWebHook(Event event) throws Exception {
try {
switch (event.getType()) {
case BepConstants.WEBHOOK_PAYOUT_PAID:
processPayoutPaid(event);
break;
default:
;
log.info("Un-registered Event. Event is " + event.getType());
}
}
catch (Exception e){
log.error("Error occured processing web hook " + event.getType() +". error is " + e.toString());
throw new RuntimeException(e);
}
}

public void processPayoutPaid(Event event){
    log.info("Processing payout.paid webhook");
    LocalDateTime dateCreated = CommonUtils.dateStampFromUnixEpoc(event.getCreated());
    EventDataObjectDeserializer edo = event.getDataObjectDeserializer();
    StripeObject stripeObject = edo.getObject().get();
    String account = event.getAccount();
    Payout payout = (Payout) stripeObject;
    payoutService.processPayoutPaid(payout,account,dateCreated );
}
#

StripeObject stripeObject = edo.getObject().get(); is where we are getting the issue

idle cosmos
#

That seems fine

#

You're positive you're on 29.2.0?

#

Object really only should be null if the version was mismatched

scenic mulch
#

<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>29.2.0</version>
</dependency>

idle cosmos
#

Yeah but can you check the physical library that's being used

#

Sometimes there can be issues where the latest wasn't installed properly from the pom

scenic mulch
#

ok... I did a clean and install

#

It appears to be working now

idle cosmos
#

Ah there we go

#

Old version cached I guess

#

Glad you got it

scenic mulch
#

Thanks for your help...