Atualizar item do link
curl --request PATCH \
--url https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {},
"quantity": 123
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch('https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId}';
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Links de pagamento
Atualizar item do link
Troca o preço ou a quantidade de um item
PATCH
https://api.upag.io
/
v1
/
payment-links
/
{paymentLinkId}
/
items
/
{itemId}
Atualizar item do link
curl --request PATCH \
--url https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {},
"quantity": 123
}
'const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch('https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/payment-links/{paymentLinkId}/items/{itemId}';
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Permissão:
payment_link.write (chave secreta).
Endpoint
curl -X PATCH https://api.upag.dev/v1/payment-links/d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70/items/e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81 \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{ "quantity": 2 }'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
// upag.paymentLinks.updateItem(paymentLinkId, itemId, params)
const item = await upag.paymentLinks.updateItem(
'd4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70',
'e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81',
{ quantity: 2 },
);
Em produção use
https://api.upag.io/v1 com sk_live_....Parâmetros
string (uuid)
required
ID do link de pagamento.
string (uuid)
required
ID do item.
string (uuid)
Novo preço do item.
integer
Nova quantidade (≥ 1).
Resposta
200 OK
Response
{
"id": "e5f6a7b8-c9d0-4e1f-8a2b-3c4d5e6f7a81",
"product": "0b9c1f3e-6a4d-4c1e-9d55-3f1f6a7c2e10",
"price": "5f2d7a90-3b1c-4e8a-8f6d-1c9e4b7a2d33",
"quantity": 2,
"amount": 9980
}
404—PAYMENT_LINK_NOT_FOUND,PAYMENT_LINK_ITEM_NOT_FOUND,PRICE_NOT_FOUNDouPRODUCT_NOT_FOUND.400— violação das regras de consistência (veja a referência).