Adicionar item ao link
curl --request POST \
--url https://api.upag.io/v1/payment-links/{paymentLinkId}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {},
"quantity": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch('https://api.upag.io/v1/payment-links/{paymentLinkId}/items', 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';
const options = {
method: 'POST',
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
Adicionar item ao link
Adiciona um preço como item do link de pagamento
POST
https://api.upag.io
/
v1
/
payment-links
/
{paymentLinkId}
/
items
Adicionar item ao link
curl --request POST \
--url https://api.upag.io/v1/payment-links/{paymentLinkId}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price": {},
"quantity": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({price: {}, quantity: 123})
};
fetch('https://api.upag.io/v1/payment-links/{paymentLinkId}/items', 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';
const options = {
method: 'POST',
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 POST https://api.upag.dev/v1/payment-links/d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70/items \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"price": "5f2d7a90-3b1c-4e8a-8f6d-1c9e4b7a2d33",
"quantity": 2
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
// upag.paymentLinks.createItem(paymentLinkId, params)
const item = await upag.paymentLinks.createItem('d4e5f6a7-b8c9-4d0e-9f1a-2b3c4d5e6f70', {
price: '5f2d7a90-3b1c-4e8a-8f6d-1c9e4b7a2d33',
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 preço a vender.
integer
required
Quantidade (≥ 1).
Resposta
201 Created
amount é preço × quantidade, em centavos.
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,PRICE_NOT_FOUNDouPRODUCT_NOT_FOUND.400—PAYMENT_LINK_DUPLICATE_PRICE,PAYMENT_LINK_CURRENCY_MISMATCH,PAYMENT_LINK_RECURRING_INTERVAL_MISMATCH(veja a referência).