const { result, error } = await unprice.customers.getActivePhase("cus_1234567890");

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}

console.log(result);
{
  "phase": {
    "id": "phase_1234567890",
    "startDate": 1678900000,
    "endDate": 1681492000,
    "planVersionId": "pv_1234567890",
    "status": "active"
  }
}
const { result, error } = await unprice.customers.getActivePhase("cus_1234567890");

if (error) {
  // handle potential network or bad request error
  // a link to our docs will be in the `error.docs` field
  console.error(error.message);
  return;
}

console.log(result);
{
  "phase": {
    "id": "phase_1234567890",
    "startDate": 1678900000,
    "endDate": 1681492000,
    "planVersionId": "pv_1234567890",
    "status": "active"
  }
}

Request

customerId
string
required

The ID of the customer to get active phase for

Response

phase
object
required

The active phase information

phase.id
string
required

The ID of the phase

phase.startDate
number
required

The start timestamp of the phase

phase.endDate
number
required

The end timestamp of the phase

phase.planVersionId
string
required

The ID of the plan version for this phase

phase.status
string
required

The status of the phase (active, upcoming, etc.)