Astron PayAstron Pay
Back to the blog

Blog

Cash-in and cash-out via PIX: how to automate payments with an API

Published on by Astron Pay

Cash-in and cash-out via PIX: how to automate payments with an API

Automating PIX payments means letting your application charge, receive and pay out money without manual intervention. In this technical guide, we look at how to structure cash-in and cash-out via API end to end.

The cash-in flow

In cash-in, you create a charge via the API and receive a QR Code or PIX Copy and Paste to present to the payer. When the PIX is confirmed, the platform fires a webhook to your application — that is the trigger to release the product, credit the balance or continue your business flow.

The cash-out flow

In cash-out, your application requests a payment to a destination PIX key. The platform executes the transfer and confirms the result via webhook. This automates payouts, refunds and supplier payments without manual operation.

Idempotency and security

Automation requires care with duplication: use idempotency keys to ensure a payout is not executed twice if the request is retried. Validate webhook signatures to be sure the notification really came from the platform, and not from a third party.

Reconciliation per order

Every cash-in and cash-out should generate traceable entries, reconcilable per order. A double-entry ledger lets you close the books per period and audit every cent — essential as volume grows.

Going to production

Start with the sandbox: create a charge, simulate the payment and handle the webhook; then run a test cash-out. With the flow validated, go live with just a few configuration changes.

The Astron Pay API covers cash-in and cash-out with the same standard of quotes, webhooks and reconciliation.

PIXcash-incash-outAPI
Astron Pay

Astron Pay

The Astron Pay Team builds the PIX and stablecoin infrastructure companies use to receive, convert and pay in Brazil. We write about what we learn running payments in production.