← all adapters

braintree-style

simulates Braintree GraphQL + REST API 2024-09-01

restadapter v0.3.015 routes

verification

VMVM tier — no SDK suite yet· surface 15 · not implemented 8 · differs 7

use it

# add to stunt.yaml
services:
  braintree:
    adapter: embedded:braintree-style

# then
$ stunt up

The embedded: source extracts this adapter from the binary — no git clone, fully offline.

how to mock the Braintree GraphQL + REST API locally

Install stunt, paste the service block above into stunt.yaml, run stunt up — then point your client at localhost instead of Braintree GraphQL + REST API. It works offline, keeps state across requests and restarts, and every response is synthetic: the route shapes, status codes, pagination, and webhook delivery follow the real Braintree GraphQL + REST API 2024-09-01 surface — the data is fake, the behavior is real.

backing stores

transactionscustomers

api surface (15)

generated from the adapter manifest — exactly what boots, nothing more

15 routes · graphql
POST/merchants/{merchantId}/transactions/advanced_search
POST/merchants/{merchantId}/transactions
GET/merchants/{merchantId}/transactions/{id}
POST/merchants/{merchantId}/transactions/{id}/settle
POST/merchants/{merchantId}/transactions/{id}/void
POST/merchants/{merchantId}/transactions/{id}/refund
POST/merchants/{merchantId}/payment_methods
POST/merchants/{merchantId}/client_token
POST/merchants/{merchantId}/plans
GET/merchants/{merchantId}/plans
GET/merchants/{merchantId}/plans/{id}
POST/merchants/{merchantId}/subscriptions
GET/merchants/{merchantId}/subscriptions/{id}
POST/merchants/{merchantId}/subscriptions/{id}/cancel
POST/webhooks

VM-verified behaviors (19)

  • ping answers true and introspection names the query root
  • unknown fields and operations fail validation before execution
  • createCustomer assigns an id and the customer query reads it back
  • a charge is born SUBMITTED_FOR_SETTLEMENT; an authorization is AUTHORIZED
  • resolver failures surface as errors[] with a null field, not an HTTP status
  • searchTransactions speaks the criteria vocabulary with enum normalization
  • the charge settles at +3s, derived on read
  • REST handlers require credentials; Bearer or Basic both unlock
  • client tokens and vaulted payment methods come back in Braintree shapes
  • the transaction lifecycle derives on the clock
  • guard failures carry the real Braintree error codes
  • refunds default to the unrefunded balance and cap at it
  • an uncaptured authorization expires past its window
  • an Idempotency-Key replays the original create
  • advanced_search maps the search-criteria vocabulary onto typed filters
  • registration stores the hook and delivers a signed check
  • settled transactions fire one signed notification per new state, filtered by kind
  • subscriptions bill per cycle, expire at the last, and cancel only while Active
  • inbound verification splits 200/400

Not implemented (8)

  • No REST customer endpoints: create, get, search, update, delete (/customers)
  • No payment method fetch or delete: GET/DELETE /payment_methods/{token}
  • No addresses or credit_card_verifications endpoints
  • No subscription update, retry, or search; no plan delete
  • No disputes endpoints: search, open, accept, add evidence
  • No merchant accounts, settlements, or documents endpoints
  • GraphQL subset: no paymentMethod, clientToken, PayPal, or dispute operations
  • No Braintree Auth OAuth endpoints (token exchange, merchant onboarding)

Differs from the real API (7)

  • timings compressed: transactions settle at +3s, subscriptions bill a cycle every 2s
  • webhook registration exposed at POST /webhooks; real Braintree is Control Panel only
  • webhook deliveries are JSON + bt-* headers, not the real form-encoded bt_* POST
  • POST /graphql is served without the Bearer/Basic auth check the REST surface enforces
  • simulate_authorization_expiry sim-only flag: auths expire in 1s vs 7 simulated days
  • REST creates answer 200; real Braintree answers 201 Created
  • Client tokens are opaque strings, not the real base64 JSON encoding
want more of the Braintree GraphQL + REST API surface? adapters are YAML + Starlark — the authoring guide covers adding routes, fixtures, and state machines. Open an issue for anything big first, or just file a PR — merged routes ship in the next release.