Skip to navigation

Debit-card funding

View as Markdown

NinjaTrader Connect supports deposits from an approved saved debit card. The flow uses Stripe in the user’s client and NinjaTrader’s live REST API. For deposits funded with Apple Pay or Google Pay, see Wallet Pay Funding.

These endpoints are Live-only. Do not send them to the Demo base URL.

Prerequisites

Your integration needs:

  • a bearer access token for the user
  • the user’s eligible live accountId, user ID, and the USD currencyId
  • Stripe.js or an applicable Stripe client integration

Complete the funding disclosures

Before the saved-card flow, the user must review and sign both funding disclosures:

  1. Form of Risk Disclosure and Customer Authorization
  2. Payment Processor Disclosure and Authorization

Both disclosures must be signed, but the signing order is not enforced. addStripeDebitCard and startStripeFunding reject requests when either disclosure is missing. Use the published signUserDocument operation by following Funding disclosures. If you prefer a hosted signing and funding flow, see Embedding the Funding Page with an iframe.

Get the Stripe publishable key

Call getStripeConfiguration to obtain the Stripe publishable key. Never send Stripe secret keys to the browser.

Check eligibility and limits

Call checkStripeFundingEligibility before the saved-card flow:

{
"accountId": 123456,
"currencyId": 1
}

Use the returned minimumAmount and maximumAmount for the amount UI. Do not hard-code them. To validate a specific deposit, repeat the request with amount.

Stop when errorText is non-empty. While a deposit is still Pending, Suspended, Locked, or InTransit, a check without amount returns a maximumAmount lowered by that deposit’s amount, and an amount-specific check that is otherwise within limits returns a non-empty errorText and no maximumAmount. Reconcile that deposit and wait for it to settle instead of retrying.

Saved debit-card flow

  1. Before registering the card, call stripeFundingMethodDependents with the user’s ID:

    GET /v1/stripeFundingMethod/deps?masterid=654321

    If the result already contains a non-archived record with status: Approved, don’t call addStripeDebitCard. A user can have only one non-archived approved funding method. To fund from the saved card, use that record’s numeric id as fundingMethodId and continue to the Start Stripe Funding/Withdrawal section below. To replace it, call deleteStripeFundingMethod, read stripeFundingMethod/deps again, and confirm that the same numeric id now has archived: true and is no longer a non-archived approved method before continuing.

    Otherwise, record the numeric id of every existing funding method so you can identify the new record later.

  2. Use Stripe.js in the user’s browser to collect the billing details and create a Stripe PaymentMethod.

  3. Call addStripeDebitCard with the Stripe string PaymentMethod ID:

    {
    "accountId": 123456,
    "stripePaymentMethodId": "pm_example"
    }
  4. If the response is HTTP 429 or contains a p-ticket, stop, do not retry with the ticket, and follow Rate limits and Penalty tickets.

  5. Inspect the final registration response to choose the next step. Do not use errorText as the branch discriminator:

    ResponseANI resultNext step
    {}PassRegistration is complete; resolve the approved numeric ID
    Contains last4, nameOnCard, and numeric stripeFundingMethodIdNot approved; the method is pendingStop; do not call startStripeFunding. Use the NinjaTrader-hosted funding flow or contact NinjaTrader support
    Non-empty errorText, or another response shapeRegistration failedStop; do not call startStripeFunding

Resolve the approved funding-method ID

After addStripeDebitCard returns {}, call stripeFundingMethodDependents again with the same request. Compare the result with the IDs captured before registration. Continue only when there is exactly one new record and it has status: Approved.

Use the new record’s numeric id as fundingMethodId. Do not use Stripe’s pm_... identifier as the funding-method ID.

If there are zero or multiple new records, or the one new record is not Approved, stop the API flow. Do not call startStripeFunding or call addStripeDebitCard again for the same card. Use the NinjaTrader-hosted funding flow or contact NinjaTrader support.

Start Stripe Funding/Withdrawal

Call startStripeFunding with NinjaTrader’s approved numeric ID:

{
"accountId": 123456,
"amount": 250,
"currencyId": 1,
"fundingMethodId": 98765
}

Before sending this request, and to reconcile the deposit afterward, follow Reconcile the funding outcome.

Next steps