Skip to main content
Use this page twice: once while you test fundings in sandbox, and again before your first real funding. The calls that move a funding in sandbox are on Move objects and trigger events in sandbox. Program launch has the milestones for the whole program, and the Fundings overview explains what a funding is.

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 processing until you move it.

Test run

Run these in order against https://api.sandbox.lead.bank. Each item ends with what to check before you move on.
  1. Get an access token with entity/read_write, application/read_write, user_account/read_write, user_credit_balance/read_write, and funding/read_write. Each scope is listed on Authentication. Confirm: the response is 200 with an access_token. If your program isn’t set up for one of the scopes, the request fails with insufficient_scope instead.
  2. Create an entity, an application, and a user account with a credit feature. Then create a non_revolving user credit balance. Originate your first loan has each payload. Confirm: the user credit balance is active, and you have the ID of the account number Lead enabled for fundings.
  3. Create a funding with POST /v2/fundings and an Idempotency-Key header. Store the funding ID. Confirm: status is processing.
  4. Move it to posted with the advance call, POST /v2/simulate/fundings/{funding_id}/advance, a new Idempotency-Key, and {"next_status": "posted"}. Confirm: 200 with an empty object.
  5. Retrieve the funding. Confirm: status is posted. If funding events are enabled for your program, a funding.posted webhook arrived too.
  6. Retrieve the user credit balance. The funding user credit transaction can post a few seconds after the funding does, so retry if amount_breakdown.principal hasn’t changed yet. Confirm: amount_breakdown.principal includes the funding’s amount.
  7. Call advance on the same funding again, with a new Idempotency-Key. Confirm: 422 with object_state_mismatched, and the funding doesn’t change.
  8. Repeat item 3 with the same Idempotency-Key and the same body. Confirm: the response is the one from item 3, with status still processing and the header Idempotency-Replayed: true. The funding itself is still posted.
  9. Create a second funding on the same balance with an amount larger than the remaining room under terms.max_funding_amount. Confirm: 422 with limit_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_write scope.
  • 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 status is posted before you send the money on to the borrower. A 200 on create means Lead accepted the funding, not that the money moved. The funding user credit transaction can arrive a few seconds later.
The rest of the go-live checklist is on Program launch.