- The different types of funding and network messages, and when they are used.
- Best practices for ledger management with single- and dual-message transactions.
- JIT Funding transaction flows for dual-message and single-message transactions.
- The impact of funding and network messages on ledger management.
- How to associate events using tokens and webhooks.
- The impact of timeouts and other errors on ledger management.
Note
This guide covers ledger management when using JIT Funding. If your program uses standard funding, you can see the real-time balance of GPA ledgers by sending a
This guide covers ledger management when using JIT Funding. If your program uses standard funding, you can see the real-time balance of GPA ledgers by sending a
GET request to the /balances endpoint. For details, see the Balances API reference.Funding and network message values
The following values in funding and network messages are helpful when making a JIT decision related to funding a transaction and adjusting the ledger. They apply to both dual- and single-message transaction:| Field | Description |
|---|---|
gpa_order.jit_funding.amount | JIT Funding requests contain several fields with different amounts. When considering whether or not to approve a transaction, you can use the value in the gpa_order.jit_funding.amount field to inform your decision, as this value contains the amount that must be funded if the transaction is to be approved. |
impacted_amount | Multiple amount fields are shown in webhooks. When you receive a webhook confirming a transaction, you can use the value shown in the impacted_amount attribute to adjust the ledger. Based on the transaction type, the attribute will indicate whether there is a positive or negative impact on the ledger. |
Dual-message transactions
Dual-message transactions, such as requiring a signature during a card present transaction, have separate funding messages for authorization and other event types, and also require a clearing message to complete the transaction.- The initial funding message creates a pending transaction in the cardholder account.
- An advice message contains additional information about the total amount of a pending transaction. When a merchant sends an advice message, the recipient must acknowledge the receipt of the advice message with an advice response message. See also the definition of advice on the Payment Cards Concepts page.
JIT Funding transaction flows
Approvals
This following sequence shows you a successful processing flow for a dual-message transaction that has been approved by your system.Your system receives an actionable funding message from a merchant requesting authorization for a transaction on your JIT gateway endpoint.
Your system authorizes the transaction and sends a
200 JIT Funding approval response to the Marqeta platform.The Marqeta platform sends a network message (in the form of a webhook) to your webhook endpoint, confirming successful processing of the transaction. The transaction will show as
pending in the webhook status field, confirming that no issues occurred when processing the transaction that your system approved for funding.NOTE: The temporary hold on the cardholder’s available balance at the time of the JIT Funding approval response will remain in place until the clearing records are processed. Therefore, you do not need to make adjustments to ledger balances at this time.The Marqeta platform later receives batch clearing records from the card network that contain information about the funds needed to clear the transactions that your system previously approved.
When the transaction has cleared, the Marqeta system will send a clearing network message as a webhook to the
transaction.authorization.clearing endpoint.Declines
Your system receives an actionable JIT Funding authorization request message (i.e., funding message) on your JIT gateway endpoint.
Your system declines the transaction and sends a
402 JIT Funding decline response to the Marqeta platform. At this time, you do not need to perform any ledger management.Webhook authorization declines
In some cases, you might receive a network message (i.e., a webhook) indicating that the JIT Funding request has been declined even though you have approved the transaction. This can happen when there is a processing error either at Marqeta or with the card network. Declines can also occur when the approval from your system is not received within the required three-second interval and the transaction times out. In both of these situations, your system will place a temporary hold on the cardholder’s available balance, as the transaction was approved by your system prior to encountering the processing error. In these cases, you should remove the initial hold that was placed on the cardholder’s available balance to ensure that their purchasing power is not impacted by the declined transaction. For more information, see Timeouts below.Single-message transactions
Single-message transactions use only one message, sent at the time of the transaction, to convey information about both authorization decisions and clearing. The majority of single-message transactions are either debit card or PIN transactions, also known as “pin debit” transactions.Ledger management and JIT Funding messages
The ledger can be impacted when JIT Funding messages are received by your gateway endpoint.Approval messages
When your gateway endpoint receives and approves an actionable pindebit JIT Funding request, your system sends a200 funding approval message to Marqeta. When the funding approval message is sent, your system immediately places a temporary hold on the cardholder’s available balance for the amount of the transaction so that the ledger accurately reflects the cardholder’s purchasing power.
Decline messages
When your gateway endpoint receives an actionable pindebit JIT Funding request and responds with a402 decline message, no ledger management is required, as it is your system that declined the funding request. You will receive a webhook from transaction.authorization confirming the decline, with declined as the webhook status.
Ledger management and network messages
Network messages (i.e., webhooks) are sent to your JIT gateway after Marqeta receives a response either approving or declining a transaction.Webhook approvals
When Marqeta receives your JIT Funding approval message, the Marqeta platform begins processing the transaction. When transaction processing is complete, the card network relays a network webhook to your webhook endpoint attransaction.pindebit, confirming that the transaction has been successfully processed. The corresponding webhook will have a value of completed in the status field if there were no issues with the Marqeta platform or the card network during processing.
Single-message transactions are considered to be completed when you receive the webhook confirmation. At that time, you should complete the movement of funds by removing the temporary hold from the cardholder’s available balance so that the amount of the transaction is deducted from the cardholder’s current balance.
Webhook declines
Occasionally, you might receive a network message (i.e., webhook) stating that Marqeta has declined a transaction even though you sent Marqeta a JIT Funding approval. This type of decline can happen when there is a processing error with either Marqeta or the card network, or if you did not send a response within the required three-second interval, resulting in a timeout. When this happens, you must reverse the temporary hold that you placed on the cardholder’s available balance to ensure that the cardholder’s purchasing power is not affected by the declined transaction.Associating events
You can use tokens to associate transaction events over time. Associating events is particularly useful when you want to accurately manage or adjust cardholder balances after a dual-message or three-chain transaction. The two main types of tokens that you can use to correlate events are as follows:| Token Type | Description |
|---|---|
| Preceding related transaction token | Use this attribute to correlate a following event (for example, authorization.clearing) with its corresponding originating event, such as an authorization.NOTE: Marqeta does not automatically associate events using the preceding_related_transaction_token for all transaction scenarios due to limited matching logic from the card networks. For more information, contact your Marqeta representative. |
| Original JIT Funding token | The first associated JIT Funding message creates a token that you can use to associate JIT Funding messages related to the initial message using the same GPA order. This field is not included in the first of any set of related messages. |
Timeouts
A timeout by your JIT gateway, the Marqeta platform, or the card network can impact transaction processing. For more information on how to handle this situation, see the Managing Timeouts guide.JIT gateway timeouts
Transaction approvals can time out if Marqeta sends an approval response to your funding request outside of the constraints of the API’s duration. Use webhooks to confirm that the approval response from Marqeta has been recorded in the ledger as an approval, rather than a decline due to a timeout. Check the body of the webhook body for a value of true in thegateway_log.timed_out field to confirm that the JIT Funding request timed out.
Marqeta platform or card network timeouts
The following codes are examples of decline codes that you might receive if a processing error occurs with a Marqeta-specific application, or if there is a connectivity error with the card network. For the full list of supported decline codes, see Transaction response codes.| Decline Code | Message |
|---|---|
1878 | Corresponding JIT load failure. |
1842 | Account load failed. |
1844 | The card network has advised of a decline. |
Account ledgers
An account ledger is the system of record that keeps track of all transactions that occur on a user or business account. It is important to keep an account ledger current as it provides an accurate record of money movement and balances needed to make real-time funding decisions. The level of ledger management the Marqeta platform provides depends on the type of funding model your program uses. For standard funding, Marqeta maintains general purpose account (GPA) ledgers. For JIT Funding, your business maintains its own account ledgers and updates them using transaction data Marqeta sends in JIT Funding messages. The following sections cover these topics:- How the three JIT Funding messages types relate to your ledger.
- How to use information in JIT Funding messages to help manage your ledger.
- Which transaction events impact the ledger.
- Balances in JIT Funding responses.
- Best practices for ledger maintenance.
JIT Funding message types
There are three types of JIT Funding messages that the Marqeta platform and your system exchange. For Gateway JIT, all three messages are exchanged. For Managed JIT, only JIT Funding notifications are sent.- JIT Funding requests – For Gateway JIT, the Marqeta platform sends these messages to your gateway endpoint to request permission to fund a transaction or to make a balance inquiry. These messages contain transaction data you can use to help manage your account ledgers.
- JIT Funding responses – For Gateway JIT, your gateway sends these messages to the Marqeta platform in response to a funding request or balance inquiry. To accurately respond to a balance inquiry, your ledger must be current. For details, see Balances in Gateway JIT Funding responses later on this page.
- JIT Funding notifications – For Gateway and Managed JIT, these are informative messages sent by the Marqeta platform to your webhook endpoint. These messages contain transaction data you can use to help manage your account ledgers.
Transaction data for ledger management
Certain transaction events impact your account ledgers. In these cases, you can update the account balances using the transaction data sent in JIT Funding messages to your gateway and webhook endpoints. For Gateway JIT, the JIT Funding message type, actionable or informative, does not indicate whether the transaction impacts the ledger, as both can. For details, see the Gateway JIT Funding Messages API reference.Transaction event type
Use thetype field to identify the transaction event type and whether it impacts the ledger. For a list of all transaction events that impact ledgers and how, see Ledger-impacting transaction events later on this page.
Impacted amount
The impacted amount represents the positive or negative amount a transaction impacts the ledger. Use theimpacted_amount field, embedded in the gpa object, to determine the amount impacted and whether it is positive or negative. A minus symbol ( - ) indicates a negative impact. Update your account balances accordingly.
The following code block shows a sample gpa object with a negative ledger impact of 10.00 USD as it would appear in a JIT Funding request or notification:
JSON
Amount
Anamount field can appear in different objects representing different amount types. The amount field representing the transaction amount is embedded directly in the JIT Funding message as transaction.amount.
Method
The method represents the program gateway funding source (PGFS) method. Use themethod field, embedded in the jit_funding object, to determine the JIT Funding method used.
The following code block shows a sample JIT Funding request containing an authorization transaction of $10.00 that impacts the ledger by -10.00 USD:
JSON
Ledger-impacting transaction events
The following table indicates how certain transaction event types impact the ledger. A negative impact on the ledger means the transaction event removed funds from the account, and a positive impact means the transaction event added funds. The Sent To detail indicates to which endpoint the JIT Funding message was sent. The Event Type detail indicates whether the transaction event was sent in a temporary transaction message or a final transaction message. For more on temporary and final transactions, see Transactions in the payments ecosystem and The transaction lifecycle in the About Transactions guide. For the descriptions of transaction events, see Transaction events in the Event Types API reference.| Type | PGFS Method | Event Details |
|---|---|---|
account.funding.authorization | pgfs.authorization | Sent to: Your gateway endpoint, your webhook endpoint Event type: Temporary Ledger impact: Negative |
account.funding.authorization.clearing | pgfs.authorization.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
account.funding.auth_plus_capture | pgfs.auth_plus_capture | Sent to: Your gateway endpoint, your webhook endpoint Event type: Final Ledger impact: Negative |
account.funding.authorization.reversal | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
account.funding.auth_plus_capture.reversal | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
authorization | pgfs.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Negative |
authorization.advice | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Positive |
authorization.atm.withdrawal | pgfs.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Negative |
authorization.cashback | pgfs.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Negative |
authorization.clearing | pgfs.authorization.capturepgfs.force_capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
authorization.clearing.atm.withdrawal | pgfs.authorization.capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Negative |
authorization.clearing.chargeback | pgfs.authorization.capture.chargeback | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Positive, if credit_user is trueNone, if credit_user is false |
authorization.clearing.chargeback.completed | pgfs.authorization.capture.chargeback | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
authorization.clearing.chargeback.provisional.credit | pgfs.authorization.capture.chargeback | Sent to: Your webhook endpoint Event type: Final, requires settlement Ledger impact: Positive |
authorization.clearing.chargeback.provisional.debit | pgfs.authorization.capture.chargeback.reversal | Sent to: Your webhook endpoint Event type: Final, requires settlement Ledger impact: Negative |
authorization.clearing.chargeback.reversal | pgfs.authorization.capture.chargeback.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative, if credit_user is trueNone, if credit_user is false |
authorization.clearing.chargeback.writeoff | pgfs.authorization.capture.chargeback | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
authorization.clearing.representment | pgfs.authorization.capture.chargeback.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative, if credit_user is trueNone, if credit_user is false and representment amount equals original amountPositive, if credit_user is false and representment amount is less than original amount |
authorization.incremental | pgfs.authorization.incremental | Sent to: Your gateway endpoint Event type: Temporary, requires settlement Ledger impact: Negative |
authorization.clearing.quasi.cash | pgfs.authorization.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
authorization.clearing.cashback | pgfs.authorization.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
authorization.quasi.cash | pgfs.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Negative |
authorization.reversal | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Positive |
authorization.reversal.issuerexpiration | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Positive |
billpayment.capture | pgfs.billpayment.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
billpayment.reversal | pgfs.billpayment.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
gpa.credit | pgfs.adjustment.credit | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
gpa.debit | pgfs.adjustment.debit | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
original.credit.authorization | pgfs.original.credit.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Positive |
original.credit.authorization.reversal | pgfs.original.credit.authorization.reversal | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Negative |
original.credit.authorization.clearing | pgfs.original.credit.authorization.clearing | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
original.credit.auth_plus_capture | pgfs.original.credit.auth_plus_capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Positive |
original.credit.auth_plus_capture.reversal | pgfs.original.credit.auth_plus_capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
pindebit | pgfs.auth_plus_capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Negative |
pindebit.atm.withdrawal | pgfs.auth_plus_capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Negative |
pindebit.authorization | pgfs.authorization | Sent to: Your gateway endpoint Event type: Temporary Ledger impact: Negative |
pindebit.authorization.clearing | pgfs.authorization.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
pindebit.authorization.reversal.issuerexpiration | pgfs.authorization.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
pindebit.cashback | pgfs.auth_plus_capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Negative |
pindebit.chargeback | pgfs.pindebit.chargeback | Sent to: Your webhook endpoint Event type: Temporary Ledger impact: Positive, if credit_user is trueNone, if credit_user is false |
pindebit.chargeback.completed | none | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
pindebit.chargeback.reversal | pgfs.pindebit.chargeback.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative, if credit_user is trueNone, if credit_user is false |
pindebit.chargeback.writeoff | none | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
pindebit.credit.adjustment | pgfs.authorization.capture | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
pindebit.quasi.cash | pgfs.auth_plus_capture | Sent to: Your gateway endpoint Event type: Final Ledger impact: Negative |
pindebit.refund | pgfs.refund | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
pindebit.refund.reversal | pgfs.refund.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Negative |
pindebit.reversal | pgfs.auth_plus_capture.reversal | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
refund | pgfs.refund | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
refund.authorization.clearing | pgfs.refund | Sent to: Your webhook endpoint Event type: Final Ledger impact: Positive |
Example chargeback scenario
The following code blocks show sample webhook notifications as they would appear in a scenario where a chargeback with provisional credit was initiated and the case was lost. For more on chargebacks and chargeback transitions, see the About Disputes guide and Chargeback transition events in the Event Types API reference.Chargeback authorization
The following code block shows a sample webhook notification for a chargeback authorization of 12.50 USD, for which the cardholder is given a provisional credit:JSON
-
The
typevalue ofauthorization.clearing.chargebackshows that a chargeback was initiated. -
The
tokenvalue shows that the unique identifier of the chargeback is 1927. -
The
preceding_related_transaction_tokenshows that the unique identifier of the disputed transaction is 1925. -
The
amountvalue shows that the chargeback amount is 12.50. -
The
currency_codevalue shows that the chargeback amount is in USD. -
The
gpa.impacted_amountvalue shows that the chargeback has a positive impact on the ledger by 12.50. -
The
gpa.currency_codevalue shows that the ledger impact amount is in USD. -
The
credit_userfield set totrueshows that the cardholder was given a provisional credit.
Chargeback transition
Sent with the chargeback authorization, the following code block shows a sample webhook notification sent because the chargeback was initiated:JSON
-
The
statevalue shows that the chargeback is currently in an initiated state. -
The
transaction_tokenvalue shows that the unique identifier of the transaction responsible for the chargeback transition is 1927, the chargeback authorization. -
The
typevalue ofinitiatedshows that the chargeback has been created.
Chargeback reversal
The following code block shows a sample webhook notification for a chargeback reversal of 12.50 USD, sent because the cardholder lost the chargeback case, which reversed the provisional credit given when the chargeback was initiated:JSON
-
The
typevalue ofauthorization.clearing.chargeback.reversalshows that the chargeback authorization was reversed. -
The
tokenvalue shows that the unique identifier of the chargeback reversal is 1929. -
The
preceding_related_transaction_tokenshows that the unique identifier of the chargeback authorization, the related transaction preceding the chargeback reversal, is 1927. -
The
gpa.impacted_amountvalue shows that the chargeback reversal has a negative impact on the ledger by 12.50. -
The
gpa.currency_codevalue shows that the impacted amount is in USD. -
The
gpa_order.jit_funding.methodvalue ofpgfs.authorization.capture.chargeback.reversalshows that the chargeback authorization was reversed, debiting funds from the funding source. -
The
chargeback.transaction_tokenshows that the unique identifier of the chargeback authorization is 1925.
Chargeback transition
Sent with the chargeback reversal, the following code block shows a sample webhook notification sent because the chargeback transitioned to a case lost state:JSON
-
The
statevalue shows that the chargeback is currently in a case lost state. -
The
previous_statevalue shows that the chargeback transitioned to its current state from an initiated state. -
The
transaction_tokenvalue shows that the unique identifier of the transaction responsible for the chargeback transition is 1929, the chargeback reversal. -
The
typevalue ofcase.lostshows that the chargeback case was lost.
Balances in Gateway JIT Funding responses
In response to a balance inquiry or withdrawal made at an ATM, your gateway sends a JIT Funding response to the Marqeta platform containing thebalances object, which contains information about the account’s balances by currency. To ensure your JIT Funding responses are accurate and up-to-date, keep your account ledgers current.
To ensure your JIT Funding response body adheres to the Marqeta platform’s specifications, see JIT Funding responses in the Gateway JIT Funding Messages API reference.
The balances object
Populate thebalances object, embedded in the jit_funding object, with the following information from your account ledgers:
-
Currency code – Set the
currency_codevalue to the three-digit ISO 4217 currency type of the balance, such as USD. -
Ledger balance – Set the
ledger_balancevalue to the funds available to spend immediately from the account, including any funds from authorized transactions that have not yet cleared. -
Available balance – Set the
available_balancevalue to the amount of the ledger balance minus any authorized transactions that have not yet cleared on the account. The ATM displays this amount as the balance. -
Pending credits – Set the
pending_creditsvalue to the amount of the ACH loads that have been accepted, but for which the funding time has not yet elapsed.
balances object with a ledger balance and available balance of 100.00 USD as it would appear in a JIT Funding response to a balance inquiry made at an ATM:
JSON
Best practices for ledger maintenance
The following best practices can help keep your ledger current:-
Subscribe to all transaction event types when configuring your webhook endpoint and use the
created_timefield to determine what order the transactions were created. For details, see the About Webhooks guide. - Follow Generally Accepted Accounting Principles (GAAP) to know when, where, and why money moves out of accounts.
- Reconcile all transactions, especially force-post or offline transactions.
- Keep a backup of the ledger in the cloud or keep a hard copy on a paper spreadsheet.