Creating Quotes
When you receive an RFQ
message, you’ll want to do the following:
- Store the
RFQ
message in your database - Get the
Offering
specified byofferingId
in theRFQ
- Create a
Quote
and store it in your database
Store RFQ message
An RFQ
is the first message of an exchange.
When a Wallet application sends your PFI an RFQ
message, your server's onCreateExchange()
callback parameter will be invoked.
This is where you should implement your business logic for determining the customer's exact Quote.
As a best practice, store the RFQ
message in your Exchanges database so that both you and the Wallet app can access it.
Get the Offering
After inserting the RFQ
into your database, you can search your database for the Offering
the RFQ
is requesting.
RFQs contain a required offeringId
field that you pass to your Offerings API provider’s getOffering()
method to obtain the exact Offering.
Building on the example from the Exchange API Provider section, your code might look like this:
Create a Quote
Before creating a Quote
in response to the received RFQ
, you may want to review the protocol definition for Quotes.
With that in mind, you can then create your quote using the Quote.create()
method as shown below:
With the Quote
created, you’ll then sign it for authorization purposes and write it to your own database:
If the Wallet Application supplied a replyTo
address with their RFQ, you'll send the Quote to that address.
If not, the Wallet Application will poll your PFI awaiting the Quote message to appear within the exchange.
Was this page helpful?
Connect with us on Discord
Submit feedback: Open a GitHub issue
Edit this page: GitHub Repo
Contribute: Contributing Guide