Stripe Get Invoices

I tried to set up a process to allow for automatic detection of Stripe Payment Failures in my app because as far as I can tell, this functionality is not present in the Bubble Stripe Plugin.

Now what I am experiencing is perplexing and a bit annoying. I am seeing two different “Paid” status dependent on how I am retrieving the information, despite all other aspects to the invoice being the same.

Notice that the two different repeating groups are showing the same Invoice ID, Subscription, Total, Period Start and Period End information, however the difference is the Paid status. One says YES the other says NO.

I set up one repeating group using the Get Stripe Invoices function

Screen Shot 2020-09-05 at 10.32.39 PM

In this repeating group I am getting the Paid status of YES

The other repeating group I used entries I saved to my Database

I set up a database data type of Payment Details and added a list data field for stripe invoices and set up a backend workflow to add the users most recent invoice to this list at the end of each payment period (when a new payment would be made, which could be successful or fail)

The backend workflow is saving to the database correctly, at least it seems that way, however the repeating group with this list of invoices shows the Paid Status as NO

Screen Shot 2020-09-05 at 10.36.36 PM

In my Stripe account I have only one user with this email address and all payments are showing that it succeeded

If I was able to see something within Stripe that would signal there are two customers with the same Email, I’d understand why there could be the issue, but there is not, it is the same customer.

What is more annoying about this as well is that my backend workflow that is set up to trigger based on a failed payment is using the conditional to check the Paid Status, and if the Paid Status is NO it is supposed to trigger the failed payment workflow but it has never been triggered, presumably, because it is getting the correct Paid Status which would have been YES the entire period and was instead triggering the backend workflow for successful payments.

Also, looking at my logs, it shows the scheduled workflows is based on a successful payment with a Paid status of YES

Any ideas why this would be happening?

Use stripe webhooks to detect payment failure or subscription deleted (settings for X amount of retries in stripe settings)

After you setup a webhooks on backend workflows using “detect data” you will want to capture the invoice ID and verify it’s marked as unpaid for extra protection.

Thanks for the suggestion, but my preferences is to not use webhooks. I’d prefer to use the plugin and not have to deal with learning how to set up the webhooks. Just curious about why I’d have the discrepancy I am seeing and outline.

Here’s setup docs, if you need help I can hop on a zoom with you.

https://stripe.com/docs/billing/subscriptions/overview

From experience webhooks are a necessity with stripe. It’s the only correct way to go about it to ensure payment fails and subscription creations to work perfectly.

There are times you have a delay I’m sure if you put a 10 second pause it would work fine.

BUT

You actually have webhooks partially setups.
Here’s a brief outline.

->create 2 back end api workflow called “failed_sub” & one for “sub_started”

Instead of using manual fields to “detect automatically” and click detect. It should give an initialization URL(keep it detecting)

-> inside stripe go to webhooks and create the 2.
For failed payment do subscription.deleted (only if your retry schedule is set to delete a sub after X failurd attempts) (DO THIS IN TEST MODE)

Paste the detect URL and click test.

->Now back in bubble your detect data screen should be filled with data.

-> Now do the “sub_started” workflow add subscription.created & subscription.active to webhook options
(This ensures someone who creates a new one OR resumes will be handled by that workflow)

After you’re done take it out of test mode and in the webhook URL on stripe remove /initialization

Now in your workflows build out the flow for changing customer status in dash, giving access to software, etc.

1 Like

Not using webhooks caused MANY issues in my V1 app. I will gladly hop on a zoom to help if needed

This topic was automatically closed after 14 days. New replies are no longer allowed.