Repository navigation
docs operations payment providers guide
Step-by-step provider setup for the staging host teste.abastevo.com.br.
The payments runbook owns rotation, preflight, queue recovery
and channel disable. The
subscriptions module owns the
company billing rules. This guide covers only what an operator clicks or
calls at each provider.
Rules for every step:
- Use Stripe test mode (or a Stripe Sandbox) and the Asaas Sandbox only.
- Keys, webhook secrets and tokens live in the host's protected environment
file, created from
infra/env.staging.example. Never put one in this repository, an issue, a chat or a screenshot. - Provider screens change. Each step links the provider's own walkthrough, read on 2026-11-21, instead of copying it.
- Screenshots belong in
docs/assets/payments/stripe/anddocs/assets/payments/asaas/. Take them only in test mode or sandbox and redact account, customer, key and e-mail values before committing. - Sales stay off. Provisioning credentials or webhook destinations activates nothing (see Production checklist).
-
Select the test environment. In the Dashboard account picker, open a Sandbox or switch to test mode, and confirm it before opening any other page. Sandboxes · testing use cases
-
Keys. Under Developers → API keys, copy the test secret key (
sk_test_…, or a restrictedrk_test_…). Set, on the host only:Variable Value ANPFUEL_STRIPE_MODEtestANPFUEL_STRIPE_SECRET_KEYthe test secret key ANPFUEL_STRIPE_MERCHANT_IDthe account ID ( acct_…) shown in account settingsThe API refuses a key whose account differs from the merchant ID. API keys
-
Product and Price. In Product catalogue, add a Product and one recurring Price: currency BRL, billing period monthly, fixed amount. Set
ANPFUEL_STRIPE_PRICE_IDto itsprice_…ID. A company offer pins the same Price ID, plan revision, merchant, mode, amount in centavos and monthly term inenterprise_billing_offers. Manage products and prices -
Webhook destination. In Developers → Webhooks, add the endpoint
https://teste.abastevo.com.br/v1/payments/stripe/webhookwith API version2026-09-30.endive. Intake refuses any other API version and any Connect event. Copy the signing secret (whsec_…) toANPFUEL_STRIPE_WEBHOOK_SECRET. Select exactly these events, the only ones the worker routes:invoice.paidinvoice.payment_failedinvoice.payment_action_requiredcustomer.subscription.updatedcustomer.subscription.deletedcheckout.session.completedcharge.refundedcharge.dispute.createdcharge.dispute.updatedcharge.dispute.closed
Any other authenticated event is stored and acknowledged with no effect. Webhooks
-
Test cards. Use any future expiry and any three-digit CVC.
Card Scenario 4242 4242 4242 4242payment succeeds 4000 0000 0000 0002generic decline 4000 0025 0000 31553-D Secure challenge; approve and refuse it once each -
Stripe CLI (local intake only). The listener prints its own signing secret; use that one for the local API, never the dashboard secret.
stripe listen --events invoice.paid,invoice.payment_failed,invoice.payment_action_required,customer.subscription.updated,customer.subscription.deleted,checkout.session.completed,charge.refunded,charge.dispute.created,charge.dispute.updated,charge.dispute.closed \ --forward-to http://127.0.0.1:8080/v1/payments/stripe/webhook stripe trigger invoice.paid
A triggered event proves delivery and signature verification only. It is refused when the account's default API version is not the pinned one, and it can never settle a company term. Stripe CLI
The worker treats an invoice as a company invoice only when the finalized invoice's subscription carries this metadata, set on the subscription:
| Key | Value |
|---|---|
abastevo_billing_scope |
organization |
abastevo_organization_id |
the organization UUID |
abastevo_organization_subscription_id |
the organization subscription UUID |
Do not add order_id or account_id: those mark a personal checkout and the
invoice is refused. The invoice must be collected automatically by card, in
BRL, with one subscription line of quantity 1 at the reviewed Price and no
proration. Metadata
Order matters:
- Create the subscription so its first invoice exists and is still unpaid.
- Record the reviewed binding for that invoice (see Binding a reviewed charge).
- Collect the payment.
A first invoice paid before its binding ends as a terminal conflict in the inbox. A Checkout session creates the invoice at payment time, so it cannot be bound in advance. A renewal invoice paid before its binding waits in the inbox and settles once the binding exists.
-
Account and key. Create the Sandbox account, then open Integrações → Chaves de API as an administrator and generate a key. Set, on the host only:
Variable Value ANPFUEL_ASAAS_MODEtest(callshttps://api-sandbox.asaas.com/v3)ANPFUEL_ASAAS_API_KEYthe Sandbox API key ANPFUEL_ASAAS_MERCHANT_IDthe account UUID that Asaas sends as account.idin every webhook -
Webhook. Under Integrações → Webhooks, register
https://teste.abastevo.com.br/v1/payments/asaas/webhook. Generate a dedicated authentication token of 32 to 255 printable characters without spaces and set it asANPFUEL_ASAAS_WEBHOOK_TOKEN. Asaas sends it in theasaas-access-tokenheader. The API key is never accepted as the token. The worker routes everyPAYMENT_…andPIX_AUTOMATIC_RECURRING_…event; subscribe to these:-
PAYMENT_CREATED,PAYMENT_RECEIVED,PAYMENT_CONFIRMED,PAYMENT_OVERDUE -
PAYMENT_REFUNDED,PAYMENT_PARTIALLY_REFUNDED -
PAYMENT_CHARGEBACK_REQUESTED,PAYMENT_CHARGEBACK_DISPUTE,PAYMENT_AWAITING_CHARGEBACK_REVERSAL -
PIX_AUTOMATIC_RECURRING_AUTHORIZATION_CREATED,…_ACTIVATED,…_REFUSED,…_CANCELLED,…_EXPIRED -
PIX_AUTOMATIC_RECURRING_PAYMENT_INSTRUCTION_CREATED,…_SCHEDULED,…_REFUSED,…_CANCELLED PIX_AUTOMATIC_RECURRING_ELIGIBILITY_UPDATED
Only
PAYMENT_RECEIVEDcan settle a term. Webhook setup · charge events · Pix Automático events -
-
Company Pix charge. Create a synthetic customer with notifications disabled, then a charge with
billingType=PIX, the reviewed amount and due date, andexternalReference=abv_org:<organization UUID>:<checkout UUID>Both UUIDs are lowercase. The checkout UUID is chosen at review; the organization subscription UUID is a valid choice. The reviewed binding stores the whole string and settlement requires an exact match. Bind the charge before paying it: a payment received before its binding ends as a terminal conflict. Create a customer · create a charge
-
Pix Automático. Create a monthly authorization for the same customer and follow the provider's sandbox flow until the authorization is
ACTIVE. Each cycle is its own charge: it carriespixAutomaticAuthorizationIdand the same kind ofabv_org:reference, and needs its own binding before the debit.ANPFUEL_ASAAS_PIX_AUTOMATIC_NEW_SALES_ENABLEDstaysfalse. Authorization API · implementation guide -
Confirm a sandbox payment. Use the charge's Sandbox detail page or the sandbox-only confirmation endpoint. A confirmed payment does not by itself prove that an authorization became active. Sandbox balance and confirmation · confirmation endpoint
A commercial review approves one existing Stripe invoice or Asaas charge for
one company offer and term in org_billing_charge_approvals. The restricted
operator login from
infra/db/billing-binding-role.sql
then records the binding:
ops enterprise billing bind --org <uuid> --approval-id <uuid> \
--operation-id <uuid> --operator <uuid>ANPFUEL_ENTERPRISE_ENABLED and ANPFUEL_ENTERPRISE_BILLING_ENABLED must be
true for the command. Reuse the same operation ID to retry. Binding creates no
payment and no entitlement. After the provider reports the payment, the
plan and billing overview of the company web app shows the settled charge,
its gross BRL amount and its term.
TestSandboxCompanyBillingReplay reads one existing sandbox charge from the
provider and settles it twice in a disposable ledger. It writes nothing to the
provider. Run it once for each of stripe_card, asaas_pix_manual and
asaas_pix_automatic, following
Read-only provider sandbox replay
for the private case file.
cd backend
go test -race -tags=integration,sandbox -count=1 \
-run '^TestSandboxCompanyBillingReplay$' -v ./internal/modules/payments/adapters| Variable | Use |
|---|---|
ANPFUEL_SANDBOX_COMPANY_BILLING_CASE |
path of the 0600 JSON case for one channel |
ANPFUEL_SANDBOX_STRIPE_SECRET, ANPFUEL_SANDBOX_STRIPE_MERCHANT
|
Stripe test key and account |
ANPFUEL_SANDBOX_ASAAS_KEY, ANPFUEL_SANDBOX_ASAAS_MERCHANT
|
Asaas Sandbox key and account UUID |
ANPFUEL_TEST_DATABASE_URL |
disposable loopback PostGIS, never staging |
A channel reported as SKIP has no evidence. Only a PASS for the channel
counts toward provider acceptance.
New sales stay disabled until the owner accepts M8 (milestones). Before that gate:
- All three sandbox replay channels pass, and one signed staging payment per provider is reconciled under owner control.
- Offers, prices, contracts and fiscal terms are reviewed (EMP-GOV-009).
- Production keys, webhook secret and token are created separately from the test ones and stored only through the host secret workflow.
- The production Stripe destination uses API version
2026-09-30.endiveand the event list above; the merchant ID is the production account. - The Asaas production account has a registered Pix key and, for Pix Automático, confirmed merchant eligibility.
-
ANPFUEL_STRIPE_CARD_NEW_SALES_ENABLED,ANPFUEL_ASAAS_PIX_MANUAL_NEW_SALES_ENABLEDandANPFUEL_ASAAS_PIX_AUTOMATIC_NEW_SALES_ENABLEDare stillfalse.
- Home
- Roadmap
- docs-README
- docs-android-build
- docs-android-design-system
- docs-android-forum
- docs-android-games
- docs-android-map-engine
- docs-android-navigation
- docs-android-ocr-image
- docs-android-ocr-live-framing
- docs-android-premium-area
- docs-android-premium-integration
- docs-android-release
- docs-android-ui-containers
- docs-architecture-android-stack
- docs-architecture-android
- docs-architecture-backend
- docs-architecture-data-sources
- docs-architecture-overview
- docs-architecture-sources-ev-research
- docs-architecture-sources-national-limits
- docs-architecture-sources-national-stations
- docs-architecture-sources-register
- docs-assets-app-tutorial-CAPTURE_CONTRACT
- docs-assets-app-tutorial-FABLE_LANDING_POLISH_PROMPT
- docs-assets-app-tutorial-README
- docs-assets-attribution
- docs-assets-brand-README
- docs-assets-flags-ATTRIBUTION
- docs-assets-fuel-icons-README
- docs-assets-games-fuel-v1-README
- docs-assets-home-icons-README
- docs-assets-landing-fleet-android-20261012-BRIEF
- docs-assets-landing-hero-20261011-BRIEF
- docs-assets-landing-illustrated-20261012-BRIEF
- docs-assets-landing-illustrated-20261012-README
- docs-assets-landing-minimal-20261012-BRIEF
- docs-assets-landing-open-data-20261026-BRIEF
- docs-assets-landing-redesign-20261011-PREPARATION_EVIDENCE
- docs-assets-landing-redesign-20261011-README
- docs-assets-landing-redesign-20261011-REFERENCE_BRIEF
- docs-assets-landing-sync-20261012-BRIEF
- docs-assets-map-icons-README
- docs-backend-anp-ingestion
- docs-backend-api
- docs-backend-community-pricing
- docs-backend-data-model
- docs-backend-domain-model
- docs-backend-driver-private-data
- docs-backend-forum-architecture
- docs-backend-forum-bulletins
- docs-backend-forum-sources
- docs-backend-payments-provider-admission
- docs-backend-payments-provider-register
- docs-backend-photos-capture
- docs-backend-photos-subset-submission
- docs-backend-premium-api
- docs-backend-premium-cloud-protocol
- docs-backend-testing
- docs-backend-toolchain
- docs-brand-app-icons
- docs-brand-identity
- docs-decisions-001-kotlin-compose-stack
- docs-decisions-002-price-import-immutability
- docs-decisions-003-nominatim-reverse-geocode
- docs-decisions-005-modular-monolith-and-postgresql
- docs-decisions-006-official-catalog-and-exact-contracts
- docs-decisions-007-anonymous-proof-of-possession
- docs-decisions-008-privacy-and-retention
- docs-decisions-009-community-consensus-and-projections
- docs-decisions-010-private-object-evidence
- docs-decisions-012-licensing-and-hosted-business
- docs-decisions-015-kotlin-multiplatform-shared-domain
- docs-decisions-016-android-commercial-community-ios-deferred
- docs-decisions-017-station-profile-and-verified-representation
- docs-decisions-021-community-first-contribution
- docs-decisions-022-comaps-derived-native-map-engine
- docs-decisions-023-admin-suite-granted-tiers-contributors
- docs-decisions-025-private-abastevo-empresas-organization-boundary
- docs-decisions-026-multilingual-public-site
- docs-decisions-027-ai-reviewed-landing-translations
- docs-decisions-028-ai-reviewed-portal-translations
- docs-decisions-README
- docs-enterprise-README
- docs-enterprise-architecture
- docs-enterprise-backlog-INDEX
- docs-enterprise-backlog-ep00-governance
- docs-enterprise-backlog-ep01-platform
- docs-enterprise-backlog-ep02-organizations
- docs-enterprise-backlog-ep03-identity-access
- docs-enterprise-backlog-ep04-sync
- docs-enterprise-backlog-ep05-fleet-meters
- docs-enterprise-backlog-ep06-trips
- docs-enterprise-backlog-ep07-gps-navigation
- docs-enterprise-backlog-ep08-fuelings
- docs-enterprise-backlog-ep09-documents
- docs-enterprise-backlog-ep10-expenses-finance
- docs-enterprise-backlog-ep11-maintenance
- docs-enterprise-backlog-ep12-fuel-stock
- docs-enterprise-backlog-ep13-intelligence
- docs-enterprise-backlog-ep14-station-claims
- docs-enterprise-backlog-ep15-station-commerce
- docs-enterprise-backlog-ep16-subscriptions
- docs-enterprise-backlog-ep17-data
- docs-enterprise-backlog-ep18-imports-notifications-integrations
- docs-enterprise-backlog-ep19-back-office
- docs-enterprise-backlog-ep20-release
- docs-enterprise-business-rules
- docs-enterprise-contract
- docs-enterprise-conventions
- docs-enterprise-data-offering
- docs-enterprise-decisions
- docs-enterprise-domain-model
- docs-enterprise-glossary
- docs-enterprise-journeys
- docs-enterprise-modules-back-office
- docs-enterprise-modules-data
- docs-enterprise-modules-documents
- docs-enterprise-modules-expenses-finance
- docs-enterprise-modules-fleet
- docs-enterprise-modules-fuel-stock
- docs-enterprise-modules-fuelings
- docs-enterprise-modules-gps-navigation
- docs-enterprise-modules-identity
- docs-enterprise-modules-imports-notifications-integrations
- docs-enterprise-modules-intelligence
- docs-enterprise-modules-maintenance
- docs-enterprise-modules-organizations
- docs-enterprise-modules-station-claims
- docs-enterprise-modules-station-commerce
- docs-enterprise-modules-subscriptions
- docs-enterprise-modules-trips
- docs-enterprise-offline-sync
- docs-enterprise-permissions
- docs-enterprise-portal-routes
- docs-enterprise-privacy-security
- docs-enterprise-product-vision
- docs-enterprise-source-admission
- docs-enterprise-state-model
- docs-enterprise-testing
- docs-enterprise-ux-app
- docs-enterprise-ux-web
- docs-operations-README
- docs-operations-backup
- docs-operations-deploy-agent
- docs-operations-dou-editions
- docs-operations-edge-cache
- docs-operations-enterprise-activation
- docs-operations-map-static-overlay
- docs-operations-moderation-feedback
- docs-operations-moderation-profiles
- docs-operations-monitoring
- docs-operations-operator-access
- docs-operations-payment-providers-guide
- docs-operations-payments
- docs-operations-premium-billing
- docs-operations-recovery
- docs-operations-registry-daily-sync
- docs-operations-registry-runs
- docs-product-README
- docs-product-admin-tiers
- docs-product-community-community-first
- docs-product-community-experience
- docs-product-community-metrics
- docs-product-community-moderation
- docs-product-community-safety
- docs-product-community-terms-pt-br
- docs-product-driver-suite-README
- docs-product-driver-suite-android-state
- docs-product-driver-suite-cloud-sync
- docs-product-driver-suite-cost-profiles-and-maintenance
- docs-product-driver-suite-driver-model-and-earnings
- docs-product-driver-suite-foundation-decisions
- docs-product-driver-suite-gps-lifecycle
- docs-product-driver-suite-mobile-hub
- docs-product-driver-suite-odometer-review
- docs-product-driver-suite-outbox-wire
- docs-product-driver-suite-quick-refuel
- docs-product-driver-suite-reports
- docs-product-driver-suite-shifts-and-distance
- docs-product-driver-suite-signed-commands
- docs-product-ev-README
- docs-product-ev-charging-stop-planner
- docs-product-ev-energy-model
- docs-product-ev-financial-method
- docs-product-ev-journey-ui
- docs-product-ev-preparation
- docs-product-ev-typed-data
- docs-product-exploration
- docs-product-forum-contract
- docs-product-forum-policies
- docs-product-glossary
- docs-product-landing-content
- docs-product-landing-guides
- docs-product-landing-organic-growth-i18n-plan
- docs-product-landing-organic-traffic-expansion-plan
- docs-product-licensing
- docs-product-map-discovery
- docs-product-map-favorites-and-trips
- docs-product-map-reports-routing-guidance
- docs-product-notification-content
- docs-product-official-prices
- docs-product-open-source-business
- docs-product-overview
- docs-product-payments-README
- docs-product-payments-offer-policy
- docs-product-premium-README
- docs-product-premium-financial-method
- docs-product-premium-source-policy
- docs-product-stations-catalog
- docs-product-stations-fuel-feedback
- docs-product-stations-fuel-quality
- docs-product-stations-identity-and-ev-catalog
- docs-product-stations-profile-contract
- docs-product-stations-profile-representation
- docs-product-stations-registry-sources
- docs-product-vehicle-registration
- docs-product-vehicles-and-occurrences
- docs-security-android-terms-acceptance
- docs-security-free-account-access
- docs-security-identity-profile
- docs-security-media-location-policy
- docs-security-privacy-notice
- docs-security-privacy-policy
- docs-security-retention
- docs-security-risks
- docs-security-security-privacy
- docs-store-README
- docs-store-play-readiness
- docs-store-play-store-listing
- docs-store-ugc-safety
Source: AlexandreZanata/brazil-fuel-prices @ 9c7752ddd09ff1241fda4007f0e281d1a1dbab43