Import
Preview a Stripe Import
Dry-run a Stripe export — see exactly what a commit would do, with no side effects.
POST
/
v1
/
import
/
stripe
/
preview
Dry-run preview of a Stripe export
curl --request POST \
--url https://billing.example.com/v1/import/stripe/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customers": [
{}
],
"products": [
{}
],
"prices": [
{}
],
"subscriptions": [
{}
],
"payment_methods": [
{}
]
}
'import requests
url = "https://billing.example.com/v1/import/stripe/preview"
payload = {
"customers": [{}],
"products": [{}],
"prices": [{}],
"subscriptions": [{}],
"payment_methods": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customers: [{}],
products: [{}],
prices: [{}],
subscriptions: [{}],
payment_methods: [{}]
})
};
fetch('https://billing.example.com/v1/import/stripe/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/import/stripe/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
]
],
'products' => [
[
]
],
'prices' => [
[
]
],
'subscriptions' => [
[
]
],
'payment_methods' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/import/stripe/preview"
payload := strings.NewReader("{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/import/stripe/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/import/stripe/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"kind": "customer",
"stripe_id": "<string>",
"label": "<string>",
"action": "create",
"detail": "<string>"
}
],
"summary": {},
"warnings": [
"<string>"
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Parses an uploaded Stripe export (customers, products, prices, subscriptions,
payment methods) and returns a plan describing what a
commit would
Run this until the plan looks right, then send the same payload to
commit.
create, link_existing,
skip_already_imported, mark as a conflict, or refuse as unsupported —
nothing is written. Existing customers are matched by email and linked rather
than duplicated. Amounts are minor units, as in Stripe.
Example request
curl -X POST https://api.recurso.dev/v1/import/stripe/preview \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customers": [
{ "id": "cus_QxT4m2Kd9Lp0Ab", "email": "priya@example.com", "name": "Priya Sharma", "currency": "usd" }
],
"products": [
{ "id": "prod_R2kY8wNv5Xc1Qe", "name": "Pro", "active": true }
],
"prices": [
{ "id": "price_S7hJ3pMz6Wd2Rf", "product": "prod_R2kY8wNv5Xc1Qe", "unit_amount": 2900, "currency": "usd", "active": true, "recurring": { "interval": "month", "interval_count": 1 } }
],
"subscriptions": [
{ "id": "sub_T9gK5qLx7Ye3Sh", "customer": "cus_QxT4m2Kd9Lp0Ab", "status": "active", "current_period_start": 1754006400, "current_period_end": 1756684800, "items": { "data": [ { "price": { "id": "price_S7hJ3pMz6Wd2Rf" } } ] } }
],
"payment_methods": []
}'
Example response
{
"items": [
{ "kind": "customer", "stripe_id": "cus_QxT4m2Kd9Lp0Ab", "label": "Priya Sharma <priya@example.com>", "action": "create", "detail": "" },
{ "kind": "plan", "stripe_id": "price_S7hJ3pMz6Wd2Rf", "label": "Pro — 2900 usd / month", "action": "create", "detail": "" },
{ "kind": "subscription", "stripe_id": "sub_T9gK5qLx7Ye3Sh", "label": "active", "action": "create", "detail": "" }
],
"summary": { "create": 3 },
"warnings": []
}
Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Body
application/json
The Stripe export JSON.
⌘I
Dry-run preview of a Stripe export
curl --request POST \
--url https://billing.example.com/v1/import/stripe/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customers": [
{}
],
"products": [
{}
],
"prices": [
{}
],
"subscriptions": [
{}
],
"payment_methods": [
{}
]
}
'import requests
url = "https://billing.example.com/v1/import/stripe/preview"
payload = {
"customers": [{}],
"products": [{}],
"prices": [{}],
"subscriptions": [{}],
"payment_methods": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customers: [{}],
products: [{}],
prices: [{}],
subscriptions: [{}],
payment_methods: [{}]
})
};
fetch('https://billing.example.com/v1/import/stripe/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/import/stripe/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
]
],
'products' => [
[
]
],
'prices' => [
[
]
],
'subscriptions' => [
[
]
],
'payment_methods' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/import/stripe/preview"
payload := strings.NewReader("{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/import/stripe/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/import/stripe/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {}\n ],\n \"products\": [\n {}\n ],\n \"prices\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ],\n \"payment_methods\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"kind": "customer",
"stripe_id": "<string>",
"label": "<string>",
"action": "create",
"detail": "<string>"
}
],
"summary": {},
"warnings": [
"<string>"
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}