Custodial Funding Protocol

The Immersve Custodial funding protocol allows client applications to authorize Immersve card payments in real-time using their own ledger.

Protocol Mechanics

On-Chain Pooled Float

The custodian deposits a "float" into an Immersve smart contract in order to cover the anticipated cardholder payments. The available balance of the float is adjusted in real-time according to cardholder payments. When the available balance drops to zero then all cardholder payments will be declined. Settlements are handled automatically by Immersve by drawing on the float.

Webhook Payment Messages

Card payment authorization requests and other payment lifecycle events are actioned by delegating to the custodian's webhook endpoints.

Partner Setup

A Funding Channel must be created using the Create A Funding Channel endpoint. The funding channel should have a funding type of custodial-usdc.

Cardholder Setup

A funding source must be created for each Cardholder using the Create A Funding Source For An Account endpoint. An externalId field must be supplied which can be correlated to a user's custodial ledger account. The externalId field will be supplied with every webhook notification for payments relating to the funding source.

Webhooks

Authentication

Webhooks are authenticated by an RSA signature. The signature is made against the contatenation of the request headers and body like {requestId}:{keyId}:{body}. The signature is provided in the X-Signature header.

Headers

HeaderDescription
X-Request-IdUnique request identifier.
X-Key-IdThe id of the signing key used to generate the signature.
X-SignatureThe RSA SHA256 signature of the request.

Idempotency

Notification messages are guaranteed to be delivered. When message delivery fails, delivery will be retried at an exponentially increasing interval. Authorization messages are not retried; if an authorization message fails a cancel message will be sent instead.

Authorize Payment Webhook

DescriptionA real-time instruction to authorize a payment.
MethodPOST
URL{base_url}/authorize

The authorization webhook is called when a merchant requests payment from the card.

The authorization request is expected to respond within ~1.5 seconds. Unresponsive authoriation requests will be canceled.

Response Format

The authorize response must contain a JSON object with the following fields.

FieldExampleDescription
authorizedtrueThe authorization request was granted.

Cancel Payment Webhook

DescriptionAn instruction to cancel a payment authorization.
MethodPOST
URL{base_url}/cancel

Immersve will send a cancel payment instruction incase an error has occured while handling an authorization request.

Adjust Balance Webhook

DescriptionAn instruction to adjust the balance on a custodial funding source.
MethodPOST
URL{base_url}/balance-adjustment

A balance adjustment instruction will be sent in several scenarios: when a payment is cleared for an amount greater or less than the authorized amount; when a payment is reversed or expired; or when a refund has been issued.

The integrated client must accept the balance adjustment and increment or decrement the funding source balance accordingly.

Request Body Format

All custodial webhook endpoints share the same message body format. The request content type is application/json.

FieldExampleDescription
cardholderAccountIdabc123Immersve cardholder account id.
fundingSourceExternalIdabc123The client user ref stored on the Immersve funding source.
fundingSourceIdabc123Immersve funding source identifier.
cardIdabc123Immersve card identifier.
amount1312Required payment amount in minor units.
currencyUSDRequired payment currency.
idempotencyKeyabc123Identifier which is used to detect duplicate messages.
messageTypeauthorizeThe type of webhook message: authorize, cancel, adjust-balance.
acquirerAmount1000The merchant's requested payment amount in minor units. This value is for information only.
acquirerCurrencyGBPThe merchant's requested payment currency.
merchantCityAuckland
merchantCountryCodeNZL
merchantId92102062388908
merchantNameUnsworth Height Super
merchantTerminalId50487001
merchantCategoryCode5451
cardPresenttrueWas the card or XPay device physically present at the time of purchase.
transactionIdabc123Immersve transaction identifier.
transactionReference01005960960820000000000000The payment network transaction identifier.
transactionTypepurchaseThe type of payment: purchase, refund.
transactionDate2022-04-01T10:00:00.000ZThe transaction date/time.