curl -X GET https://api.llmgenerator.com/api/v1/credits/verify-session/cs_test_a1b2c3d4e5f6 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const sessionId = 'cs_test_a1b2c3d4e5f6';
const response = await fetch(
`https://api.llmgenerator.com/api/v1/credits/verify-session/${sessionId}`,
{
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
}
);
const data = await response.json();
if (data.success) {
console.log(`Added ${data.credits} credits`);
}
import requests
session_id = 'cs_test_a1b2c3d4e5f6'
response = requests.get(
f'https://api.llmgenerator.com/api/v1/credits/verify-session/{session_id}',
headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
)
data = response.json()
print(f"Verified: {data['credits']} credits")
{
"success": true,
"credits": 500,
"sessionId": "cs_test_a1b2c3d4e5f6"
}
{
"success": false,
"message": "Payment not completed"
}
Credits
Verify Checkout Session
Verify a completed checkout session and ensure credits have been added.
GET
/
credits
/
verify-session
/
{sessionId}
curl -X GET https://api.llmgenerator.com/api/v1/credits/verify-session/cs_test_a1b2c3d4e5f6 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const sessionId = 'cs_test_a1b2c3d4e5f6';
const response = await fetch(
`https://api.llmgenerator.com/api/v1/credits/verify-session/${sessionId}`,
{
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
}
);
const data = await response.json();
if (data.success) {
console.log(`Added ${data.credits} credits`);
}
import requests
session_id = 'cs_test_a1b2c3d4e5f6'
response = requests.get(
f'https://api.llmgenerator.com/api/v1/credits/verify-session/{session_id}',
headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
)
data = response.json()
print(f"Verified: {data['credits']} credits")
{
"success": true,
"credits": 500,
"sessionId": "cs_test_a1b2c3d4e5f6"
}
{
"success": false,
"message": "Payment not completed"
}
Overview
After a successful checkout, use this endpoint to verify the payment was processed and credits were added to the account. This is useful as a fallback in case the webhook wasn’t processed.Credits are typically added automatically via Stripe webhooks. This endpoint provides a manual verification option for edge cases or client-side confirmation.
For third-party integrations: Use
GET /credits/verify-session/{sessionId}/api with API Key authentication instead.Authentication
string
required
Your JWT access token (session auth). Format:
Bearer YOUR_ACCESS_TOKENPath Parameters
string
required
The Stripe checkout session ID returned from
/credits/checkout.curl -X GET https://api.llmgenerator.com/api/v1/credits/verify-session/cs_test_a1b2c3d4e5f6 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const sessionId = 'cs_test_a1b2c3d4e5f6';
const response = await fetch(
`https://api.llmgenerator.com/api/v1/credits/verify-session/${sessionId}`,
{
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
}
);
const data = await response.json();
if (data.success) {
console.log(`Added ${data.credits} credits`);
}
import requests
session_id = 'cs_test_a1b2c3d4e5f6'
response = requests.get(
f'https://api.llmgenerator.com/api/v1/credits/verify-session/{session_id}',
headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
)
data = response.json()
print(f"Verified: {data['credits']} credits")
{
"success": true,
"credits": 500,
"sessionId": "cs_test_a1b2c3d4e5f6"
}
{
"success": false,
"message": "Payment not completed"
}
Response Fields
boolean
Whether the session verification was successful.
integer
Number of credits from the purchase.
string
The verified session ID.
Error Responses
Bad Request - Payment not completed or invalid session metadata.
Unauthorized - Invalid or missing token.
Forbidden - Session does not belong to the authenticated user.
Idempotency
This endpoint is idempotent. If the credits were already added (via webhook), it will not add them again. It will still return success with the credit amount.Typical Flow
- User completes checkout at Stripe
- Stripe redirects to your
successUrl - Call this endpoint to verify and confirm credits
- Display confirmation to user
- Refresh credit balance in your UI
While this endpoint is available, the recommended flow is to listen for Stripe webhooks and update your UI based on the
/credits/balance endpoint.GET /credits/verify-session//api
This endpoint verifies a checkout session using API Key authentication. Ideal for third-party integrations.Authentication
Requires API Key authentication. Include your API key in theAuthorization header:
Authorization: Bearer llmgen_your_api_key_here
Path Parameters
Same as above.Response
Same as above.curl -X GET https://api.llmgenerator.com/api/v1/credits/verify-session/cs_test_a1b2c3d4e5f6/api \
-H "Authorization: Bearer llmgen_your_api_key_here"
const sessionId = 'cs_test_a1b2c3d4e5f6';
const response = await fetch(
`https://api.llmgenerator.com/api/v1/credits/verify-session/${sessionId}/api`,
{
headers: {
'Authorization': 'Bearer llmgen_your_api_key_here'
}
}
);
const data = await response.json();
if (data.success) {
console.log(`Added ${data.credits} credits`);
}
import requests
session_id = 'cs_test_a1b2c3d4e5f6'
response = requests.get(
f'https://api.llmgenerator.com/api/v1/credits/verify-session/{session_id}/api',
headers={'Authorization': 'Bearer llmgen_your_api_key_here'}
)
data = response.json()
print(f"Verified: {data['credits']} credits")
Was this page helpful?
⌘I