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
}
'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials"
payload = {
"secret_key": "<string>",
"is_test_mode": True
}
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({secret_key: '<string>', is_test_mode: true})
};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials', 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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials",
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([
'secret_key' => '<string>',
'is_test_mode' => true
]),
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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials"
payload := strings.NewReader("{\n \"secret_key\": \"<string>\",\n \"is_test_mode\": true\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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"secret_key\": \"<string>\",\n \"is_test_mode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials")
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 \"secret_key\": \"<string>\",\n \"is_test_mode\": true\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Stripe Configuration
Validate Stripe Credentials
Validate Stripe API credentials by making a test API call
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
}
'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials"
payload = {
"secret_key": "<string>",
"is_test_mode": True
}
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({secret_key: '<string>', is_test_mode: true})
};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials', 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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials",
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([
'secret_key' => '<string>',
'is_test_mode' => true
]),
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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials"
payload := strings.NewReader("{\n \"secret_key\": \"<string>\",\n \"is_test_mode\": true\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://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"secret_key\": \"<string>\",\n \"is_test_mode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/projects/{project_id}/validate-credentials")
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 \"secret_key\": \"<string>\",\n \"is_test_mode\": true\n}"
response = http.request(request)
puts response.read_body{
"valid": true,
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<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
string (UUID)
required
The unique identifier of the project
Request Body
string
required
The Stripe secret key to validate (starts with
sk_test_ or sk_live_)boolean
default:"true"
Whether this is a test mode key. Set to
false for live keys.Response
boolean
Whether the credentials are valid
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
| 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
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
| 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
Update Stripe Config
Save validated credentials
Get Stripe Config
View current configuration
Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Body
application/json

