cURL
curl --request GET 'https://api.integrateledger.com/v1/migrate/stripe/preview' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.previewStripeMigration();import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.preview_stripe_migration(){
"prices": [
{
"priceId": "<string>",
"productId": "<string>",
"productName": "<string>",
"unitAmountCents": 123,
"currency": "<string>",
"interval": "<string>",
"intervalCount": 123,
"openSubscriptions": 123,
"importableSubscriptions": 123,
"ledgerPlanId": "<string>",
"refusal": {
"error": "<string>",
"reason": "<string>"
}
}
],
"subscriptions": [
{
"stripeSubscriptionId": "<string>",
"stripeCustomerId": "<string>",
"customerMetadata": {},
"priceId": "<string>",
"status": "<string>",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"importedAs": {
"customerId": "<string>",
"planId": "<string>"
},
"refusal": {
"error": "<string>",
"reason": "<string>"
}
}
],
"truncated": true
}{
"error": "<string>"
}{
"error": "rate_limited"
}{
"error": "internal_error",
"request_id": "<string>"
}{
"error": "<string>"
}Billing
Preview a Stripe migration
See what moving your Stripe Billing subscribers onto Ledger would import and refuse, without changing anything.
GET
/
v1
/
migrate
/
stripe
/
preview
cURL
curl --request GET 'https://api.integrateledger.com/v1/migrate/stripe/preview' \
-H "Authorization: Bearer $LEDGER_API_KEY"import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.previewStripeMigration();import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.preview_stripe_migration(){
"prices": [
{
"priceId": "<string>",
"productId": "<string>",
"productName": "<string>",
"unitAmountCents": 123,
"currency": "<string>",
"interval": "<string>",
"intervalCount": 123,
"openSubscriptions": 123,
"importableSubscriptions": 123,
"ledgerPlanId": "<string>",
"refusal": {
"error": "<string>",
"reason": "<string>"
}
}
],
"subscriptions": [
{
"stripeSubscriptionId": "<string>",
"stripeCustomerId": "<string>",
"customerMetadata": {},
"priceId": "<string>",
"status": "<string>",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"importedAs": {
"customerId": "<string>",
"planId": "<string>"
},
"refusal": {
"error": "<string>",
"reason": "<string>"
}
}
],
"truncated": true
}{
"error": "<string>"
}{
"error": "rate_limited"
}{
"error": "internal_error",
"request_id": "<string>"
}{
"error": "<string>"
}Reads the Stripe account connected to the key’s environment and answers what a migration would do. It changes nothing in Stripe or Ledger.
ledger migrate stripe runs on it.
prices: each Stripe Price that a subscription Stripe still bills is on, withopenSubscriptionsandimportableSubscriptions.ledgerPlanIdis set when the Price is one of your plans’ own synced Prices (a subscription Ledger already moved).refusalis set when no subscription on it can be imported:not_monthly,metered_price, a non-USDprice_mismatch, or a free Price (plan_not_paid).subscriptions: each open subscription, with the Stripe customer’scustomerMetadata(to choose your own customer ID from), the next renewal (currentPeriodEnd),importedAswhen Ledger already holds it, andrefusal: the code Import a Stripe subscription would answer, ornullwhen it would be imported. A customer whose Ledger metadata names another workspace or environment isstripe_customer_owned_elsewhere.
truncated: true means there are more, so migrate these and preview again.
It needs a saved Stripe connection (502 stripe_not_configured), but not a healthy webhook, so you can preview before fixing one. The key needs the customers:read permission.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.