Criar um novo Pagamento
curl --request POST \
--url https://api.billing.upag.io/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "<string>",
"paymentMethod": "<string>",
"amount": 123,
"currency": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
paymentMethod: '<string>',
amount: 123,
currency: '<string>'
})
};
fetch('https://api.billing.upag.io/v1/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.billing.upag.io/v1/payments';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
paymentMethod: '<string>',
amount: 123,
currency: '<string>'
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Pagamentos
Criar um novo Pagamento
Crie um pagamento usando um método de pagamento do cliente
POST
https://api.billing.upag.io
/
v1
/
payments
Criar um novo Pagamento
curl --request POST \
--url https://api.billing.upag.io/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "<string>",
"paymentMethod": "<string>",
"amount": 123,
"currency": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
paymentMethod: '<string>',
amount: 123,
currency: '<string>'
})
};
fetch('https://api.billing.upag.io/v1/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.billing.upag.io/v1/payments';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
paymentMethod: '<string>',
amount: 123,
currency: '<string>'
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Cria um novo pagamento para um cliente usando um método de pagamento previamente cadastrado.
Endpoint
curl -X POST https://api.billing.upag.io/v1/payments \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"customer": "cus_ahwDXrgYvur89iPs",
"paymentMethod": "pm_abc123xyz",
"amount": 10000,
"currency": "BRL",
"installments": 1
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const payment = await upag.payments.create({
customer: 'cus_ahwDXrgYvur89iPs',
paymentMethod: 'pm_abc123xyz',
amount: 10000,
currency: 'brl',
installments: 1,
});
Parâmetros
string
required
ID do cliente (UUID).
string
required
ID do método de pagamento (UUID).
number
required
Valor do pagamento em centavos (mínimo: 1).
string
required
Código da moeda (ex.:
BRL).number
Número de parcelas. Padrão:
1, máximo: 12.Resposta
Response
{
"id": "pay_xyz789abc",
"livemode": false,
"customer": {
"id": "cus_ahwDXrgYvur89iPs",
"name": "John Doe",
"email": "john.doe@example.com"
},
"paymentMethod": {
"id": "pm_abc123xyz",
"type": "credit_card",
"lastDigits": "1111",
"brand": "visa"
},
"amount": 10000,
"gross": 10000,
"mdr": 0,
"net": 10000,
"interest": 0,
"currency": "BRL",
"status": "paid",
"pixQrCode": null,
"refuseReason": null,
"installments": 1,
"createdAt": 1731622178441,
"updatedAt": 1731622178441,
"dueAt": null
}