#ironbeard_object-deleted-webhook-events

1 messages ยท Page 1 of 1 (latest)

spiral lagoonBOT
#

๐Ÿ‘‹ 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/1488197372306653214

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

fierce elbow
#

Hello, can you tell me more about what you are trying to do here? Of those I think just customer and coupon can't be retrieved after their delete calls

#

The other will still let you access their data in the API I believe

shadow coral
#

hey ๐Ÿ™‚ I've made mirror models for a few Stripe primatives to store the info in my local db (readonly), which get updated via webhooks. it's working pretty well, just wasn't sure which rows I should delete locally when getting a .deleted webhook.

spiral lagoonBOT
uncut herald
#

Hi ๐Ÿ‘‹

I'm stepping in as my colleague needs to go soon.

shadow coral
#

all good ๐Ÿ™‚

uncut herald
#

I"m not sure I follow what you are trying to understand from these webhook events. It's difficult to speak in the abstract though so can you provide some concrete examples?

#

I think the easiest thing to do would be to create these events yourself using test data and see how they correspond with the state of your data.

shadow coral
#

I suppose what i'm wondering is: since Customer doesn't have an "active" field like Product does, when a customer.deleted webhook is sent from Stripe, does that mean that the Customer object was actually deleted on Stripe servers (contrasted to product.deleted, where the Product still exists on Stripe servers, it's just marked as active=False, if I understand correctly).

uncut herald
#

I don't think your undestanding is correct here. I think .deleted don't just mean active=false. But I could be wrong. I recommend testing this.

You can even use the CLI to generate some of these events to see the state of the object after they occurr

shadow coral
#

Oh, good to know. I know how to create the objects using the SDK and listen for webhooks. Do I need to create the objects in SDK in order to trigger a delete event in the CLI?

uncut herald
#

For customer.deleted all you need to do is stripe trigger customer.deleted. All the objects will be created for you.

#

I just tested this and then I ran stripe get cus_XXX to retrieve the object from the API. All I saw was

{
  "id": "cus_UFCW0FAnbXINmP",
  "object": "customer",
  "deleted": true
}
shadow coral
#

Oh, nice. I didn't see deleted listed as a Customer object property so I wasn't sure. But I see how to go forward now. Thanks ๐Ÿ™‚

uncut herald
#

Yeah, this is because the object itself has been deleted and we return this representation (which isn't really a Customer object)

shadow coral
#

OH, okay cool cool

uncut herald
#

I'm pretty sure the same is true for Products and Prices because we don't let you delete those if they have ever ben used

shadow coral
#

Yes, makes sense.

uncut herald
#

Once a Price has been used in a transaction, you can only mark it as inactive to prevent it from being used in the future

shadow coral
#

been learning a lot about Stripe CLI, very very useful

uncut herald
#

Yeah, just don't try to replace all your API scripts with it ๐Ÿ˜…

#

It's intended to allow for easy, rapid testing but not a substitute for scripting API interactions. But some devs try to use it like that. It never ends well

shadow coral
#

hahaha for sure

#

Thanks as always!

uncut herald
#

Happy to help ๐Ÿ™‚