Create Checkout Session
curl --request POST \
--url https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price_id": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"mode": "subscription",
"quantity": 1,
"metadata": {},
"allow_existing_subscription": false
}
'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session"
payload = {
"price_id": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"mode": "subscription",
"quantity": 1,
"metadata": {},
"allow_existing_subscription": False
}
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({
price_id: '<string>',
success_url: '<string>',
cancel_url: '<string>',
mode: 'subscription',
quantity: 1,
metadata: {},
allow_existing_subscription: false
})
};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session', 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/checkout-session",
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([
'price_id' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'mode' => 'subscription',
'quantity' => 1,
'metadata' => [
],
'allow_existing_subscription' => false
]),
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/checkout-session"
payload := strings.NewReader("{\n \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\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/checkout-session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session")
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 \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"checkout_url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Stripe Checkout
Create Checkout Session
Create a Stripe checkout session for subscription or one-time payment. Returns a URL to redirect the user to Stripe’s hosted checkout page.
POST
/
api
/
v1
/
payments
/
stripe
/
checkout-session
Create Checkout Session
curl --request POST \
--url https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price_id": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"mode": "subscription",
"quantity": 1,
"metadata": {},
"allow_existing_subscription": false
}
'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session"
payload = {
"price_id": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"mode": "subscription",
"quantity": 1,
"metadata": {},
"allow_existing_subscription": False
}
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({
price_id: '<string>',
success_url: '<string>',
cancel_url: '<string>',
mode: 'subscription',
quantity: 1,
metadata: {},
allow_existing_subscription: false
})
};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session', 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/checkout-session",
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([
'price_id' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'mode' => 'subscription',
'quantity' => 1,
'metadata' => [
],
'allow_existing_subscription' => false
]),
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/checkout-session"
payload := strings.NewReader("{\n \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\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/checkout-session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/checkout-session")
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 \"price_id\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"mode\": \"subscription\",\n \"quantity\": 1,\n \"metadata\": {},\n \"allow_existing_subscription\": false\n}"
response = http.request(request)
puts response.read_body{
"session_id": "<string>",
"checkout_url": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Query Parameters
Use test mode credentials
Body
application/json
Request to create a Stripe checkout session.
Minimum string length:
1Minimum string length:
1Minimum string length:
1Pattern:
^(subscription|payment)$Required range:
x >= 1If true, allows checkout even if user has active subscription
⌘I

