Record usage for billing with the S3 connectorBeta
You can upload meter events in bulk by submitting a file. Stripe parses, validates, and transforms the file contents into meter events. After the events from your uploaded file are consumed, you’ll start seeing them on your subscription invoice.
You can ingest your usage data by uploading files in either JSON or JSONLINE formats. The schema of individual objects in the file corresponds with the Meter Event schema.
View an example of the JSON file format below.
[ { "identifier": "26ac9e54-6a13-4b2e-90b0-fedae80bb8f7", "timestamp": 1692852080, "event_name": "ai_search_api", "payload": { "value": 200, "stripe_customer_id": "cus_123" } }, { "timestamp": 1692852080, "event_name": "ai_search_api", "extra_key": "test", "payload": { "value": 500, "stripe_customer_id": "cus_123" } } ]
View an example of the JSONLINE file format below.
{"identifier":"123456","timestamp":1692852080,"event_name":"ai_search_api","payload":{"value":200,"stripe_customer_id":"cus_123"}} {"timestamp":1692852080,"event_name":"ai_search_api","extra_key":"test","payload":{"value":500,"stripe_customer_id":"cus_123"}}
Need support for different file format?
If you’re interested in uploading files with a different structure or in a custom format, contact us at user-data-acquisition-platform@stripe.com.
There are several methods you can use to upload your usage events data in bulk.
Import files from your Amazon S3 bucket
To import files from your Amazon S3 bucket into Stripe Data Management, you need to upload your meter events file to the S3 bucket. The S3 connector automatically polls and process those files. Learn how to set up the S3 connector.
When configuring your S3 connector, make sure that you use the Data Template. For the JSONLINE format, use the Billing Meter Event Transaction Template (JSONLINE), and for the JSON format, use the Billing Meter Event Transaction Template (JSON).
Import files in Stripe
- Navigate to the Data management page.
- Click Import file.
- Select Data Template.
- For JSON format files, choose the Billing Meter Event Transaction Template (JSON).
- For JSONLINE format files, choose the Billing Meter Event Transaction Template (JSONLINE).
- Upload your file, then click Import file.
- After Stripe successfully processes your file, you can check its status on the Import set list page.