Skip to main content
POST
/
api
/
v1
/
payments
/
stripe
/
projects
/
{project_id}
/
validate-credentials
Validate Stripe Credentials
curl --request POST \
  --url https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "secret_key": "<string>",
  "is_test_mode": true
}
'
{
  "valid": true,
  "message": "<string>"
}
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

project_id
string (UUID)
required
The unique identifier of the project

Request Body

secret_key
string
required
The Stripe secret key to validate (starts with sk_test_ or sk_live_)
is_test_mode
boolean
default:"true"
Whether this is a test mode key. Set to false for live keys.

Response

valid
boolean
Whether the credentials are valid
message
string
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

ErrorCauseSolution
Invalid API keyKey doesn’t exist or is malformedDouble-check the key from Stripe Dashboard
API key is restrictedKey has limited permissionsUse an unrestricted key or add required permissions
Test key for live modeProvided test key with is_test_mode: falseUse matching key type for the mode
Account not verifiedStripe account requires verificationComplete verification in Stripe Dashboard

Best Practices

1

Validate Before Saving

Always validate credentials before calling Update Stripe Config.
2

Test Both Modes

Validate test and live keys separately before going to production.
3

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

StatusDescription
401Unauthorized - Invalid or missing authentication
403Forbidden - You don’t own this project
404Project not found
422Validation error - Missing or invalid request body

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Path Parameters

project_id
string<uuid>
required

Body

application/json

Request to validate Stripe credentials.

secret_key
string
required
Minimum string length: 1
is_test_mode
boolean
default:true

Response

Successful Response

Validation result for Stripe credentials.

valid
boolean
required
message
string
required