Assinaturas
Consultar assinatura
Recupere uma assinatura pelo identificador, incluindo suas transações cobradas.
GET
/
v2
/
subscriptions
/
{id}
Get Subscriptions By ID
curl --request GET \
--url https://api.pagou.ai/v2/subscriptions/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pagou.ai/v2/subscriptions/{id}"
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/{id}', 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/{id}",
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/{id}"
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/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pagou.ai/v2/subscriptions/{id}")
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"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"status": 404
}{
"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>"
}O parâmetro de rota
id é o identificador público da assinatura retornado na criação. A resposta inclui um array transactions com todas as transações cobradas sob a assinatura, ordenadas por createdAt decrescente.Autorizações
BearerAuthApiKeyAuthBasicAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Parâmetros de caminho
Public subscription id (UUID).
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$⌘I
Get Subscriptions By ID
curl --request GET \
--url https://api.pagou.ai/v2/subscriptions/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pagou.ai/v2/subscriptions/{id}"
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/{id}', 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/{id}",
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/{id}"
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/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pagou.ai/v2/subscriptions/{id}")
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"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"status": 404
}{
"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>"
}
