#tymm

1 messages · Page 1 of 1 (latest)

slim plazaBOT
vagrant belfry
#

Hi there, can you do a System.out.println(event) and see that it prints out?

lyric flume
#

im using 22.3.0

#
     "account": null,
     "api_version": "2020-08-27",
     "created": 1671427731,
     "data": {
         "previous_attributes": null,
         "object": {
             "id": "seti_1MGbu3LK0bfo5HSbVWme8cYX",
             "object": "setup_intent",
             "application": null,
             "cancellation_reason": null,
             "client_secret": "seti_1MGbu3LK0bfo5HSbVWme8cYX_secret_N0dAUZIZiodor0dQzeV8rgtKcZ0dDeU",
             "created": 1671427723,
             "customer": "cus_N0dA6PaiTQKa6z",
             "description": null,
             "flow_directions": null,
             "last_setup_error": null,
             "latest_attempt": "setatt_1MGbuALK0bfo5HSbGZWWliPK",
             "livemode": false,
             "mandate": null,
             "metadata": {},
             "next_action": null,
             "on_behalf_of": null,
             "payment_method": "pm_1MGbuALK0bfo5HSbZ7zhM33u",
             "payment_method_options": {
                 "card": {
                     "mandate_options": null,
                     "network": null,
                     "request_three_d_secure": "automatic"
                 }
             },
             "payment_method_types": [
                 "card"
             ],
             "single_use_mandate": null,
             "status": "succeeded",
             "usage": "off_session"
         }
     },
     "id": "evt_1MGbuBLK0bfo5HSbZ107KPyr",
     "livemode": false,
     "object": "event",
     "pending_webhooks": 2,
     "request": {
         "id": "req_CDtDC3yJcOGAyK",
         "idempotency_key": "b2a2b6e7-319f-4e2f-a765-8347fbcf6f29"
     },
     "type": "setup_intent.succeeded"
 }
vagrant belfry
#

And what are you trying to achieve ?

lyric flume
#

it was a callback that i use to insert data into my db when customer has added a payment method

#

it was working fine previously

vagrant belfry
#

what data are you inserting to your db?

#

And did you update your Stripe API recently?

lyric flume
#

yes

vagrant belfry
#

OK, did dataObjectDeserializer.getObject().isPresent() return false?

lyric flume
#

i have updated stripe cli to latest version

vagrant belfry
#

Can you check if dataObjectDeserializer.getObject().isPresent() return false?

lyric flume
#

yes, it returns false

vagrant belfry
#

OK, did you pass a --latest flag when running stripe listen ?

lyric flume
#

no

#

lemme try

vagrant belfry
#

You don't need to pass the this flag, it tells Stripe to receive events used in the latest API version

#

Since isPresent() return false, it means that the Stripe SDK is unable to deserialize this object, mostly due to version conflict.

lyric flume
#

i think that somehow fixed it

vagrant belfry
#

Ah, did you also update your Java SDK recently?

lyric flume
#

yes

#

i updated both cli and sdk to the latest version

vagrant belfry
#

I see. you are using SDK 23.3.0, which is compatible to the latest API version 2022-11-15. And setting --latest flag in Stripe CLI allows the webhook event to be constructed in the latest API version so that your code is able to deserialize.

#

However, I'd recommend you only update the Java SDK if you also have plan to upgrade your Stripe API version, or webhook endpoint API version.

lyric flume
#

what do u mean

vagrant belfry
#

Now you are forcing the webhook events to be constructed in the latest version by using the --latest flag. In production, the webhook events are still constructed based your account's default API version (i.e., 2020-08-27), or webhook endpoint's API version if there's one.

lyric flume
#

how do i update the api version in my account?

vagrant belfry
#

I'd also recommend you to follow this guide to test out the new API version before committing an upgrade.

lyric flume
#

got it, thanks