Subscribe to product plan
curl --request POST \
--url 'https://api.vida.dev/api/v2/product/subscribe?token=' \
--header 'Content-Type: application/json' \
--data '
{
"productPlanId": "pplan-vida-business-basic",
"term": "month",
"cancelUrl": "https://yoursite.io/cancel",
"successUrl": "https://yoursite.io/success",
"checkoutType": "embedded"
}
'import requests
url = "https://api.vida.dev/api/v2/product/subscribe?token="
payload = {
"productPlanId": "pplan-vida-business-basic",
"term": "month",
"cancelUrl": "https://yoursite.io/cancel",
"successUrl": "https://yoursite.io/success",
"checkoutType": "embedded"
}
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({
productPlanId: 'pplan-vida-business-basic',
term: 'month',
cancelUrl: 'https://yoursite.io/cancel',
successUrl: 'https://yoursite.io/success',
checkoutType: 'embedded'
})
};
fetch('https://api.vida.dev/api/v2/product/subscribe?token=', 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.vida.dev/api/v2/product/subscribe?token=",
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([
'productPlanId' => 'pplan-vida-business-basic',
'term' => 'month',
'cancelUrl' => 'https://yoursite.io/cancel',
'successUrl' => 'https://yoursite.io/success',
'checkoutType' => 'embedded'
]),
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.vida.dev/api/v2/product/subscribe?token="
payload := strings.NewReader("{\n \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\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.vida.dev/api/v2/product/subscribe?token=")
.header("Content-Type", "application/json")
.body("{\n \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vida.dev/api/v2/product/subscribe?token=")
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 \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Success"
}Billing
Subscribe to product plan
Subscribe to a product plan
POST
/
api
/
v2
/
product
/
subscribe
Subscribe to product plan
curl --request POST \
--url 'https://api.vida.dev/api/v2/product/subscribe?token=' \
--header 'Content-Type: application/json' \
--data '
{
"productPlanId": "pplan-vida-business-basic",
"term": "month",
"cancelUrl": "https://yoursite.io/cancel",
"successUrl": "https://yoursite.io/success",
"checkoutType": "embedded"
}
'import requests
url = "https://api.vida.dev/api/v2/product/subscribe?token="
payload = {
"productPlanId": "pplan-vida-business-basic",
"term": "month",
"cancelUrl": "https://yoursite.io/cancel",
"successUrl": "https://yoursite.io/success",
"checkoutType": "embedded"
}
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({
productPlanId: 'pplan-vida-business-basic',
term: 'month',
cancelUrl: 'https://yoursite.io/cancel',
successUrl: 'https://yoursite.io/success',
checkoutType: 'embedded'
})
};
fetch('https://api.vida.dev/api/v2/product/subscribe?token=', 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.vida.dev/api/v2/product/subscribe?token=",
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([
'productPlanId' => 'pplan-vida-business-basic',
'term' => 'month',
'cancelUrl' => 'https://yoursite.io/cancel',
'successUrl' => 'https://yoursite.io/success',
'checkoutType' => 'embedded'
]),
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.vida.dev/api/v2/product/subscribe?token="
payload := strings.NewReader("{\n \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\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.vida.dev/api/v2/product/subscribe?token=")
.header("Content-Type", "application/json")
.body("{\n \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vida.dev/api/v2/product/subscribe?token=")
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 \"productPlanId\": \"pplan-vida-business-basic\",\n \"term\": \"month\",\n \"cancelUrl\": \"https://yoursite.io/cancel\",\n \"successUrl\": \"https://yoursite.io/success\",\n \"checkoutType\": \"embedded\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Success"
}Authorizations
Vida API Token
Body
application/json
Product Plan Id to enable subscription
Example:
"pplan-vida-business-basic"
Subscription length of month or year
Example:
"month"
If using external payment processor (eg Stripe) what url to redirect if payment canceled
Example:
"https://yoursite.io/cancel"
If using external payment processor (eg Stripe) what url to redirect if payment successful
Example:
"https://yoursite.io/success"
Which checkout session you would like to start. Embedded session or external redirect url
Example:
"embedded"
⌘I