Skip to main content
GET
/
api
/
v1
/
customers
/
{customer_key}
/
check-active-subscription
Javascript SDK
import { init } from "metrifox-js";

const metrifoxClient = init({
  apiKey: process.env.METRIFOX_API_KEY
});

// Check if customer has an active subscription
const hasActiveSubscription = await metrifoxClient.customers.checkActiveSubscription("test-customer-key");

console.log(hasActiveSubscription); // true or false

if (hasActiveSubscription) {
  console.log("Customer has an active subscription");
} else {
  console.log("Customer does not have an active subscription");
}
{
"statusCode": 200,
"message": "",
"data": {
"has_active_subscription": true
}
}

Authorizations

x-api-key
string
header
required

Path Parameters

customer_key
string
required

The unique identifier for the customer

Response

Active subscription status checked successfully

statusCode
integer
Example:

200

message
string
Example:

""

data
object