curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/checkout \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"planId": "professional",
"successUrl": "https://yourapp.com/subscription/success",
"cancelUrl": "https://yourapp.com/pricing"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/subscriptions/checkout', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
planId: 'professional',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/pricing'
})
});
const data = await response.json();
// Redirect user to Stripe checkout
window.location.href = data.url;
import requests
response = requests.post(
'https://api.llmgenerator.com/api/v1/subscriptions/checkout',
headers={
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
'planId': 'professional',
'successUrl': 'https://yourapp.com/subscription/success',
'cancelUrl': 'https://yourapp.com/pricing'
}
)
data = response.json()
print(f"Redirect to: {data['url']}")
{
"sessionId": "cs_test_a1b2c3d4e5f6g7h8i9j0",
"url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3d4...",
"plan": {
"id": "professional",
"name": "Professional",
"monthlyCredits": 3000,
"priceCents": 1299
}
}
Abonnements
Abonnement-Checkout erstellen
Stripe-Checkout-Sitzung zum Abschluss eines Abonnements erstellen.
POST
/
subscriptions
/
checkout
curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/checkout \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"planId": "professional",
"successUrl": "https://yourapp.com/subscription/success",
"cancelUrl": "https://yourapp.com/pricing"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/subscriptions/checkout', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
planId: 'professional',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/pricing'
})
});
const data = await response.json();
// Redirect user to Stripe checkout
window.location.href = data.url;
import requests
response = requests.post(
'https://api.llmgenerator.com/api/v1/subscriptions/checkout',
headers={
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
'planId': 'professional',
'successUrl': 'https://yourapp.com/subscription/success',
'cancelUrl': 'https://yourapp.com/pricing'
}
)
data = response.json()
print(f"Redirect to: {data['url']}")
{
"sessionId": "cs_test_a1b2c3d4e5f6g7h8i9j0",
"url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3d4...",
"plan": {
"id": "professional",
"name": "Professional",
"monthlyCredits": 3000,
"priceCents": 1299
}
}
Überblick
Erstellt eine Stripe-Checkout-Sitzung für ein Abonnement und liefert eine URL, zu der Sie den Nutzer zur Zahlung weiterleiten. Erfordert Sitzungsauthentifizierung (JWT-Access-Token).Für Drittanbieter-Integrationen: Verwenden Sie
POST /subscriptions/checkout/api mit API-Schlüssel-Authentifizierung.Authentifizierung
string
erforderlich
JWT-Access-Token. Format:
Bearer YOUR_ACCESS_TOKENAnfragetext
string
erforderlich
Tarifkennung: einer von
starter, professional, business oder agency.string
Standard:"monthly"
Abrechnungsintervall:
monthly oder yearly.string
URL nach erfolgreicher Zahlung. Standard: App-Dashboard.
string
URL bei Abbruch der Zahlung. Standard: Preisseite.
curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/checkout \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"planId": "professional",
"successUrl": "https://yourapp.com/subscription/success",
"cancelUrl": "https://yourapp.com/pricing"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/subscriptions/checkout', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
planId: 'professional',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/pricing'
})
});
const data = await response.json();
// Redirect user to Stripe checkout
window.location.href = data.url;
import requests
response = requests.post(
'https://api.llmgenerator.com/api/v1/subscriptions/checkout',
headers={
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
'planId': 'professional',
'successUrl': 'https://yourapp.com/subscription/success',
'cancelUrl': 'https://yourapp.com/pricing'
}
)
data = response.json()
print(f"Redirect to: {data['url']}")
{
"sessionId": "cs_test_a1b2c3d4e5f6g7h8i9j0",
"url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3d4...",
"plan": {
"id": "professional",
"name": "Professional",
"monthlyCredits": 3000,
"priceCents": 1299
}
}
Antwortfelder
string
Stripe-Checkout-Sitzungs-ID. Später zur Verifikation nutzbar.
string
URL zur Zahlung. Stripe-gehostete Checkout-Seite.
object
Details des gewählten Tarifs.
Checkout-Ablauf
- Sitzung erstellen: Endpunkt mit gewünschtem Tarif aufrufen
- Nutzer weiterleiten: Zu der zurückgegebenen
urlnavigieren - Zahlung: Nutzer schließt bei Stripe ab
- Webhook: Stripe benachrichtigt Ihren Webhook-Endpunkt
- Erfolgs-Redirect: Nutzer wird zu
successUrlgeleitet - Optional prüfen: Status über
/subscriptions/current
Fehlerantworten
Ungültige Anfrage – Ungültige Tarif-ID oder Nutzer hat bereits ein aktives Abonnement.
Nicht autorisiert – Ungültiges oder fehlendes Token.
Hat der Nutzer bereits ein aktives Abonnement, sollte der Tarifwechsel über das Abrechnungsportal (
/subscriptions/portal) erfolgen.POST /subscriptions/checkout/api
Erstellt eine Stripe-Checkout-Sitzung mit API-Schlüssel-Authentifizierung. Geeignet für Drittanbieter-Integrationen.Authentifizierung
API-Schlüssel erforderlich. Übergeben Sie ihn im HeaderAuthorization:
Authorization: Bearer llmgen_your_api_key_here
Anfragetext
Wie bei/subscriptions/checkout oben.
Antwort
Wie bei/subscriptions/checkout oben.
curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/checkout/api \
-H "Authorization: Bearer llmgen_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"planId": "professional",
"successUrl": "https://yourapp.com/subscription/success",
"cancelUrl": "https://yourapp.com/pricing"
}'
const response = await fetch('https://api.llmgenerator.com/api/v1/subscriptions/checkout/api', {
method: 'POST',
headers: {
'Authorization': 'Bearer llmgen_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
planId: 'professional',
successUrl: 'https://yourapp.com/subscription/success',
cancelUrl: 'https://yourapp.com/pricing'
})
});
const data = await response.json();
// Redirect user to Stripe checkout
window.location.href = data.url;
import requests
response = requests.post(
'https://api.llmgenerator.com/api/v1/subscriptions/checkout/api',
headers={
'Authorization': 'Bearer llmgen_your_api_key_here',
'Content-Type': 'application/json'
},
json={
'planId': 'professional',
'successUrl': 'https://yourapp.com/subscription/success',
'cancelUrl': 'https://yourapp.com/pricing'
}
)
data = response.json()
print(f"Redirect to: {data['url']}")
War diese Seite hilfreich?
⌘I