Pre-release: the public API is not live yet and has no base URL. Routes and fields are in the OpenAPI contract, at /openapi.yaml.

Skip to Content
ezeexDocumentation

Offers

Something on sale at a fixed price, with a checkout page: how to create it, share its address and take it off sale.

An offer is something on sale at a fixed price, with a checkout page of its own. You create the offer, give the address of its checkout to buyers, and each purchase made there becomes a charge.

Operations

Operation in the contractWhat it does
createOfferPuts an offer on sale and returns it, with its checkout_url. Requires the offers:write scope
getOfferReturns one offer by its id, on sale or archived. Requires the offers:read scope
listOffersReturns the offers of the environment, newest first, paginated by cursor. Requires the offers:read scope
archiveOfferTakes an offer off sale, for good, and returns it. Requires the offers:write scope

The route, the fields and the limits of each operation are in the OpenAPI contract, under these names. The offers of the API are the ones of the dashboard, in Ofertas: an offer created in one appears in the other.

What a key needs

  • offers:write to create and to archive, offers:read to read and to list. Writing does not include reading: a key with offers:write alone creates an offer and cannot read it back. See What a key can do.
  • A key created before offers were in the API has neither scope. A scope is never added to a key that exists: create another key in the dashboard.
  • Without the scope the answer is 403 with the insufficient_scope code.

Creating an offer

You send the name, as the buyer will read it on the checkout page, and the price, in cents. The answer is the offer, and its status says whether it is on sale at once.

  • The name and the price never change. To change one, archive the offer and create another.
  • A name that is only blank space is refused, with 422 and the offer_invalid code.
  • There is no Idempotency-Key: every call creates another offer. If a request fails with a network error or a timeout, list the offers before trying again. An offer created twice by mistake can be archived.
  • With a live key the offer is created, and it can only be bought while a bank serves the live mode. While the platform runs in simulation, that is a simulated bank: nothing there is real money, and the payment of a purchase is simulated from the dashboard. Without a bank, the purchase is refused.

The checkout address

checkout_url is the address of the checkout page of the offer. Whoever opens it can buy, without an account: the buyer types a name and an e-mail address and receives a PIX code to pay.

  • Use the address as the API returns it. Do not build it from the id.
  • An address you already gave out keeps working. It is safe to put in an e-mail, an ad or a page: if the checkout ever moves, the old address leads to the new one.
  • It only sells while the status of the offer is active. For any other status the checkout page says the offer is not available.

When an offer can be bought

status says whether the offer can be bought, and why not:

statusWhat it means
activeThe offer is on sale: its checkout address sells
awaiting_verificationA live offer of a merchant whose identity verification was not approved yet. The offer exists, and its address does not sell. The approval releases it, with no other step
blockedThe platform blocked the offer, and block_reason says why. Only the platform unblocks it
archivedYou took the offer off sale, for good
  • The identity verification is sent in the dashboard, in Verificação, and is of the merchant: once approved, it releases every live offer, the ones that exist and the ones created later.
  • Test offers do not wait for the verification. They are active from the start.
  • A live key does not create a charge before the approval either: createCharge answers 403 with the verification_required code.
  • Other values of status may come: handle an unknown one as an offer that cannot be bought.

What a purchase creates

Each purchase creates a charge in the environment of the offer, for the price of the offer. The charge expires 24 hours after the purchase.

  • It is a charge like any other: it has the same states, it sends the same webhooks, and getCharge and listCharges return it to a key with charges:read.
  • Its offer_id is the offer, and its customer is who bought. See Charges from an offer.
  • There is no filter by offer. To know what an offer sold, read the charges page by page and keep the ones with its offer_id.
  • In test mode, pay the charge of a purchase with simulatePayment, like any other charge. See Test mode.

An offer sends no webhook of its own. What happens to a purchase is told by the events of its charge. See Webhooks.

Archiving an offer

archiveOffer takes the offer off sale, and there is no way back. The answer is the offer, with archived_at.

  • Archiving an archived offer changes nothing and returns it as it is. It is safe to repeat.
  • The charges the offer already created stay as they are, and a purchase that was already made can still be paid.
  • An archived offer is still returned by getOffer and listOffers. archived_at is null while the offer is on sale.

Listing offers

listOffers returns the newest offers first, on sale and archived. Each page brings next_cursor: pass it as cursor to read the next page. A null next_cursor means this is the last page.

Identifiers

The id of an offer has the same format as the one of a charge, with the prefix ofr. For example, ofr_01h455vb4pex5vsknk084sn02q. See Identifiers.

Offers of another environment

Asking for an offer that does not belong to the environment of your key, to read it or to archive it, returns 404 with the offer_not_found code, exactly as if it did not exist.

On this page