Forum Academy Marketplace Showcase Pricing Features

Stripe - Usage Record API - Struggling to get it

Hello, fellow bubblers.

I am struggling to get this API to initiate. I believe that it is the timestamp variable. This is the API documentation for the situation. Stripe API reference – Create a usage record

Here is the latest screenshot.

Here is the latest error.

Here is the error on the stripe log.

On the api reference it states the following

Screen Shot 2021-10-04 at 12.29.35 AM

So maybe the time you are providing is not within the current billing period.

Also remember that Stripe uses seconds not milliseconds like Bubble so if you are pulling the data from bubble you may have that as milliseconds instead of seconds as Stripe would expect.

I’d also do a quick test with changing the Body type to JSON instead of Form-data

So I switched the Body type to JSON and got the same error message. I have also tried to approach the situation using the method below and got the same error. My question is can you provide me with a properly formatted timestamp. I believe that this variable is where I am falling short.

Figured it out and wanted to share what I learned. Anyone attempting this API should know that you will need the tool box plugin to capture an accurate timestamp and you will also need to call the stripe retrieve a subscription API before calling the usage record API. (images provided below) I hope this keeps someone from staring at a screen for a weekend like I did.

usage record api


image

toolbox plugin (for the timestamp)

Toolbox plugin implementation
image

retrieve a subscription API.


image

workflow