Update payment card
curl --request PATCH \
--url http://localhost:7701/api/v1/subscriptions/{uuid}/card \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--data '
{
"card_token": "card_tok_new_xyz",
"card": {
"holder": "JOAO SILVA",
"number": "4111111111111111",
"cvv": "123",
"expiration_month": "12",
"expiration_year": "2028",
"holder_document": "12345678901",
"holder_birthdate": "1990-01-15",
"holder_phone": "11987654321"
}
}
'import requests
url = "http://localhost:7701/api/v1/subscriptions/{uuid}/card"
payload = {
"card_token": "card_tok_new_xyz",
"card": {
"holder": "JOAO SILVA",
"number": "4111111111111111",
"cvv": "123",
"expiration_month": "12",
"expiration_year": "2028",
"holder_document": "12345678901",
"holder_birthdate": "1990-01-15",
"holder_phone": "11987654321"
}
}
headers = {
"x-client-id": "<x-client-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'x-client-id': '<x-client-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
card_token: 'card_tok_new_xyz',
card: {
holder: 'JOAO SILVA',
number: '4111111111111111',
cvv: '123',
expiration_month: '12',
expiration_year: '2028',
holder_document: '12345678901',
holder_birthdate: '1990-01-15',
holder_phone: '11987654321'
}
})
};
fetch('http://localhost:7701/api/v1/subscriptions/{uuid}/card', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/subscriptions/{uuid}/card",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'card_token' => 'card_tok_new_xyz',
'card' => [
'holder' => 'JOAO SILVA',
'number' => '4111111111111111',
'cvv' => '123',
'expiration_month' => '12',
'expiration_year' => '2028',
'holder_document' => '12345678901',
'holder_birthdate' => '1990-01-15',
'holder_phone' => '11987654321'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-client-id: <x-client-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:7701/api/v1/subscriptions/{uuid}/card"
payload := strings.NewReader("{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-client-id", "<x-client-id>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:7701/api/v1/subscriptions/{uuid}/card")
.header("x-client-id", "<x-client-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/subscriptions/{uuid}/card")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["x-client-id"] = '<x-client-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Basic Monthly",
"description": "<string>",
"amount": 2990,
"currency": "BRL",
"interval": "monthly",
"interval_count": 1,
"trial_period_days": 7,
"billing_day": 5,
"min_card_months": 3,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"customer": {},
"card": {
"last_4_digits": "4242",
"brand": "visa",
"expire_month": "12",
"expire_year": "2028"
},
"coupon": {},
"amount": 2990,
"original_amount": 2990,
"discount_amount": 500,
"currency": "BRL",
"interval": "monthly",
"interval_count": 1,
"billing_day": 5,
"trial": {
"period_days": 7,
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"current_period": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"next_billing_at": "2023-11-07T05:31:56Z",
"paused_at": "2023-11-07T05:31:56Z",
"paused_until": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": false,
"plan_change_at": "2023-11-07T05:31:56Z",
"new_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Subscriptions
Update payment card
Replaces the stored card used for future billing cycles on this subscription. Provide either card_token (existing vault token) OR a card object with raw card data — never both. PAST_DUE subscriptions trigger an immediate retry of the last failed cycle.
PATCH
/
api
/
v1
/
subscriptions
/
{uuid}
/
card
Update payment card
curl --request PATCH \
--url http://localhost:7701/api/v1/subscriptions/{uuid}/card \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--header 'x-client-id: <x-client-id>' \
--data '
{
"card_token": "card_tok_new_xyz",
"card": {
"holder": "JOAO SILVA",
"number": "4111111111111111",
"cvv": "123",
"expiration_month": "12",
"expiration_year": "2028",
"holder_document": "12345678901",
"holder_birthdate": "1990-01-15",
"holder_phone": "11987654321"
}
}
'import requests
url = "http://localhost:7701/api/v1/subscriptions/{uuid}/card"
payload = {
"card_token": "card_tok_new_xyz",
"card": {
"holder": "JOAO SILVA",
"number": "4111111111111111",
"cvv": "123",
"expiration_month": "12",
"expiration_year": "2028",
"holder_document": "12345678901",
"holder_birthdate": "1990-01-15",
"holder_phone": "11987654321"
}
}
headers = {
"x-client-id": "<x-client-id>",
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'x-client-id': '<x-client-id>',
'X-API-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
card_token: 'card_tok_new_xyz',
card: {
holder: 'JOAO SILVA',
number: '4111111111111111',
cvv: '123',
expiration_month: '12',
expiration_year: '2028',
holder_document: '12345678901',
holder_birthdate: '1990-01-15',
holder_phone: '11987654321'
}
})
};
fetch('http://localhost:7701/api/v1/subscriptions/{uuid}/card', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "7701",
CURLOPT_URL => "http://localhost:7701/api/v1/subscriptions/{uuid}/card",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'card_token' => 'card_tok_new_xyz',
'card' => [
'holder' => 'JOAO SILVA',
'number' => '4111111111111111',
'cvv' => '123',
'expiration_month' => '12',
'expiration_year' => '2028',
'holder_document' => '12345678901',
'holder_birthdate' => '1990-01-15',
'holder_phone' => '11987654321'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>",
"x-client-id: <x-client-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:7701/api/v1/subscriptions/{uuid}/card"
payload := strings.NewReader("{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-client-id", "<x-client-id>")
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:7701/api/v1/subscriptions/{uuid}/card")
.header("x-client-id", "<x-client-id>")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:7701/api/v1/subscriptions/{uuid}/card")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["x-client-id"] = '<x-client-id>'
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card_token\": \"card_tok_new_xyz\",\n \"card\": {\n \"holder\": \"JOAO SILVA\",\n \"number\": \"4111111111111111\",\n \"cvv\": \"123\",\n \"expiration_month\": \"12\",\n \"expiration_year\": \"2028\",\n \"holder_document\": \"12345678901\",\n \"holder_birthdate\": \"1990-01-15\",\n \"holder_phone\": \"11987654321\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "active",
"plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Basic Monthly",
"description": "<string>",
"amount": 2990,
"currency": "BRL",
"interval": "monthly",
"interval_count": 1,
"trial_period_days": 7,
"billing_day": 5,
"min_card_months": 3,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"customer": {},
"card": {
"last_4_digits": "4242",
"brand": "visa",
"expire_month": "12",
"expire_year": "2028"
},
"coupon": {},
"amount": 2990,
"original_amount": 2990,
"discount_amount": 500,
"currency": "BRL",
"interval": "monthly",
"interval_count": 1,
"billing_day": 5,
"trial": {
"period_days": 7,
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"current_period": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"next_billing_at": "2023-11-07T05:31:56Z",
"paused_at": "2023-11-07T05:31:56Z",
"paused_until": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": false,
"plan_change_at": "2023-11-07T05:31:56Z",
"new_plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metadata": [
{}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Company API key. Send in the X-API-Key header.
Headers
Client identifier for the company in the request.
Example:
"client_abc123"
Path Parameters
Body
application/json
Response
Card updated
Show child attributes
Show child attributes