Atualizar método de pagamento
curl --request POST \
--url https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"payment_methods": {
"number": "4111111111111111",
"holder_name": "JOAO DA SILVA",
"security_code": "123",
"expiration_month": 12,
"expiration_year": 2030,
"type": "credit_card",
"main_payment_method": true
}
}
'import requests
url = "https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method"
payload = { "payment_methods": {
"number": "4111111111111111",
"holder_name": "JOAO DA SILVA",
"security_code": "123",
"expiration_month": 12,
"expiration_year": 2030,
"type": "credit_card",
"main_payment_method": True
} }
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payment_methods: {
number: '4111111111111111',
holder_name: 'JOAO DA SILVA',
security_code: '123',
expiration_month: 12,
expiration_year: 2030,
type: 'credit_card',
main_payment_method: true
}
})
};
fetch('https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method', 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.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payment_methods' => [
'number' => '4111111111111111',
'holder_name' => 'JOAO DA SILVA',
'security_code' => '123',
'expiration_month' => 12,
'expiration_year' => 2030,
'type' => 'credit_card',
'main_payment_method' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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 := "https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method"
payload := strings.NewReader("{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<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.post("https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method": {
"type": "card",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_four": "1111",
"first_six": "411111"
}
}Assinaturas
Atualizar método de pagamento
Atualiza o método de pagamento de uma assinatura.
POST
/
v1
/
subscriptions
/
{subscriptionId}
/
payment-method
Atualizar método de pagamento
curl --request POST \
--url https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"payment_methods": {
"number": "4111111111111111",
"holder_name": "JOAO DA SILVA",
"security_code": "123",
"expiration_month": 12,
"expiration_year": 2030,
"type": "credit_card",
"main_payment_method": true
}
}
'import requests
url = "https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method"
payload = { "payment_methods": {
"number": "4111111111111111",
"holder_name": "JOAO DA SILVA",
"security_code": "123",
"expiration_month": 12,
"expiration_year": 2030,
"type": "credit_card",
"main_payment_method": True
} }
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payment_methods: {
number: '4111111111111111',
holder_name: 'JOAO DA SILVA',
security_code: '123',
expiration_month: 12,
expiration_year: 2030,
type: 'credit_card',
main_payment_method: true
}
})
};
fetch('https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method', 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.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payment_methods' => [
'number' => '4111111111111111',
'holder_name' => 'JOAO DA SILVA',
'security_code' => '123',
'expiration_month' => 12,
'expiration_year' => 2030,
'type' => 'credit_card',
'main_payment_method' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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 := "https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method"
payload := strings.NewReader("{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<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.post("https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uvvipay.com.br/v1/subscriptions/{subscriptionId}/payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payment_methods\": {\n \"number\": \"4111111111111111\",\n \"holder_name\": \"JOAO DA SILVA\",\n \"security_code\": \"123\",\n \"expiration_month\": 12,\n \"expiration_year\": 2030,\n \"type\": \"credit_card\",\n \"main_payment_method\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"subscription_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"payment_method": {
"type": "card",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_four": "1111",
"first_six": "411111"
}
}Troca o método de pagamento padrão da assinatura. Use quando o cliente muda o cartão ou passa a pagar com PIX.
Funciona em
TRIAL, PENDING, ACTIVE ou PAST_DUE.
Envie payment_methods com type: credit_card ou type: pix. Em PIX, não envie dados de cartão. pix_type aceita immediate (padrão) ou automatic.
Se a assinatura estiver PAST_DUE e existir fatura open:
- Cartão: inicia uma nova cobrança dessa fatura. A fatura continua
open. A assinatura continuaPAST_DUE. pix_type: immediate: inicia uma nova cobrança dessa fatura. A resposta trazpix.qrcodecomonull. A fatura continuaopen. A assinatura continuaPAST_DUE.pix_type: automatic: cria o Pix Automático e devolvepix.qrcode. A fatura continuaopen. A assinatura continuaPAST_DUE.
400 (payload inválido), 401/403 (credenciais ou produto Recorrência), 404 (não encontrada), 409 (método não permitido no plano), 422 (status não permite a troca).Headers
ID público da credencial do merchant
Secret da credencial do merchant
Path Parameters
Body
application/json
Novo método de pagamento (credit_card ou pix) a definir como padrão.
- Option 1
- Option 2
Show child attributes
Show child attributes

