Utilities for handling Gateway Just-in-Time (JIT) Funding requests.
When using Gateway JIT Funding, Marqeta sends a synchronous funding request to your gateway endpoint for every authorization. Your gateway must respond with an approval or denial within the configured timeout (typically 1.5–3 seconds).
Request Flow
Cardholder swipes card
↓
Network sends authorization to Marqeta
↓
Marqeta sends JIT request → YOUR GATEWAY (sync, ~1.5s timeout)
↓
Your gateway responds approve/deny
↓
Marqeta approves/declines the network authorization
↓
Marqeta sends async webhook notification (informative)JIT Methods
Actionable (require a funding response)
pgfs.authorization— standard purchase authorizationpgfs.authorization.account_verification— zero-dollar card validationpgfs.auth_plus_capture— single-message (PIN debit / ATM)pgfs.balance_inquiry— balance inquiry
Informative (no response needed — just acknowledge)
pgfs.authorization.capture— funds captured after authorizationpgfs.authorization.capture.chargeback— chargeback processedpgfs.authorization.reversal— authorization reversedpgfs.authorization.clearing— settlement completepgfs.adjustment.credit— credit adjustment appliedpgfs.adjustment.debit— debit adjustment applied
Examples
# In your gateway controller (Plug/Phoenix):
def handle(conn, params) do
alias Marqeta.GatewayJIT
response =
if GatewayJIT.actionable?(params) do
user_token = GatewayJIT.user_token(params)
amount = GatewayJIT.amount(params)
mcc = GatewayJIT.mcc(params)
cond do
blocked_mcc?(mcc) -> GatewayJIT.decline(params, reason: "TRANSACTION_NOT_PERMITTED")
insufficient?(user_token, amount) -> GatewayJIT.decline(params, reason: "INSUFFICIENT_FUNDS")
true -> GatewayJIT.approve(params)
end
else
# Informative — return a minimal acknowledgement
GatewayJIT.ack(params)
end
json(conn, response)
end
Summary
Functions
Returns true if this is a zero-dollar account verification.
Builds an acknowledgement response for informative JIT notifications.
Use this when actionable?/1 returns false.
Returns the acting user token (may differ from user_token in hierarchical accounts).
Returns true if the JIT request requires a funding decision response.
Returns the requested funding amount.
Builds an approval response for a JIT funding request.
Returns true if this is an ATM / single-message transaction.
Returns the card token from a JIT request.
Returns the merchant country from a JIT request.
Returns the currency code from a JIT request.
Builds a decline response for a JIT funding request.
List of all valid decline reasons.
Returns the MCC code from a JIT request.
Returns the merchant name from a JIT request.
Returns the JIT method string.
Returns the transaction type (e.g. "gpa.credit").
Returns the user token from a JIT request.
Functions
Returns true if this is a zero-dollar account verification.
Builds an acknowledgement response for informative JIT notifications.
Use this when actionable?/1 returns false.
Returns the acting user token (may differ from user_token in hierarchical accounts).
Returns true if the JIT request requires a funding decision response.
Returns the requested funding amount.
Builds an approval response for a JIT funding request.
Options
:amount— Override the approved amount (partial approval). Defaults to request amount.:memo— Optional memo string (max 99 chars).:metadata— Optional map of metadata (max 20 keys).:tags— Optional tags string.
Returns true if this is an ATM / single-message transaction.
Returns the card token from a JIT request.
Returns the merchant country from a JIT request.
Returns the currency code from a JIT request.
Builds a decline response for a JIT funding request.
Decline Reasons
"INSUFFICIENT_FUNDS""INVALID_MERCHANT""TRANSACTION_NOT_PERMITTED""SUSPECTED_FRAUD""DO_NOT_HONOR""CARD_NOT_ACTIVE""EXCEEDS_LIMIT"
Options
:reason— Decline reason string. Defaults to"DO_NOT_HONOR".:memo— Optional memo.
@spec decline_reasons() :: [String.t()]
List of all valid decline reasons.
Returns the MCC code from a JIT request.
Returns the merchant name from a JIT request.
Returns the JIT method string.
Returns the transaction type (e.g. "gpa.credit").
Returns the user token from a JIT request.