cURL
curl --request POST \
--url https://api.recoupable.dev/api/subscriptions/claim \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"session_id": "cs_live_a1b2c3d4e5f6g7h8i9j0"
}
'import requests
url = "https://api.recoupable.dev/api/subscriptions/claim"
payload = { "session_id": "cs_live_a1b2c3d4e5f6g7h8i9j0" }
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({session_id: 'cs_live_a1b2c3d4e5f6g7h8i9j0'})
};
fetch('https://api.recoupable.dev/api/subscriptions/claim', 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.recoupable.dev/api/subscriptions/claim",
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([
'session_id' => 'cs_live_a1b2c3d4e5f6g7h8i9j0'
]),
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://api.recoupable.dev/api/subscriptions/claim"
payload := strings.NewReader("{\n \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\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://api.recoupable.dev/api/subscriptions/claim")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/subscriptions/claim")
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 \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"subscription_id": "sub_1Rz0abc123",
"plan": "pro"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "session_not_found"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "already_claimed"
}Billing
Claim Subscription
Attach a subscription bought through Create Subscription Session (anonymous path) to the authenticated account. Needed only when the signed-in email differs from the email typed into Stripe Checkout; when they match, the webhook already linked the subscription and this call is a no-op that returns 200.
POST
/
api
/
subscriptions
/
claim
cURL
curl --request POST \
--url https://api.recoupable.dev/api/subscriptions/claim \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"session_id": "cs_live_a1b2c3d4e5f6g7h8i9j0"
}
'import requests
url = "https://api.recoupable.dev/api/subscriptions/claim"
payload = { "session_id": "cs_live_a1b2c3d4e5f6g7h8i9j0" }
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({session_id: 'cs_live_a1b2c3d4e5f6g7h8i9j0'})
};
fetch('https://api.recoupable.dev/api/subscriptions/claim', 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.recoupable.dev/api/subscriptions/claim",
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([
'session_id' => 'cs_live_a1b2c3d4e5f6g7h8i9j0'
]),
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://api.recoupable.dev/api/subscriptions/claim"
payload := strings.NewReader("{\n \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\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://api.recoupable.dev/api/subscriptions/claim")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/subscriptions/claim")
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 \"session_id\": \"cs_live_a1b2c3d4e5f6g7h8i9j0\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"subscription_id": "sub_1Rz0abc123",
"plan": "pro"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "session_not_found"
}{
"status": "error",
"error": "already_claimed"
}{
"status": "error",
"error": "already_claimed"
}Authorizations
apiKeyAuthbearerAuth
Your Recoup API key. Learn more.
Body
application/json
The Checkout session to claim
The Stripe Checkout session id from the session_id query parameter on the success URL.
Example:
"cs_live_a1b2c3d4e5f6g7h8i9j0"
Response
Subscription attached to the authenticated account (or already was)
Available options:
success The Stripe subscription now attached to the authenticated account.
Example:
"sub_1Rz0abc123"
The plan the subscription is on, resolved from its Stripe price.
Available options:
starter, pro Example:
"pro"
Was this page helpful?
