Skip to main content

Charges

Charges are the base object for both PIX and card payment flows authenticated by the merchant.

Main endpoint​

POST /v1/charges creates either a PIX or card charge. The payload uses amount_cents, payment_method and a customer object.

Installationnpm install mupag-sdk@0.2.0
import { MuPag } from 'mupag-sdk';

const mupag = new MuPag({
apiKey: process.env.MUPAG_API_KEY,
env: 'test',
});

const charge = await mupag.charges.create({
amount_cents: 1290,
payment_method: 'pix',
customer: {
name: 'Ana Silva',
email: 'ana@example.com',
tax_id: '12345678909',
},
}, { idempotencyKey: 'order_123_charge_1' });

console.log(charge.charge_id);

Expected response​

For PIX you receive charge_id, status, pix_emv_code, pix_qr_code_base64 and expires_at. For card flows, rely on webhooks and follow-up reads for the final state.

Safe operation​

  • Generate one Idempotency-Key per business attempt.
  • Reuse the same customer_id when the buyer already exists.
  • Do not deliver goods or access from the synchronous response alone; wait for the correct event.

Did this page unblock the next step?

Feedback stays inside the docs flow and should never include customer or card data.

mupag / support

How can we help?

Quick answers, AI and our team.

Frequently asked questions

How do I start integrating?

Follow the quickstart, configure the QA environment and create your first test charge.

Read documentation
My PIX payment is pending. What now?

Confirmation is asynchronous. Check the charge status and webhook events before fulfilling the order.

Read documentation
How do I receive payment notifications?

Register a webhook endpoint, verify its signature and handle duplicate events safely.

Read documentation
How do subscriptions work?

Read the subscriptions guide to configure recurring billing and follow the charge lifecycle.

Read documentation
Where can I find authentication help?

See how to use environment credentials in the documentation. Never share your key in chat.

Read documentation