Configuring Managed JIT Funding
You can programmatically fund accounts at transaction time by configuring your cards to use Managed Just-in-Time (JIT) Funding. A card configured for Managed JIT Funding requires a card product associated with a program funding source.
Note
The sandbox environment allows you to create and configure the resources required for a Managed JIT Funding setup. To implement these configurations in a production environment, contact your Marqeta representative.At the end of this guide, you should understand:
-
The role of the program funding source in Managed JIT Funding.
-
How to create a card for an account funded by Managed JIT Funding.
-
How to simulate a transaction with a card.
Prerequisites
Copy section link
-
Read the Core API Quick Start.
Concepts
Copy section link
JIT Funding
Copy section link
JIT Funding automates the loading of funds into accounts in real time during the transaction process. In a Managed JIT Funding setup, the Marqeta platform handles all authorization decisions using spend controls configured at the card product or card level. Funds are drawn from the program funding source of the card product.
For more information about JIT Funding, see About Just-in-Time Funding.
For more information about spend controls, see Controlling Spending.
The program funding source
Copy section link
A program funding source represents a bank account from which funds are drawn for JIT-funded transactions. In the sandbox environment, each program funding source simulates funds for your test transactions. In a production environment, each program funding source draws from the bank account you set up in conjunction with Marqeta.
Note
Your program funding source must be approved by Marqeta and the issuing bank. If you are using a third-party service to collect user funds, Marqeta and the issuing bank require specific reporting to ensure compliance with all rules and regulations. Contact your Marqeta representative for more information.For a complete description of the /fundingsources/program
endpoint, see Program Funding Sources.
Card product configuration
Copy section link
A card product defines the attributes and behaviors of a set of cards. Managed JIT Funding setups require you to create a card product associated with a program funding source. Each card product can have a single funding source, which funds all transactions conducted using an associated card.
Tip
You can create and configure card products in the sandbox environment. To create a new card product in production, contact your Marqeta representative for more information.For a complete description of the /cardproducts
endpoint, see Card Products.
Tutorial
Copy section link
The following tutorial walks you through creating and testing the resources required for a Managed JIT Funding setup. In this scenario, you will create a card configured for Managed JIT Funding, use it to simulate a transaction, and review the transaction record.
Some steps include a code block with a JSON-formatted sample message body. To follow along with the tutorial, you must sign in to Marqeta.com. For each step, copy the code sample and paste it into the body field of the provided API Explorer widget. Replace any placeholder text with your sample data, then select Submit Request.
For the sake of clarity and simplicity, this tutorial does not include steps for creating spend controls. For a tutorial on creating spend controls, see the Controlling Spending tutorial.
Step 1 — Create a program funding source
Copy section link
To define the bank account from which funds are drawn for transactions, create a program funding source.
Send a POST
request to the /fundingsources/program
endpoint to create a new program funding source.
Step 2 — Create a card product
Copy section link
To define attributes and behaviors for a set of cards, create a card product.
The program_funding_source
object defines the funding source used by the card product.
In this scenario, you’ll use the program funding source you created in Step 1.
Send a POST
request to the /cardproducts
endpoint to create a new card product.
Step 3 — Create a user
Copy section link
Before you create a new card, you must create a user who will own the card.
Send a POST
request to the /users
endpoint to create a new user.
Step 4 — Create a card
Copy section link
To enable the user to spend funds, create a card. Use the card product and user tokens you created in this tutorial.
Send a POST
request to the /cards
endpoint to create a new card.
Step 5 — Simulate a transaction
Copy section link
Now that you have created a card, you can use it to simulate a transaction. Use the card token you created in this tutorial.
Send a POST
request to the /simulate/authorization
endpoint to simulate a transaction.
In the webhook.endpoint
field, include a URL that points to a webhook endpoint on your system or another mock endpoint you create.
(You can use a mock endpoint service like https://www.beeceptor.com to receive webhook notifications from the sandbox environment.)
Step 6 — Review the transaction
Copy section link
After you simulate the transaction, your webhook endpoint should receive a notification message containing the details of the transaction, including the Marqeta platform’s funding decision.
The following is a sample transaction notification based on the transaction you simulated in the previous step.
Note that it includes a gpa_order
object, which indicates that this transaction used JIT Funding.
The gpa_order.funding.source.type
field is "program", meaning that this transaction used Managed JIT Funding.
The transaction also contains the tokens of the user, card, and funding source you created.