Set up your account and API credentials
1. Create a new account at dashboard.tryaqueduct.com If you would like more accounts whitelisted, reach out to your Aqueduct point of contact or email [email protected]. 2. Generate an API from the settings page. Use your API key by including it in the header of any requests made to Aqueduct, which you can test out directly in the API reference.Terminal
Configure how you want to collect money.
1. Create a price model in the dashboard. On Aqueduct, you express how you collect money using a PriceModel which expresses how much and how frequently you want to charge them. Price models contain price functions that can be combined to easily express sophisticated deals. You can read more about how price models work here. We’ll create a basic usage based price model first and then built it into a full blown marketplace with split payouts, retainers, and referral fees. Scenario: Cody provides consulting services at $100 per hour that is collected monthly. To handle Cody’s billing, we create a price model with:- One price function of type
per-unit-meterand meter namecody-hours-workedand meter rate $100. - Billing frequency:
monthly.
Terminal
Terminal
/bill to use the price model to bill the customer. Since the price model
has a recurring billing frequency, it will create a subscription.
Terminal
/billableEvents to send events that should be billed against to the price
model. The following code tells the price model that code worked 20 hours. At
the end of the month, Bobby will be billed for $2000 since Cody added 20 hours.
You can preview upcoming amounts in the dashboard.
Terminal
/bill primarily associated a fully formed price model
with a customer and a product. Price models can be used as templates by only
part of the variables when the price model is created and the rest of the models
when calling /bill.
For example, instead of creating a price model specifically for Cody Consultant.
We can create a generalized price model for any consultant and then specific the
specific values that we want for Cody when we call /bill to bill specifically
for Cody.
To create a generalized price model:
- One price function of type
per-unit-meterand leave the meter name and meter rate unspecified. - frequency: monthly To specify the Cody specific information, we would make the
following
/billrequest with the variables object containing the missing variables for each price model id.
Terminal