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

Skip to main content

Sending RFQs

After your customer selects an Offering, the next step is to send a Request for Quote (RFQ) to the PFI in order to initiate the transaction. The Offering provided an estimate, but the Quote will provide a formal offer based on the financial transaction the customer is requesting as well as the payment methods provided.

Create the RFQ​

An RFQ is a structured tbDEX message that specifies the details of the transaction your customer wishes to make. It includes information about the Offering, payment methods, and any required verifiable credentials (VCs).

To create the message, construct an RFQ passing metadata and data:

JavaScript
Kotlin
Swift

metadata​

The metadata properties identify the DIDs of the sender (your customer), the recipient (the PFI), and the version of the tbDEX protocol you're using:

JavaScript
Kotlin
Swift

data​

The data properties contain the specifics of the transaction, such as the id of the Offering you're requesting the Quote for, payment methods, and credentials:

  • offeringId - The unique identifier of the PFI's Offering the customer is interested in
  • payin - How the customer intends to pay the PFI
    • kind - Type of payment method e.g. BTC_ADDRESS, DEBIT_CARD, MOMO_MPESA
    • amount - Total amount of currency the customer wants to pay in exchange for payout currency
    • paymentDetails - The exact details of the payment method. As this information is sensitive, the SDK will convert these details into salted hashes
  • payout - How the customer wishes to receive the payout from the PFI
    • kind - Type of payment method e.g. BTC_ADDRESS, BANK_ACCOUNT, MOMO_MPESA
    • paymentDetails - The exact details of the payment method. As this information is sensitive, the SDK will convert these details into salted hashes
  • claims - The VCs that satisfy the requirements of the Offer. As this information is sensitive, the SDK will convert these details into salted hashes
JavaScript
Kotlin
Swift

Sign the RFQ​

Signing the RFQ ensures its authenticity. You can do so with the customer's Bearer DID:

JavaScript
Kotlin
Swift

Send RFQ to PFI​

Use TbdexHttpClient to send the RFQ to the PFI, with an optional replyTo property containing a valid URI where new messages from the PFI will be sent:

JavaScript
Kotlin
Swift
Callback

Callbacks are fully qualified URIs (DID or URL) that can be provided to the PFI via the replyTo property.

If replyTo is provided, the PFI will send all new messages of the exchange to the supplied URI. This URI is scoped to each exchange, allowing you to specify a different URI per exchange if desired.

If replyTo is not present, you will need to poll the PFI to receive new messages within the exchange.

If no error is thrown, the RFQ has been successfully sent to the PFI and an exchange has been created. This exchange serves as a thread of messages between your application and the PFI regarding this transaction.

The next message written to the exchange will be a Quote from the PFI.

Connect with us on Discord

Submit feedback: Open a GitHub issue

Edit this page: GitHub Repo

Contribute: Contributing Guide