Forum Academy Marketplace Showcase Pricing Features

API Endpoint - Use Stripe Webhooks

I’m integrating Stripe webhooks for a better management of sellers connected accounts. For instance, if a seller desauthorized my app or update it’s account, I need to automatically update his account.

Problem is that I found out different issues preventing me from doing it :

  1. If I define a new endpoint URL in Stripe, Events objects are not flat JSON response, so we can’t access the object data with all the important stuffs.

  2. We can’t access User’s Stripe’s Account ID in “Do a search for” search, so we can’t lie the Event to its Bubble User seller
    When I get the top-level user_id property which identifies the user for whom the webhook is being sent, how can I find the Bubble User it lies to since we can’t access to User’s Stripe Account ID property in a “Do a search for” ?
    I could save User’s Stripe Account ID as a new field when the connected account is registrerd, but it would be a pity as the property is already there.

  3. Same issue with Stripe’s Customer ID to find a Bubble User Customer.

Did someone found a workaround for this ?

@emmanuel. If there is not, would it be possible to let us access our Stripe Event as new triggers, directly linked to our Customers and Sellers users ? Ideally, managing also Event about our Sellers connected account (Event wiht the user_id parameter) ?

Here are some use cases I wish to implement for managing better my plateform :

  • Trigger a process when Invoice.created and add create a new InvoiceItem based on last period activity while the invoice is still open. Using this webhook is the only way to do it…

  • For connected-accounts, connect.account.updated/deleted :

    • update the important parameter “charge_enabled” + email alerte + disabling payment feature before user attempt making a purchase.
    • Get Stripe’s seller business information updated in bubble ddb to generate invoice on behalf of them.
  • For connected-accounts, keep track of sellers’s charge disputes (created/updated/close/reinstated/withdrawn) with their own customers (as it’s part of my value proposition)

  • Update bubble seller account when customer.subscription.updated / deleted for enabling/disabling features. Important for instance after several failed attempt to charge an invoice.

For some of these use cases, I could run a workflow each time a user do an action, like “Get Seller Account Info” for making some checks, but doesn’t sound good.

Did you look at how we do it for our own app? https://bubble.io/page?type=api&id=meta_public&tab=tabs-2

2 Likes

And there was light.

2 Likes

Ok, so you defined a different endpoint url for each type of event.

Is there a security reason why we can’t directly access User’s Seller accound id & User’s Customer id directly ? if not I ll copy them in User table

No security reason but exposing this isn’t super starightforward if you want to do search on them. Copying them is a good middle term solution.

When a workflow starts with “Subscribe the user to a plan”, is its User’s Stripe Customer ID directly available when calling this parameter in the next actions or there may be a delay ?
Would it be possible to have get the Customer ID as a “Result of” this action so we are sure it’s there ? About this kind of stuff, I want to be 100% sure about what’s going on.

Not being able to find Stripe Ids in “Do a search for…” complicate things much more than what I thought. If something get wrong when coping the Customer ID or Seller ID as new fields, all the webhooks call will fail.

There shouldn’t be a delay.

Ok, thks.

Ohter question. If an object looks something like this

{
“id”: “evt_18GbrBAhDfkOpvANDcoDnXJ4”,
“data”: { “object”: { “id”: “cus_18GbrBAhDfkOpvANlWTZ2oa0”…

and triggers a Bubble API endpoint, have you plan to let us access the data.object.id chield field ? Then we would not call for every new event a “Get event’s object id” .

@emmanuel
How come my app doesn’t have an API endpoint page? Do I have to install the API connector to use endpoints or is this something different?

Also, is there any good documentation on how to integrate Stripe webhooks with Bubble endpoints?
Thanks

No, you should activate the API through the settings tab, if you’re on a paid plan.

Best is to start with this https://bubble.io/reference#API, and search through the forum for a few relevant posts.

Stripe expects a 200 to be returned upon successful receipt of a webhook. Why are the checkboxes on the workflows in the Bubble App titled “Return a 200 if condition IS NOT met”? Shouldn’t they be “Return a 200 if condition IS met”? Or am I missing something?

2 Likes

Hi Nicolas,

Have you sorted out this topic ?
I have the same need, getting event data such as “data”: { “object”: { “id”: “cus_18GbrBAhDfkOpvANlWTZ2oa0”…
and creating a database in my app.

@romain.vittot - Yes, I have the same question. I’m trying to setup my API endpoint to read “id” in the following payload coming into my endpoint (i.e an object inside of an object):

{
  "event_id": "4fdb9fbb3b0f0dd34730621e4e0b38c6",
  "event_type": "response",
  "form_response": {
    "form_id": "abc123",
    "token": "4fdb9fbb3b0f0dd34730621e4e0b38c6",
    "submitted_at": "2016-03-23T13:37:00Z",
    "definition": {
      "id": "BpLnfg",
      "title": "Test Submission",
                       }
           }
}

Any idea if it’s possible to setup the API endpoint to store either “id” or at least the entire payload so I can search it for a unique “id” and match it against my Bubble database?

I think @emmanuel had mentioned that we cannot currently accept nested objects. Looking for creative ways around this.

No solution from my side, I am working on other topics currently but will take it back in few days.
Let me know if any progress form your side.

I’ve tried to store the entire payload in a Thing, but Bubble just stores “[object] [object]” inside of text data field…so there doesn’t appear to be anyway to store the nested objects and then search through the text for unique identifier. This is disappointing, hopefully the Bubble Team adds this as a feature to the API workflows in the near future. I definitely advocate for it.

I read somewhere that we might be able to enter {name_of_nested_object} into the key of the API workflow, but I haven’t had any luck as of yet. Maybe there is a json parser we can integrate to process the nested objects.

@emmanuel - curious about your thoughts on @supernaturally’s last comments please? This same issue is blocking out ability to implement Lob webhooks as well. Thanks.

CCing @CoBubble as well who may be able to provide more information.

Hello,

​This is not something we support but some users have expressed interest in sponsoring this.

​https://forum.bubble.io/t/nested-fields-api-endpoint-help/12873

​https://forum.bubble.io/t/can-shopify-apps-be-built-with-bubble/11463/3

[email protected] - what is the sponsorship process?