curl --request POST \
--url https://us.api.flexprice.io/v1/checkout/sessions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"action": "create_subscription",
"customer_external_id": "<string>",
"payment_provider": "razorpay",
"cancel_url": "<string>",
"configuration": {
"create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
},
"failure_url": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"success_url": "<string>"
}
'import requests
url = "https://us.api.flexprice.io/v1/checkout/sessions"
payload = {
"action": "create_subscription",
"customer_external_id": "<string>",
"payment_provider": "razorpay",
"cancel_url": "<string>",
"configuration": { "create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
} },
"failure_url": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"success_url": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'create_subscription',
customer_external_id: '<string>',
payment_provider: 'razorpay',
cancel_url: '<string>',
configuration: {
create_subscription_params: {
currency: '<string>',
end_date: '2023-11-07T05:31:56Z',
lookup_key: '<string>',
metadata: {},
plan_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
},
failure_url: '<string>',
idempotency_key: '<string>',
metadata: {},
success_url: '<string>'
})
};
fetch('https://us.api.flexprice.io/v1/checkout/sessions', 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://us.api.flexprice.io/v1/checkout/sessions",
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([
'action' => 'create_subscription',
'customer_external_id' => '<string>',
'payment_provider' => 'razorpay',
'cancel_url' => '<string>',
'configuration' => [
'create_subscription_params' => [
'currency' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'lookup_key' => '<string>',
'metadata' => [
],
'plan_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
],
'failure_url' => '<string>',
'idempotency_key' => '<string>',
'metadata' => [
],
'success_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://us.api.flexprice.io/v1/checkout/sessions"
payload := strings.NewReader("{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://us.api.flexprice.io/v1/checkout/sessions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/checkout/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"action": "create_subscription",
"cancel_url": "<string>",
"cancelled_at": "2023-11-07T05:31:56Z",
"checkout_invoice_id": "<string>",
"checkout_payment_id": "<string>",
"completed_at": "2023-11-07T05:31:56Z",
"configuration": {
"create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"customer_id": "<string>",
"environment_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"failure_reason": "<string>",
"failure_url": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"payment_action": {
"url": "<string>"
},
"payment_provider": "razorpay",
"provider_result": {
"expires_at": "2023-11-07T05:31:56Z",
"next_action": {
"url": "<string>"
},
"provider_metadata": {},
"provider_payment_intent_id": "<string>",
"provider_session_id": "<string>"
},
"result": {
"create_subscription_result": {
"invoice_id": "<string>",
"payment_id": "<string>",
"subscription_id": "<string>"
}
},
"success_url": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Create checkout session
curl --request POST \
--url https://us.api.flexprice.io/v1/checkout/sessions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"action": "create_subscription",
"customer_external_id": "<string>",
"payment_provider": "razorpay",
"cancel_url": "<string>",
"configuration": {
"create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
},
"failure_url": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"success_url": "<string>"
}
'import requests
url = "https://us.api.flexprice.io/v1/checkout/sessions"
payload = {
"action": "create_subscription",
"customer_external_id": "<string>",
"payment_provider": "razorpay",
"cancel_url": "<string>",
"configuration": { "create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
} },
"failure_url": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"success_url": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
action: 'create_subscription',
customer_external_id: '<string>',
payment_provider: 'razorpay',
cancel_url: '<string>',
configuration: {
create_subscription_params: {
currency: '<string>',
end_date: '2023-11-07T05:31:56Z',
lookup_key: '<string>',
metadata: {},
plan_id: '<string>',
start_date: '2023-11-07T05:31:56Z'
}
},
failure_url: '<string>',
idempotency_key: '<string>',
metadata: {},
success_url: '<string>'
})
};
fetch('https://us.api.flexprice.io/v1/checkout/sessions', 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://us.api.flexprice.io/v1/checkout/sessions",
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([
'action' => 'create_subscription',
'customer_external_id' => '<string>',
'payment_provider' => 'razorpay',
'cancel_url' => '<string>',
'configuration' => [
'create_subscription_params' => [
'currency' => '<string>',
'end_date' => '2023-11-07T05:31:56Z',
'lookup_key' => '<string>',
'metadata' => [
],
'plan_id' => '<string>',
'start_date' => '2023-11-07T05:31:56Z'
]
],
'failure_url' => '<string>',
'idempotency_key' => '<string>',
'metadata' => [
],
'success_url' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://us.api.flexprice.io/v1/checkout/sessions"
payload := strings.NewReader("{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://us.api.flexprice.io/v1/checkout/sessions")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/checkout/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"create_subscription\",\n \"customer_external_id\": \"<string>\",\n \"payment_provider\": \"razorpay\",\n \"cancel_url\": \"<string>\",\n \"configuration\": {\n \"create_subscription_params\": {\n \"currency\": \"<string>\",\n \"end_date\": \"2023-11-07T05:31:56Z\",\n \"lookup_key\": \"<string>\",\n \"metadata\": {},\n \"plan_id\": \"<string>\",\n \"start_date\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"failure_url\": \"<string>\",\n \"idempotency_key\": \"<string>\",\n \"metadata\": {},\n \"success_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"action": "create_subscription",
"cancel_url": "<string>",
"cancelled_at": "2023-11-07T05:31:56Z",
"checkout_invoice_id": "<string>",
"checkout_payment_id": "<string>",
"completed_at": "2023-11-07T05:31:56Z",
"configuration": {
"create_subscription_params": {
"currency": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"lookup_key": "<string>",
"metadata": {},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z"
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"customer_id": "<string>",
"environment_id": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"failure_reason": "<string>",
"failure_url": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"metadata": {},
"payment_action": {
"url": "<string>"
},
"payment_provider": "razorpay",
"provider_result": {
"expires_at": "2023-11-07T05:31:56Z",
"next_action": {
"url": "<string>"
},
"provider_metadata": {},
"provider_payment_intent_id": "<string>",
"provider_session_id": "<string>"
},
"result": {
"create_subscription_result": {
"invoice_id": "<string>",
"payment_id": "<string>",
"subscription_id": "<string>"
}
},
"success_url": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Checkout session to create
create_subscription razorpay Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Created
create_subscription CheckoutInvoiceID and CheckoutPaymentID are set once the apply step creates the corresponding Flexprice entities (completed sessions only).
initiated, pending, completed, failed, expired Show child attributes
Show child attributes
ExpiresAt is required. A Temporal timer fires at this time for any session still in initiated|pending, marking it expired. The caller must create a new session after expiry (expire-and-restart model).
FailureReason is a human-readable string set on failed sessions.
IdempotencyKey is caller-supplied. It is unique only while the session is active (initiated|pending). The same key may be reused once the session reaches a terminal state (completed|failed|expired).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
razorpay Show child attributes
Show child attributes
Show child attributes
Show child attributes
published, deleted, archived Redirect URLs sent to the payment provider. The provider redirects the user browser to the appropriate URL after the payment flow completes.

