Quickstart
Complete a PIX deposit in staging with API v2. You need an EC P-256 key pair, a v2 credential registered in the Customer Portal, an allowed source IP and a publicly reachable HTTPS webhook. Nothing here moves real money.
The whole flow
Step 1 — Authenticate
Follow Authentication to generate the client_assertion, request a token and
implement the request-bound DPoP proof. Complete implementations are available in
Tokens and Signing requests.
export API="https://api.sdb.lbpay.com.br/v2"
export TOKEN="the_access_token_you_received"
Before each command below, generate a new proof for its exact HTTP method, URL, query and body,
then export it as DPOP_PROOF. A proof cannot be shared between two commands or retries.
Step 2 — Register your webhook
Deposits are confirmed asynchronously. Put the endpoint online before registering it: LB Pay probes the URL and rejects an unreachable or slow endpoint.
curl --request PUT \
--url "$API/webhook" \
--header "Authorization: DPoP $TOKEN" \
--header "DPoP: $DPOP_PROOF" \
--header 'content-type: application/json' \
--data '{
"url": "https://your-platform.example.com/webhooks/lbpay",
"type": 0,
"authenticationType": 1,
"authentication": { "type": "bearer", "token": "YOUR_WEBHOOK_TOKEN" },
"events": ["pixChargePaid", "pixChargeExpired"]
}'
The webhook token above is chosen by you and protects the endpoint where you receive notifications;
it is independent from LB Pay API authentication. Your endpoint must respond 2xx within five
seconds. Persist the event and process it asynchronously.
Step 3 — Create a deposit charge
Generate a new DPOP_PROOF for this exact body before sending it:
curl --request POST \
--url "$API/pix/deposit/immediate-charge" \
--header "Authorization: DPoP $TOKEN" \
--header "DPoP: $DPOP_PROOF" \
--header 'content-type: application/json' \
--data '{
"externalId": "3f2b1c4e-9a7d-4e21-b8f0-5c6d7e8a9b01",
"amount": 5000,
"expiresIn": 600,
"pixKey": "YOUR_OPERATOR_PIX_KEY",
"expectedPayer": { "taxId": "12345678909" }
}'
5000 means R$ 50.00 because monetary amounts are integer cents. Persist externalId before
sending the request: it is the operation's idempotency key. The response contains chargeId,
brCode and status PENDING.
Step 4 — Simulate the payment
The mock endpoint exists only in staging. Generate a new proof for this request and body:
curl --request POST \
--url "$API/pix/mock/simulate-payment" \
--header "Authorization: DPoP $TOKEN" \
--header "DPoP: $DPOP_PROOF" \
--header 'content-type: application/json' \
--data '{
"chargeId": "THE_CHARGE_ID_FROM_STEP_3",
"receiverCnpj": "YOUR_RECEIVING_CNPJ"
}'
Step 5 — Receive pixChargePaid
The platform retries webhook delivery. Deduplicate the event by endToEndId before crediting the
player, otherwise the same deposit can be credited more than once.
{
"event": "pixChargePaid",
"status": "paid",
"chargeId": "...",
"externalId": "3f2b1c4e-9a7d-4e21-b8f0-5c6d7e8a9b01",
"endToEndId": "E12345678202608181200abcdef12345",
"amount": 5000
}
If the event is delayed, query the charge with a fresh proof:
curl --request GET \
--url "$API/pix/deposit/immediate-charge/THE_CHARGE_ID" \
--header "Authorization: DPoP $TOKEN" \
--header "DPoP: $DPOP_PROOF"