Buying Item

Buying an Item

In order for a user to buy an item from your Marketplace, you need to:

  1. Show them available items for sale
  2. Have them buy the item.

Getting items that are for sale

In order to return the items for your project that are listed on Fractal's marketplace, use the getForSaleItems RPC for API callers and the useItemsForSale hook for react-sdk callers.

curl --request GET  \
     --url '' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <PROJECT_API_TOKEN>' 

Buying an item

Once you have all the items listed for sale, your user can now buy an item.

Below is the steps needed to achieve this.

# Step 1: Generate a Buy Transaction
curl --request GET \
     --url '<token_to_buy>&walletId=<public_key_of_buyer>&quantity=1' \
     --header 'Accept: application/json'
# Step 2: Authorize the generated transaction.
curl --request POST \
     --url '' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <PROJECT_API_TOKEN>' \
     --header 'Content-Type: application/json' \
     --data '{
         "unsignedMessage": "<unsigned_tx_base58>"
# This endpoint returns a URL that you need to open on behalf of the
# user. The user can then approve the transaction at that URL.
# Step 3: Call the getSignedResult RPC to detect when a user has approved.
curl --request GET \
     --url '<code>' \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <PROJECT_API_TOKEN>'