In-Memory Requests
Overview
In-memory requests allow for creating and managing requests without immediately persisting them to storage. This enables faster payment workflows and deferred persistence.
Key benefits:
Faster payment flow: In-memory requests are helpful when payment is the priority, such as in e-commerce cases. In this scenario, the request is a receipt rather than an invoice.
Deferred Persistence: With in-memory requests, a request can be created on the front end with a user's signature and passed on to the backend for persistence.
How it works:
The flow of creating and paying an in-memory request is similar to a regular request with the following key differences:
Create an in-memory request by passing the argument
skipPeristence: true
when instantiating theRequestNetwork
instance.An in-memory request is not persisted immediately like normal requests. Instead, it is stored in memory on the device where it was created. It can be persisted at a later time using the
persistTransaction()
function.An in-memory request has the
inMemoryInfo
property.Avoid calling
getData()
on an in-memory request because it will fail silently by returning an emptyEventEmitter
object.Retrieving an in-memory request with
requestClient.fromRequestId()
will fail because the request has not been persisted yet so it is not possible to read it from the Request Node.
Last updated