Skip to content

Informações do Plano

Consultar Plano

Consulta a API e retorna informações sobre o plano contratado

GET /v1/plan
$ curl -i "https://api.gocache.com.br/v1/plan" \
-H 'GoCache-Token:seu_token'
<?php


$ch = curl_init("https://api.gocache.com.br/v1/plan");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array("GoCache-Token: seu_token"));

$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);
?>

Exemplo de Sucesso:

HTTP/1.1 200 OK
{
  "result": {
    "plan": {
      "billing": {
        "previous": {
          "start": "2020-12-26",
          "end": "2021-01-25"
        },
        "next": {
          "start": "2021-02-24",
          "end": "2021-03-25"
        },
        "due_date": "2021-01-26",
        "current": {
          "start": "2021-01-26",
          "end": "2021-02-23"
        }
      }
    }
  },
     "status_code": 200
}
<?php

if( $statusCode == 200 ) {

    echo("Sucesso!\n");

    $obj = json_decode($response);

    echo("Fim do proximo ciclo: " . $obj->result->plan->billing->current->end );

}
?>