Criar preço
curl --request POST \
--url https://api.upag.io/v1/products/{productId}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"amount": 123,
"currency": "<string>",
"billingType": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', amount: 123, currency: '<string>', billingType: '<string>'})
};
fetch('https://api.upag.io/v1/products/{productId}/prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/products/{productId}/prices';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', amount: 123, currency: '<string>', billingType: '<string>'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Preços
Criar preço
Cria um preço para um produto
POST
https://api.upag.io
/
v1
/
products
/
{productId}
/
prices
Criar preço
curl --request POST \
--url https://api.upag.io/v1/products/{productId}/prices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"amount": 123,
"currency": "<string>",
"billingType": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', amount: 123, currency: '<string>', billingType: '<string>'})
};
fetch('https://api.upag.io/v1/products/{productId}/prices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/products/{productId}/prices';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', amount: 123, currency: '<string>', billingType: '<string>'})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Permissão:
price.write (chave secreta; chave publicável não é aceita).
Endpoint
curl -X POST https://api.upag.dev/v1/products/0b9c1f3e-6a4d-4c1e-9d55-3f1f6a7c2e10/prices \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Mensal",
"amount": 4990,
"currency": "brl",
"billingType": "recurring",
"interval": "month",
"intervalCount": 1,
"metadata": { "tier": "pro" }
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
// upag.prices.create(productId, params)
const price = await upag.prices.create('0b9c1f3e-6a4d-4c1e-9d55-3f1f6a7c2e10', {
name: 'Mensal',
amount: 4990,
currency: 'brl',
billingType: 'recurring',
interval: 'month',
intervalCount: 1,
metadata: { tier: 'pro' },
});
Em produção use
https://api.upag.io/v1 com sk_live_....Parâmetros
string (uuid)
required
ID do produto dono do preço.
string
required
Nome do preço (mínimo 1 caractere).
integer
required
Valor em centavos (mínimo 100).
string
required
brl ou usd.string
required
one_time ou recurring.string
day, week, month ou year. Obrigatório quando billingType é recurring.integer
Inteiro ≥ 1. Obrigatório quando
billingType é recurring.object
default:"{}"
Até 10 chaves (até 20 caracteres cada); valores string (até 255) ou booleano.
Resposta
201 Created
Response
{
"id": "5f2d7a90-3b1c-4e8a-8f6d-1c9e4b7a2d33",
"name": "Mensal",
"billingType": "recurring",
"interval": "month",
"intervalCount": 1,
"currency": "brl",
"amount": 4990,
"metadata": { "tier": "pro" },
"createdAt": "2026-03-18T11:05:00.000Z",
"updatedAt": "2026-03-18T11:05:00.000Z"
}
404(PRODUCT_NOT_FOUND) — produto inexistente ou de outra conta.422— validação (por exemplo, preço recorrente semintervalouintervalCount, ouamountabaixo de 100).