C Cashbanx Direct store API
PTEN

Integration documentation

Direct store API

Direct integration between the partner store and Cashbanx — the order is born at the store, the points are calculated here.

Document NR-000/01 Programme Ganhe Pontos v4 Version 1.0 — August 2026 Audience integrated partner stores

01Architecture

The flow has two mandatory calls from the store to Cashbanx, always in this order: the order notification and, after it, the status update to completed or canceled.

  1. A Cashbanx page specific to the partner offers a link to the store's site. That link carries the click identifier — a value in the format hub_<number>, delivered in a URL parameter whose name is agreed with each store at onboarding.
  2. On click, a new tab opens the store's site. E.g.: https://www.paginadolojaxpto.com.br/?token=hub_1234567
  3. At the store's site the customer picks the products and places the order. The store must keep the click identifier received in the URL and associate it with the order.
  4. Once the order is confirmed, the store notifies Cashbanx (purchase-made), returning the click identifier in the click_id field. At that moment Cashbanx tells Esfera, which e-mails the customer about the purchase. The order starts out pending: no points are released yet.
  5. After the statutory cancellation window and the agreement with the Cashbanx commercial team, the store updates the order status (confirm-purchase) — completed or canceled.
Order statusEffect for the customer
ORDER COMPLETED The points are released according to the release rule agreed for the store, showing up in the customer's statement.
ORDER CANCELED No points are released to the customer.
Both calls are mandatory

The flows inside the store's environment may change. Keeping both calls to Cashbanx is mandatory, however: the purchase notification and the update to completed or canceled. An order that never receives the second call stays pending indefinitely, and no points are credited.

Who calculates the points

The store reports the order amount; Cashbanx is what calculates the points, from the commission recorded in the store's registration and from the programme rule. The points field of the notification is informational: it is stored alongside the order, but it does not determine what the customer receives.

02Environments

Every endpoint in this document is published under the /api prefix. Replace {cashbanx_url} with the host of the environment:

Environment{cashbanx_url}
Staginghttps://dev-api.cashbanx.site
Productionhttps://api.cashbanx.site

Staging is the Cashbanx development environment: its data is independent from production, but the environment is updated often and carries no availability commitment. Credentials differ per environment and are not interchangeable.

03Credentials and identification

Cashbanx hands the store, per environment:

  • client_id and client_secret — used only to obtain the access token. The client_secret is shown once, at creation; if lost, it is replaced by a new one, never recovered.
  • partner_id — the store's identifier in the Cashbanx registration, sent in the body of both calls.

The credential is what determines the store and the programme the order will be booked into. The partner_id sent in the body must be exactly the one of the credential in use; any other value is refused with partner not found. No field in the body changes where the order is booked.

04Authentication

OAuth 2.0, client_credentials flow. The token is valid for 30 minutes (expires_in: 1800) and must be reused while it lasts — request a new one only when the previous has expired.

POST{cashbanx_url}/api/auth/oauth2/v1/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>

200 · success

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_in": 1800,
  "token_type": "bearer"
}

The client_credentials flow issues neither refresh_token nor refresh_expires_in (RFC 6749, §4.4.3): the store already holds the credentials and requests a new token when it needs one. The encrypted parameter is not accepted.

4xx · error — the error body always has the same shape:

{ "errorCode": "invalid_client", "errorMessage": "client_id or client_secret is incorrect" }
Code errorCode errorMessage Situation
400 unsupported_grant_type grant_type is incorrect grant_type other than client_credentials.
400 invalid_request client_id or client_secret is incorrect client_id or client_secret not sent.
400 invalid_client client_id or client_secret is incorrect Invalid, non-existent or revoked credential — all three answer the same, for security.
429 invalid_request Too many requests More than 20 token requests per minute for the same client_id.
500 internal_error Internal Server Error Internal processing failure at Cashbanx.

05API · Order notification

Reports that an order was placed. The order is recorded as pending and awaits the status update described in section 06.

POST{cashbanx_url}/api/b2b/v1/partner-notify/campaign/purchase-made
Authorization: Bearer {access_token}
Content-Type: application/json
Field Description Type Req.
customer_idCustomer identificationTextYes
customer_id_typeType of the identification: Token, CPF or CNPJ (exact spelling)TextYes
customer_nameCustomer nameTextNo
customer_mailCustomer e-mailTextNo
customer_phoneCustomer phone (area code + number)TextNo
click_idClick identifier received in the entry URL, in the format hub_<number>TextNo *
partner_idPartner identificationTextYes
campaign_idCampaign identificationTextYes
order_idOrder numberTextYes
order_dateOrder date (yyyy-mm-dd)DateYes
pointsAmount of points — informational, does not determine the creditIntegerNo
order_totalOrder amount in Brazilian reais, excluding shipping. Greater than zero and at most 1000000.00, with up to two decimal placesNumericYes
order_item_quantityNumber of items in the orderNumericNo
order_item_skuSKU number at the partnerTextNo
address_streetDelivery address of the orderTextNo
address_numberNumberTextNo
address_complementComplementTextNo
address_cityCityTextNo
address_ufStateTextNo
address_countryCountryTextNo
* click_id is not required, but it is what secures the points

The click_id identifies the visit that originated at Cashbanx and is what ties the order to the agreed rate. It is only honoured when it belongs to the same store and to the same person the order identifies in customer_id — which is why the two fields are separate, and why the click identifier must be kept per order, never per customer.

Without a click_id, or when it does not match the customer reported, the order is not refused: it is recorded with no link, with zero points, and is then handled commercially between the store and Cashbanx.

Example request

{
  "customer_id": "01245678901",
  "customer_id_type": "CPF",
  "customer_name": "João da Silva",
  "customer_mail": "joaodasilva@hotmail.com",
  "customer_phone": "11999999999",
  "click_id": "hub_1234567",
  "partner_id": "ABC",
  "campaign_id": "DEFG1234",
  "order_id": "1234567891",
  "order_date": "2026-01-01",
  "points": 100,
  "order_total": 100.50,
  "order_item_quantity": 1,
  "order_item_sku": "0987654321",
  "address_street": "Rua XPTO",
  "address_number": "200",
  "address_complement": "AP 100",
  "address_city": "São Paulo",
  "address_uf": "SP",
  "address_country": "Brasil"
}

200 · success

{ "message": "Purchase received." }
Code errorCode errorMessage Situation
400 order_id_duplicated order_id duplicated An order with the same order_id has already been received for this store.
400 partner_not_found partner not found The partner_id is not the one of the credential in use, or the store is inactive at Cashbanx.
400 missing_field <field> cannot be null A required field was not sent, or came null or empty: customer_id, customer_id_type, partner_id, campaign_id, order_id, order_date or order_total.
400 bad_request Bad Request Something filled in incorrectly: invalid type, a field not published in this document, a date that does not exist (2026-02-31) or an order_total outside the published range.
401 invalid_client access_token is incorrect Token absent, expired or revoked.
500 internal_error Internal Server Error Internal processing failure at Cashbanx.

06API · Order update

Completes or cancels an order notified earlier. This is the call that releases or cancels the customer's points.

PUT{cashbanx_url}/api/b2b/v1/partner-notify/campaign/confirm-purchase
Authorization: Bearer {access_token}
Content-Type: application/json
Field Description Type Req.
partner_idPartner identificationTextYes
order_idOrder number, the same one sent in the notificationTextYes
order_update_dateDate of the status update (yyyy-mm-dd)DateYes
order_dateOrder date (yyyy-mm-dd) — informationalDateNo
order_statusFinal status: COMPLETED or CANCELEDTextYes
status_descriptionDescription of the reason for the statusTextIf CANCELED

Order completed · releases the points

{
  "partner_id": "ABC",
  "order_id": "1234567891",
  "order_status": "COMPLETED",
  "order_date": "2026-01-01",
  "order_update_date": "2026-02-15",
  "status_description": "Order delivered"
}
{ "message": "Confirmed order." }

Order canceled · does not release the points

{
  "partner_id": "ABC",
  "order_id": "1234567891",
  "order_status": "CANCELED",
  "order_update_date": "2026-02-15",
  "status_description": "Canceled for a specific reason"
}
{ "message": "Order canceled." }
The update is final

An order accepts one single status update. Once completed or canceled, any further call — including a CANCELED after a COMPLETED — is refused with Order already processed, and there is no way back through the API.

That is why the update must be sent only after the exchange and return window. Returns after the confirmation are handled commercially between the store and Cashbanx.

Code errorCode errorMessage Situation
400 order_not_found Order not found The order_id was not found for this store.
400 order_already_processed Order already processed The order has already been completed or canceled.
400 partner_not_found partner not found The partner_id is not the one of the credential in use, or the store is inactive at Cashbanx.
400 missing_field <field> cannot be null A required field was not sent, or came null: partner_id, order_id, order_update_date, order_status — and status_description when the status is CANCELED.
400 bad_request Bad Request Something filled in incorrectly: an order_status outside the published values, a date that does not exist, or a field not published in this document.
401 invalid_client access_token is incorrect Token absent, expired or revoked.
500 internal_error Internal Server Error Internal processing failure at Cashbanx.

07Transactional e-mails

When the store notifies that the order was placed, Cashbanx tells Esfera so that it can communicate with the customer by e-mail. Esfera is what sends the e-mail, not Cashbanx.

Subject: "Você vai ganhar pontos na Esfera!" — You are going to earn Esfera points!

Hello, [Customer name],

The partner store XPTO told us about your purchase with Esfera. The window for crediting the points starts once your order is delivered. For more information, visit the related page under Partner Stores on the website.

Order summary: partner store name, purchase date, amount in Brazilian reais (excluding shipping) and order number.

08Integration notes

  • Resending after a timeout is safe. The order_id is the idempotency key: a resent notification answers order_id duplicated and a second update answers Order already processed. Neither case credits twice.
  • There is no negative amount. Refunds and returns are not represented by a negative order_total — the published path is CANCELED, and only while the order has not been updated yet.
  • Keep the click_id per order. Reusing an old click identifier on a new order makes the points be calculated at the wrong rate, with nothing flagging the problem.
  • Reuse the token through its 30 minutes of validity. Token requests are limited to 20 per minute per client_id.
  • A field not published in this document is refused with Bad Request. Send only the published fields.