What sandbox can do for fundings
In sandbox, a funding has one transition, and you make it yourself with the advance call,POST /v2/simulate/fundings/{funding_id}/advance, which moves one of your own objects to the status you name.
The advance call moves the funding to
posted, and Lead posts the funding user credit transaction, as it would in production. To see the result, retrieve the funding. If funding events are enabled for your program (your Technical Account Manager can tell you), Lead also sends funding.posted. The event names the funding without carrying it, so you still retrieve it to read the result. See Webhooks & Events.
There are no outside events to trigger for a funding (no simulate scenarios), because nothing outside Lead acts on one.
What sandbox doesn’t do for fundings
Three things a posted funding does in production don’t happen in sandbox:- Move money. A funding posted in sandbox has no
core_transaction_id. In production it names the core transaction that moved the money. - Change core balances. Core balances and core transactions return fixed sample data in sandbox. See Core objects in sandbox, in the shared API section.
- Post a funding on its own. A new funding stays
processinguntil you move it.
Test run
Run these in order againsthttps://api.sandbox.lead.bank. Each item ends with what to check before you move on.
-
Get an access token with
entity/read_write,application/read_write,user_account/read_write,user_credit_balance/read_write, andfunding/read_write. Each scope is listed on Authentication. Confirm: the response is200with anaccess_token. If your program isn’t set up for one of the scopes, the request fails withinsufficient_scopeinstead. -
Create an entity, an application, and a user account with a credit feature. Then create a
non_revolvinguser credit balance. Originate your first loan has each payload. Confirm: the user credit balance isactive, and you have the ID of the account number Lead enabled for fundings. -
Create a funding with
POST /v2/fundingsand anIdempotency-Keyheader. Store the funding ID. Confirm:statusisprocessing. -
Move it to
postedwith the advance call,POST /v2/simulate/fundings/{funding_id}/advance, a newIdempotency-Key, and{"next_status": "posted"}. Confirm:200with an empty object. -
Retrieve the funding.
Confirm:
statusisposted. If funding events are enabled for your program, afunding.postedwebhook arrived too. -
Retrieve the user credit balance. The
fundinguser credit transaction can post a few seconds after the funding does, so retry ifamount_breakdown.principalhasn’t changed yet. Confirm:amount_breakdown.principalincludes the funding’samount. -
Call advance on the same funding again, with a new
Idempotency-Key. Confirm:422withobject_state_mismatched, and the funding doesn’t change. -
Repeat item 3 with the same
Idempotency-Keyand the same body. Confirm: the response is the one from item 3, withstatusstillprocessingand the headerIdempotency-Replayed: true. The funding itself is stillposted. -
Create a second funding on the same balance with an
amountlarger than the remaining room underterms.max_funding_amount. Confirm:422withlimit_exceeded, and no funding is created.
Before you go live
Before your first production funding, make sure that:- Know which account number Lead has enabled to receive your fundings. Your Technical Account Manager can tell you.
- Get a production token with the
funding/read_writescope. - Store every funding ID when you create it. There’s no endpoint to list fundings. To reconcile later, use the stored IDs, or list the user credit transactions with a
funding_id. - Retrieve the funding and confirm
statusispostedbefore you send the money on to the borrower. A200on create means Lead accepted the funding, not that the money moved. Thefundinguser credit transaction can arrive a few seconds later.
Related
- Move objects and trigger events in sandbox: the two sandbox-only calls, their rules, and their errors
- Fundings overview: what a funding is and where it fits in a lending integration
- Funding statuses: the two statuses and how to tell when money moved
- Originate and service an on-sheet loan: the full lending flow a funding belongs to
- Program launch: the milestones from kickoff through sandbox testing to go-live

