Skip to main content

Billing on the Subgraph Studio

Invoices are statements of payment amounts owed by a customer and are typically generated on a weekly basis in the system. You’ll be required to pay fees based on the query fees you generate using your API keys. The billing contract lives on the Polygon network. It’ll allow you to:

  • Add and remove GRT
  • Keep track of your balances based on how much GRT you have added to your account, how much you have removed, and your invoices
  • Automatically clear payments based on query fees generated

In order to add GRT to your account, you will need to go through the following steps:

  1. Purchase GRT and ETH on an exchange of your choice

  2. Send the GRT and ETH to your wallet

  3. Bridge GRT to Polygon using the UI

    a) You will receive 0.001 Matic in a few minutes after you send any amount of GRT to the Polygon bridge. You can track the transaction on Polygonscan by inputting your address into the search bar.

  4. Add bridged GRT to the billing contract on Polygon. The billing contract address is: 0xa382f75b375d6a07bfd1af99d4383c6e1d1c4004.

    a) In order to complete step #4, you'll need to switch your network in your wallet to Polygon. You can add Polygon's network by connecting your wallet and clicking on "Choose Matic (Polygon) Mainnet" here. Once you've added the network, switch it over in your wallet by navigating to the network pill on the top right hand side corner. In Metamask, the network is called Matic Mainnnet.

At the end of each week, if you used your API keys, you will receive an invoice based on the query fees you have generated during this period. This invoice will be paid using GRT available in your balance. Query volume is evaluated by the API keys you own. Your balance will be updated after fees are withdrawn.

Here’s how you go through the invoicing process:#

There are 4 states your invoice can be in:

  1. Created - your invoice has just been created and not been paid yet
  2. Paid - your invoice has been successfully paid
  3. Unpaid - there is not enough GRT in your balance on the billing contract
  4. Error - there is an error processing the payment

See the diagram below for more information:

Billing Flow

For a quick demo of how billing works on the Subgraph Studio, check out the video below: