Validate Stripe API credentials before saving them to your configuration. This endpoint makes a test API call to Stripe to verify the credentials are valid and have the necessary permissions.
Authentication
This endpoint requires developer authentication via OAuth2 Bearer Token. You must own the project.
Path Parameters
The unique identifier of the project
Request Body
The Stripe secret key to validate (starts with sk_test_ or sk_live_)
Whether this is a test mode key. Set to false for live keys.
Response
Whether the credentials are valid
Validation result message
Example Request
Validate a test mode secret key:
curl -X POST "https://api.devkit4ai.com/api/v1/payments/stripe/projects/550e8400-e29b-41d4-a716-446655440000/validate-credentials" \
-H "Authorization: Bearer {developer_jwt}" \
-H "Content-Type: application/json" \
-d '{
"secret_key": "sk_test_51ABC...",
"is_test_mode": true
}'
Successful Validation
{
"valid": true,
"message": "Stripe credentials are valid"
}
Failed Validation
{
"valid": false,
"message": "Invalid API key provided: sk_test_..."
}
Validation Flow
Common Validation Errors
| Error | Cause | Solution |
|---|
| Invalid API key | Key doesn’t exist or is malformed | Double-check the key from Stripe Dashboard |
| API key is restricted | Key has limited permissions | Use an unrestricted key or add required permissions |
| Test key for live mode | Provided test key with is_test_mode: false | Use matching key type for the mode |
| Account not verified | Stripe account requires verification | Complete verification in Stripe Dashboard |
Best Practices
Test Both Modes
Validate test and live keys separately before going to production.
Check Mode Matching
Ensure is_test_mode matches the key type (sk_test_ vs sk_live_).
This endpoint only validates the secret key. Make sure your publishable key and webhook secret are also correct when configuring payments.
Error Responses
| Status | Description |
|---|
401 | Unauthorized - Invalid or missing authentication |
403 | Forbidden - You don’t own this project |
404 | Project not found |
422 | Validation error - Missing or invalid request body |
Related Pages
The access token received from the authorization server in the OAuth 2.0 flow.
Request to validate Stripe credentials.
Validation result for Stripe credentials.