Create Checkout Session
curl --request POST \
--url https://api.entityml.com/api/v1/subscriptions/checkout \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "<string>",
"email": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"tier": "<string>"
}
'import requests
url = "https://api.entityml.com/api/v1/subscriptions/checkout"
payload = {
"user_id": "<string>",
"email": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"tier": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: '<string>',
email: '<string>',
success_url: '<string>',
cancel_url: '<string>',
tier: '<string>'
})
};
fetch('https://api.entityml.com/api/v1/subscriptions/checkout', 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.entityml.com/api/v1/subscriptions/checkout",
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([
'user_id' => '<string>',
'email' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'tier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.entityml.com/api/v1/subscriptions/checkout"
payload := strings.NewReader("{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.entityml.com/api/v1/subscriptions/checkout")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.entityml.com/api/v1/subscriptions/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checkout_url": "<string>"
}Billing and Usage
Create Checkout Session
Create a Stripe Checkout session for a subscription.
POST
/
api
/
v1
/
subscriptions
/
checkout
Create Checkout Session
curl --request POST \
--url https://api.entityml.com/api/v1/subscriptions/checkout \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "<string>",
"email": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"tier": "<string>"
}
'import requests
url = "https://api.entityml.com/api/v1/subscriptions/checkout"
payload = {
"user_id": "<string>",
"email": "<string>",
"success_url": "<string>",
"cancel_url": "<string>",
"tier": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: '<string>',
email: '<string>',
success_url: '<string>',
cancel_url: '<string>',
tier: '<string>'
})
};
fetch('https://api.entityml.com/api/v1/subscriptions/checkout', 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.entityml.com/api/v1/subscriptions/checkout",
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([
'user_id' => '<string>',
'email' => '<string>',
'success_url' => '<string>',
'cancel_url' => '<string>',
'tier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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.entityml.com/api/v1/subscriptions/checkout"
payload := strings.NewReader("{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.entityml.com/api/v1/subscriptions/checkout")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.entityml.com/api/v1/subscriptions/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"<string>\",\n \"email\": \"<string>\",\n \"success_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"tier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"checkout_url": "<string>"
}Request
string
required
User ID that will own the subscription.
string
required
Customer email address.
string
required
URL Stripe should redirect to after successful checkout.
string
required
URL Stripe should redirect to after cancellation.
string
Subscription tier. Valid values:
starter or pro. Default: starter.Response
string
Stripe-hosted checkout URL.
Example
from entityml import EntityMLClient
client = EntityMLClient()
session = client.billing.create_checkout_session(
user_id="YOUR_USER_ID",
email="you@example.com",
success_url="https://entityml.com/dashboard?checkout=success",
cancel_url="https://entityml.com/subscribe",
tier="pro",
)
print(session["checkout_url"])
entityml billing checkout \
--user-id YOUR_USER_ID \
--email you@example.com \
--success-url https://entityml.com/dashboard?checkout=success \
--cancel-url https://entityml.com/subscribe \
--tier pro
curl -X POST "https://api.entityml.com/api/v1/subscriptions/checkout" \
-H "Content-Type: application/json" \
-d '{
"user_id": "YOUR_USER_ID",
"email": "you@example.com",
"success_url": "https://entityml.com/dashboard?checkout=success",
"cancel_url": "https://entityml.com/subscribe",
"tier": "pro"
}'
Example response
{
"checkout_url": "https://checkout.stripe.com/c/pay/cs_test_..."
}
⌘I