Create hosted checkout link
curl --request POST \
--url https://demo.onlinebillingform.com/api/v2/checkout/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"package_id": 123,
"cycle_id": 123,
"callback_url": "<string>",
"customer_id": 123
}
'import requests
url = "https://demo.onlinebillingform.com/api/v2/checkout/create"
payload = {
"package_id": 123,
"cycle_id": 123,
"callback_url": "<string>",
"customer_id": 123
}
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({package_id: 123, cycle_id: 123, callback_url: '<string>', customer_id: 123})
};
fetch('https://demo.onlinebillingform.com/api/v2/checkout/create', 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://demo.onlinebillingform.com/api/v2/checkout/create",
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([
'package_id' => 123,
'cycle_id' => 123,
'callback_url' => '<string>',
'customer_id' => 123
]),
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://demo.onlinebillingform.com/api/v2/checkout/create"
payload := strings.NewReader("{\n \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\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://demo.onlinebillingform.com/api/v2/checkout/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo.onlinebillingform.com/api/v2/checkout/create")
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 \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Successfully",
"url": "https://demo.onlinebillingform.com/checkout/00000000-0000-0000-0000-000000000000"
}{
"success": false,
"errors": "Invalid API Key"
}{
"success": false,
"errors": "Insufficient permissions for this endpoint."
}{
"success": false,
"errors": {
"customer_id": [
"The customer id field is required."
]
}
}Checkout
Create hosted checkout link
Creates a one-hour hosted checkout URL for an existing BillingServ customer. customer_id is required and must reference a customer account (account_type 2). When the customer opens the returned URL, BillingServ signs them into a checkout-only session, shows a checkout-only page, allows saved payment methods such as Stripe cards, and redirects back to callback_url after payment.
POST
/
checkout
/
create
Create hosted checkout link
curl --request POST \
--url https://demo.onlinebillingform.com/api/v2/checkout/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"package_id": 123,
"cycle_id": 123,
"callback_url": "<string>",
"customer_id": 123
}
'import requests
url = "https://demo.onlinebillingform.com/api/v2/checkout/create"
payload = {
"package_id": 123,
"cycle_id": 123,
"callback_url": "<string>",
"customer_id": 123
}
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({package_id: 123, cycle_id: 123, callback_url: '<string>', customer_id: 123})
};
fetch('https://demo.onlinebillingform.com/api/v2/checkout/create', 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://demo.onlinebillingform.com/api/v2/checkout/create",
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([
'package_id' => 123,
'cycle_id' => 123,
'callback_url' => '<string>',
'customer_id' => 123
]),
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://demo.onlinebillingform.com/api/v2/checkout/create"
payload := strings.NewReader("{\n \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\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://demo.onlinebillingform.com/api/v2/checkout/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo.onlinebillingform.com/api/v2/checkout/create")
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 \"package_id\": 123,\n \"cycle_id\": 123,\n \"callback_url\": \"<string>\",\n \"customer_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Successfully",
"url": "https://demo.onlinebillingform.com/checkout/00000000-0000-0000-0000-000000000000"
}{
"success": false,
"errors": "Invalid API Key"
}{
"success": false,
"errors": "Insufficient permissions for this endpoint."
}{
"success": false,
"errors": {
"customer_id": [
"The customer id field is required."
]
}
}Authorizations
Use Authorization: Bearer <live_api_key>.
Body
application/jsonapplication/x-www-form-urlencoded
Package/order group package ID to add to checkout.
Billing cycle ID for the selected package.
URL BillingServ redirects to after hosted checkout succeeds or fails.
Existing BillingServ customer user ID. Required; the user must have account_type 2.
Response
OK
⌘I