Workflow for using the Fermata API
POST
to /companies/{company_id}/accounts
endpoint with a payload like this:
stripe_id
parameter. If you leave this off, then we will create a Stripe customer for you in your Stripe account.
We also support a metadata
parameter that can be any JSON you want in case you want to track things like your internal customer IDs.
You can pass a plan_id
parameter to configure all denominated treasury accounts for the account using a preset configuration. See below for more information on plans.
This API call will return a new account_id
starting with a_
POST
to /accounts/{account_id}/card
The only parameter to pass is token
POST
to /accounts/{account_id}/balance/{denomination}
gate_on_balance
.
The state field is optional and defaults to complete
. It can be used to indicate if an event shouldn’t be fully processed yet by setting it to pending
. You can then use PUT /events/{event_id}
to set the final state to either complete
or cancelled
.
A pending
event will cause some pending amount to show up in the pending section of the user’s account balance and reflect in the available
amount but will not be fully accounted for until changed to complete
. If marked cancelled
then nothing will be deducted from their account.
Events can only stay in pending
for 1 hour and then they will be cancelled automatically.
Pending events can be used to reflect some type of long-running asynchronous operation that a customer is paying for that may or may not fully succeed.
PUT /accounts/{account_id}/auto_refill
as described above.
If you want to modify a user’s plan and have it take effect in the middle of the month, then use /accounts/{account_id}/modifymidmonth
negative_balance
: called whenever there is an event for a user that results in a negative balancebalance_change
: called anytime a user’s balance changesauto_refill
: called whenever a refill is triggered automatically (monthly plan renewal for example)threshold
: called whenever a customizable threshold is hit for a given account