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.
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.
- 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
- Read the Core API Quick Start.
- Read About Just-in-Time Funding.
Concepts
JIT Funding
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
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.
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.
/fundingsources/program endpoint, see Program Funding Sources.
Card product configuration
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. For a complete description of the/cardproducts endpoint, see Card Products.
Tutorial
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 inline 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
To define the bank account from which funds are drawn for transactions, create a program funding source. Send aPOST request to the /fundingsources/program endpoint to create a new program funding source.
JSON
Step 2 — Create a card product
To define attributes and behaviors for a set of cards, create a card product. Theprogram_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.
JSON
Step 3 — Create a user
Before you create a new card, you must create a user who will own the card. Send aPOST request to the /users endpoint to create a new user.
JSON
Step 4 — Create a card
To enable the user to spend funds, create a card. Use the card product and user tokens you created in this tutorial. Send aPOST request to the /cards endpoint to create a new card.
JSON
Step 5 — Simulate a transaction
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 aPOST request to the /simulations/cardtransactions/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.)
JSON
Step 6 — Review the transaction
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 agpa_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.
JSON