Python SDK
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Basic checkout URL generation
checkout_url = client.checkout.url({
"offering_key": "your_offering_key"
})
# With optional billing interval
checkout_url = client.checkout.url({
"offering_key": "your_offering_key",
"billing_interval": "monthly"
})
# With customer key for pre-filled checkout
checkout_url = client.checkout.url({
"offering_key": "your_offering_key",
"billing_interval": "monthly",
"customer_key": "customer_123"
})
# Using type-safe CheckoutConfig
from metrifox_sdk import CheckoutConfig
checkout_config = CheckoutConfig(
offering_key="your_offering_key",
billing_interval="monthly",
customer_key="customer_123"
)
checkout_url = client.checkout.url(checkout_config)import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Basic checkout URL generation
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key"
});
// With optional billing interval
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key",
billingInterval: "monthly"
});
// With customer key for pre-filled checkout
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key",
billingInterval: "monthly",
customerKey: "customer_123"
});
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Basic checkout URL generation
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key"
})
# With optional billing interval
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key",
billing_interval: "monthly"
})
# With customer key for pre-filled checkout
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key",
billing_interval: "monthly",
customer_key: "customer_123"
})
# Using structured config object
checkout_config = MetrifoxSDK::Types::CheckoutConfig.new(
offering_key: "your_offering_key",
billing_interval: "monthly",
customer_key: "customer_123"
)
checkout_url = METRIFOX_SDK.checkout.url(checkout_config)
curl -X GET "https://api.metrifox.com/api/v1/products/offerings/generate-checkout-url?offering_key=your_offering_key&billing_interval=monthly&customer_key=customer_123" \
-H "x-api-key: your-api-key"
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/products/offerings/generate-checkout-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/api/v1/products/offerings/generate-checkout-url"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{defaultHost}/api/v1/products/offerings/generate-checkout-url")
.header("x-api-key", "<api-key>")
.asString();{
"statusCode": 200,
"message": "",
"data": {
"checkout_url": "https://app.metrifox.com/your-organization/checkout/premium_plan_monthly"
}
}{
"statusCode": 400,
"message": "Bad request",
"data": {},
"meta": {},
"errors": {}
}{
"statusCode": 401,
"message": "Unauthorized",
"data": {},
"meta": {},
"errors": {}
}{
"statusCode": 404,
"message": "Not found",
"data": {},
"meta": {},
"errors": {}
}Checkout
Generate Checkout URL
Generate secure checkout URLs for customer subscription purchases
GET
/
api
/
v1
/
products
/
offerings
/
generate-checkout-url
Python SDK
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
# Basic checkout URL generation
checkout_url = client.checkout.url({
"offering_key": "your_offering_key"
})
# With optional billing interval
checkout_url = client.checkout.url({
"offering_key": "your_offering_key",
"billing_interval": "monthly"
})
# With customer key for pre-filled checkout
checkout_url = client.checkout.url({
"offering_key": "your_offering_key",
"billing_interval": "monthly",
"customer_key": "customer_123"
})
# Using type-safe CheckoutConfig
from metrifox_sdk import CheckoutConfig
checkout_config = CheckoutConfig(
offering_key="your_offering_key",
billing_interval="monthly",
customer_key="customer_123"
)
checkout_url = client.checkout.url(checkout_config)import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
// Basic checkout URL generation
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key"
});
// With optional billing interval
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key",
billingInterval: "monthly"
});
// With customer key for pre-filled checkout
const checkoutUrl = await metrifoxClient.checkout.url({
offeringKey: "your_offering_key",
billingInterval: "monthly",
customerKey: "customer_123"
});
require 'metrifox-sdk'
# Initialize with configuration
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
# Basic checkout URL generation
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key"
})
# With optional billing interval
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key",
billing_interval: "monthly"
})
# With customer key for pre-filled checkout
checkout_url = METRIFOX_SDK.checkout.url({
offering_key: "your_offering_key",
billing_interval: "monthly",
customer_key: "customer_123"
})
# Using structured config object
checkout_config = MetrifoxSDK::Types::CheckoutConfig.new(
offering_key: "your_offering_key",
billing_interval: "monthly",
customer_key: "customer_123"
)
checkout_url = METRIFOX_SDK.checkout.url(checkout_config)
curl -X GET "https://api.metrifox.com/api/v1/products/offerings/generate-checkout-url?offering_key=your_offering_key&billing_interval=monthly&customer_key=customer_123" \
-H "x-api-key: your-api-key"
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/products/offerings/generate-checkout-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://{defaultHost}/api/v1/products/offerings/generate-checkout-url"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{defaultHost}/api/v1/products/offerings/generate-checkout-url")
.header("x-api-key", "<api-key>")
.asString();{
"statusCode": 200,
"message": "",
"data": {
"checkout_url": "https://app.metrifox.com/your-organization/checkout/premium_plan_monthly"
}
}{
"statusCode": 400,
"message": "Bad request",
"data": {},
"meta": {},
"errors": {}
}{
"statusCode": 401,
"message": "Unauthorized",
"data": {},
"meta": {},
"errors": {}
}{
"statusCode": 404,
"message": "Not found",
"data": {},
"meta": {},
"errors": {}
}Authorizations
Query Parameters
The unique identifier for the offering/product
Optional billing interval for the subscription
Available options:
monthly, yearly, quarterly Optional customer key to pre-fill checkout information
⌘I

