Pular para o conteúdo principal
GET
/
v2
/
subscriptions
Get Subscriptions
curl --request GET \
  --url https://api.pagou.ai/v2/subscriptions \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.pagou.ai/v2/subscriptions"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.pagou.ai/v2/subscriptions', 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://api.pagou.ai/v2/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$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://api.pagou.ai/v2/subscriptions"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.pagou.ai/v2/subscriptions")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pagou.ai/v2/subscriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "success": true,
  "requestId": "<string>",
  "data": [
    {
      "id": "<string>",
      "customerId": "<string>",
      "intervalCount": 183,
      "amount": 50000000,
      "trialEnd": "2023-11-07T05:31:56Z",
      "currentPeriodStart": "2023-11-07T05:31:56Z",
      "currentPeriodEnd": "2023-11-07T05:31:56Z",
      "cancelAtPeriodEnd": true,
      "canceledAt": "2023-11-07T05:31:56Z",
      "retryOffsetsDays": [
        15
      ],
      "customerEmail": "<string>",
      "cardLast4": "<string>",
      "metadata": {},
      "products": [
        {
          "name": "<string>",
          "price": 50000000,
          "quantity": 500000,
          "tangible": true,
          "sku": "<string>"
        }
      ],
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "transactions": [
        {
          "id": "<string>",
          "status": "<string>",
          "amount": 50000000,
          "paidAmount": 50000000,
          "refundedAmount": 50000000,
          "externalRef": "<string>",
          "createdAt": "2023-11-07T05:31:56Z",
          "paidAt": "2023-11-07T05:31:56Z"
        }
      ]
    }
  ],
  "next_cursor": "<string>",
  "prev_cursor": "<string>",
  "total": 4503599627370495
}
{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}
{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}
Os metadados de cursor (next_cursor, prev_cursor) são retornados em data.metadata. Use status para filtrar pelo estado do ciclo de vida, customer_email para localizar um assinante específico, e created_after / created_before para reconciliação por intervalo de datas.

Autorizações

Authorization
string
header
obrigatório

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Parâmetros de consulta

cursor
string
limit
number
padrão:20
Intervalo obrigatório: 1 <= x <= 100
direction
enum<string>
padrão:next
Opções disponíveis:
next,
prev
status
enum<string>
Opções disponíveis:
incomplete,
trialing,
active,
past_due,
cancel_scheduled,
canceled
customer_email
string<email>
Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
created_after
string<date-time>

Filter to subscriptions created at or after this ISO 8601 timestamp.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
created_before
string<date-time>

Filter to subscriptions created at or before this ISO 8601 timestamp.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$

Resposta

Success

success
boolean
obrigatório
requestId
string
obrigatório
data
object[]
obrigatório
next_cursor
string | null
obrigatório
prev_cursor
string | null
obrigatório
total
integer
obrigatório
Intervalo obrigatório: 0 <= x <= 9007199254740991