.. and press ENTER to ask a question on web5, how to write code and more.

Skip to main content

Creating Quotes

When you receive an RFQ message, you’ll want to do the following:

  1. Store the RFQ message in your database
  2. Get the Offering specified by offeringId in the RFQ
  3. Verify any claims required by the Offering selected
  4. Create a Quote and store it in your database

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:

JavaScript
Kotlin
Swift

Verifying the Required Claims

After receiving an RFQ and finding the matching Offering, you’ll want to verify that the user satisfies the necessary requirements for the Offering.

The RFQ class offers the verifyOfferingRequirements method to do so, which checks that the claim or credential provided in the RFQ satisfies the presentation definition that was specified on the Offering.

JavaScript
Kotlin
Swift

Creating and Sending 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:

JavaScript
Kotlin
Swift

With the Quote created, you’ll then sign it for authorization purposes and write it to your own database:

JavaScript
Kotlin
Swift
note

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.

Connect with us on Discord

Submit feedback: Open a GitHub issue

Edit this page: GitHub Repo

Contribute: Contributing Guide