links.create answers 422.
Where productId comes from
Every charging page asks for a productId. It comes from one of three places:
The chain
products.create already returns version 1 as a draft — you do not create a
version by hand, you list it and publish it.
Price: you probably do not need prices.add
For a one-off product at a fixed amount, the product’s basePrice is the
price — the invoice and the link already carry it. products.prices.add exists
for a per-meter rate (per token, per request), not for a flat price.
A meter only enters when you charge for usage:
Selling from your own page: checkout()
If you do not want to send a link and would rather have a “Buy” button in your
app, it is one call. It creates the invoice and returns the hosted URL where the
person pays (pix, boleto, card):
amount only to
override it. The person is enrolled in the product along the way, so you get an
invoice tied to the product (rather than a loose charge).
Calling it over curl. Every
POST/PUT/DELETE on the authenticated API requires an
Idempotency-Key header — without it you get 400 idempotency_key_required.
The SDK generates one per call; over curl you send your own.Next step
Payment link
With a published version, the link is one line.
Deliver the product
Attach the file or the link; delivery goes out on its own when payment confirms.
Test in the sandbox
Pay the test invoice and watch the status turn
paid.Know that they paid
Webhook in production, polling in sandbox.