Supported Objects

Collection NameReadWrite
accountβœ…βœ…
applicationβœ…
balance_transactionβœ…
bank_accountβœ…βœ…
billing_portal.configurationβœ…βœ…
billing_portal.sessionβœ…βœ…
chargeβœ…
checkout.sessionβœ…βœ…
country_specβœ…
credit_noteβœ…βœ…
customerβœ…βœ…
customer_balance_transactionβœ…βœ…
disputeβœ…βœ…
eventβœ…
fee_refundβœ…βœ…
file_linkβœ…βœ…
invoiceβœ…βœ…
invoiceitemβœ…βœ…
issuing.cardβœ…βœ…
issuing.cardholderβœ…βœ…
issuing.disputeβœ…βœ…
issuing.transactionβœ…βœ…
itemβœ…βœ…
line_itemβœ…βœ…
mandateβœ…βœ…
orderβœ…βœ…
order_returnβœ…βœ…
payoutβœ…βœ…
personβœ…βœ…
planβœ…βœ…
priceβœ…βœ…
productβœ…βœ…
promotion_codeβœ…βœ…
radar.early_fraud_warningβœ…
radar.value_list_itemβœ…βœ…
refundβœ…βœ…
reporting.report_runβœ…
reporting.report_typeβœ…
reserve_transactionβœ…βœ…
scheduled_query_runβœ…
setup_intentβœ…βœ…
skuβœ…βœ…
sourceβœ…βœ…
source_mandate_notificationβœ…
subscriptionβœ…βœ…
tax_deducted_at_sourceβœ…
tax_idβœ…βœ…
tax_rateβœ…βœ…
terminal.locationβœ…βœ…
three_d_secureβœ…βœ…
transferβœ…βœ…
upcoming_customer_invoiceβœ…
upcoming_subscription_invoiceβœ…
usage_recordβœ…βœ…
usage_record_summaryβœ…
webhook_endpointβœ…βœ…

Stripe API key

To sync your Stripe data to your Sequin database, you just need to provide us with a Stripe API key.

Create a Stripe API key

While you can supply Sequin with a standard key, we recommend you provision us with a restricted key like so: Step 1: Login to your Stripe dashboard and ensure you are in the correct account. Step 2: In the Restricted keys section click the + Create restricted key button. Step 3: In the top left, name the key something like β€œSequin.” Step 4: Under the β€œPermissions” column, select β€œRead” for every row except β€œAll webhook resources.” For β€œAll webhook resources,” select β€œWrite.” Step 5: Click Create. Listed out, Sequin needs the following permissions:
  • All core resource: Read
  • All checkout resources: Read
  • All bulling resources: Read
  • All connect resources: Read
  • All orders resources: Read
  • All issuing resources: Read
  • All reporting resources: Read
  • All webhook resources: WRITE
  • CLI permissions: None

Test keys

To get familiar with How Sequin works with Stripe, you can always start by using your Stripe test key. Sequin resources that use a Stripe test API key are free to use. To retrieve your Stripe test key, follow these steps: Step 1: Login to your Stripe dashboard. Step 2: Toggle to view your Stripe test data by flipping the View test data switch. Step 3: Click the Reveal test key button.

Stripe database schema

Your Sequin database will contain all your Stripe data. We’re still working on an entity-relationship diagram (ERD) that you can use as a reference. We have one in progress here, but it’s not for the faint of heart! The Stripe Sigma documentation is a helpful resource, as naturally a lot of our names and structure are similar.

Upcoming Objects

Stripe has several object types, such as Upcoming Invoices, which are only generated on-demand as previews. Since these objects are not persistent in Stripe, they don’t have an id. In this case, Sequin uses the customer_id or subscription_id as a proxy for primary key. For example, the upcoming_customer_invoice table uses customer_id as the primary key. The upcoming_subscription_invoice table uses subscription_id as the primary key. Unlike most objects, Stripe doesn’t create Events for changes to these objects. Instead, Sequin detects other events that are likely to trigger updates on these objects and immediately fetches an updated version from Stripe’s /v1/invoices/upcoming endpoint to keep your synced data up-to-date.

Stripe data types

Amounts

Stripe stores currency amounts in the smallest unit. Your Sequin data does the same. So as an example, $10.00 USD will be stored as an integer value of 1000 in your Sequin database.

Currency

Currency types are stored as ISO 4217 Currency Codes in lower case.

JSON blobs

Some nested data structures are stored as type JSONB in your Sequin database.

The syncing process

Sequin workers first backfill your database with all your Stripe data by paginating through all Stripe API endpoints. Then, after the backfill, Sequin workers poll Stripe’s /events endpoint twice per second to ingest any creates, updates, or deletes. You can read more about how Sequin’s syncing process for Stripe works on our blog.

Writes

The Sequin Postgres Proxy

To create, update, or delete objects in Stripe, you can insert, update, or delete rows in your Postgres database. When you’re connected to your database through the Sequin Proxy, the Proxy listens for changes. When you make a mutation, the Proxy applies the mutation to Stripe’s API first. If the mutation succeeds, your database is updated as well. If it fails, your database mutation will be rolled back, and you’ll receive a Postgres error. Data flows from Stripe to your Postgres database. Your code or SQL client then reads from the database. To mutate your data, you update records in your database. Those mutations are applied to Stripe then to your database. With this architecture, Stripe remains the source of truth and your database never gets out-of-sync.

How updates via the Proxy work

The Postgres Proxy forwards changes to Stripe’s API before applying them to your database. The order of operations is therefore expressed in the following example, sequentially:
  1. You make an insert to create a new entry in the β€œOrders” table on Stripe.
  2. The Sequin Proxy forwards the request to Stripe.
  3. Stripe responds with a 200. The body contains the new order.
  4. The Sequin Proxy writes the new order to the orders table in your Sequin database.
  5. Your Postgres client returns successfully.