Field |
Mode |
Type |
Required |
Default |
Description |
id |
readonly |
string |
- |
- |
The id of the bill |
group_id |
read/write |
string |
Yes |
- |
The id of the group you are charging |
price_cents |
read/write |
Integer |
Yes |
- |
The amount in cents to charge to the customer |
description |
read/write |
String |
Yes |
- |
A description of the product billed as it should appear on customer invoice |
created_at |
readonly |
Time |
- |
- |
When the bill was created |
updated_at |
readonly |
Time |
- |
- |
When the bill was last updated |
status |
readonly |
String |
- |
- |
Status of the bill. Either 'submitted', 'invoiced' or 'cancelled'. |
currency |
read/write |
String |
- |
AUD |
The currency of the amount charged in ISO 4217 format (3 letter code) |
units |
read/write |
Decimal(10,2) |
- |
1.0 |
How many units are billed for the amount charged |
period_started_at |
read/write |
Time |
- |
- |
If the bill relates to a specific period then specifies when the period started. Both period_started_at and period_ended_at need to be filled in order to appear on customer invoice. |
period_ended_at |
read/write |
Time |
- |
- |
If the bill relates to a specific period then specifies when the period ended. Both period_started_at and period_ended_at need to be filled in order to appear on customer invoice. |
##### Actions
List all bills you have created and iterate through the list
```ruby
bills = Maestrano::Account::Bill.all
bills.each { |b| puts b.id }
```
Access a single bill by id
```ruby
bill = Maestrano::Account::Bill.retrieve("bill-f1d2s54")
puts bill.group_id
```
Create a new bill
```ruby
bill = Maestrano::Account::Bill.create(group_id: "cld-3", price_cents: 2000, description: "Product purchase")
puts bill.id
```
Cancel a bill
```ruby
bill = Maestrano::Account::Bill.retrieve("bill-f1d2s54")
bill.cancel
```
##### Using presets
All actions can be performed with presets, for instance to list all bills with presets
```ruby
bills = Maestrano::Account::Bill['my-preset'].all
bills.each { |b| puts b.id }
```
#### Recurring Bill
A recurring bill charges a given customer at a regular interval without you having to do anything.
```ruby
Maestrano::Account::RecurringBill
```
##### Attributes
Field |
Mode |
Type |
Required |
Default |
Description |
id |
readonly |
string |
- |
- |
The id of the recurring bill |
group_id |
read/write |
string |
Yes |
- |
The id of the group you are charging |
price_cents |
read/write |
Integer |
Yes |
- |
The amount in cents to charge to the customer |
description |
read/write |
String |
Yes |
- |
A description of the product billed as it should appear on customer invoice |
period |
read/write |
String |
- |
Month |
The unit of measure for the billing cycle. Must be one of the following: 'Day', 'Week', 'SemiMonth', 'Month', 'Year' |
frequency |
read/write |
Integer |
- |
1 |
The number of billing periods that make up one billing cycle. The combination of billing frequency and billing period must be less than or equal to one year. If the billing period is SemiMonth, the billing frequency must be 1. |
cycles |
read/write |
Integer |
- |
nil |
The number of cycles this bill should be active for. In other words it's the number of times this recurring bill should charge the customer. |
start_date |
read/write |
Time |
- |
Now |
The date when this recurring bill should start billing the customer |
created_at |
readonly |
Time |
- |
- |
When the recurring bill was created |
updated_at |
readonly |
Time |
- |
- |
When the recurring bill was last updated |
currency |
read/write |
String |
- |
AUD |
The currency of the amount charged in ISO 4217 format (3 letter code) |
status |
readonly |
String |
- |
- |
Status of the recurring bill. Either 'submitted', 'active', 'expired' or 'cancelled'. |
initial_cents |
read/write |
Integer |
- |
0 |
Initial non-recurring payment amount - in cents - due immediately upon creating the recurring bill |
##### Actions
List all recurring bills you have created and iterate through the list
```ruby
rec_bills = Maestrano::Account::RecurringBill.all
rec_bills.each { |b| puts b.id }
```
Access a single recurring bill by id
```ruby
rec_bill = Maestrano::Account::RecurringBill.retrieve("rbill-f1d2s54")
puts rec_bill.group_id
```
Create a new recurring bill
```ruby
rec_bill = Maestrano::Account::RecurringBill.create(group_id: "cld-3", price_cents: 2000, description: "Product purchase", period: 'Month', start_date: Time.now)
puts rec_bill.id
```
Cancel a recurring bill
```ruby
rec_bill = Maestrano::Account::RecurringBill.retrieve("rbill-f1d2s54")
rec_bill.cancel
```
##### Using presets
All actions can be performed with presets, for instance to list all recurring bills with presets
```ruby
rec_bills = Maestrano::Account::RecurringBill['my-preset'].all
rec_bills.each { |b| puts b.id }
```
### Membership API
#### User
A user is a member of a group having access to your application. Users are currently readonly.
```ruby
Maestrano::Account::User
```
##### Attributes
Field |
Mode |
Type |
Required |
Default |
Description |
id |
readonly |
String |
- |
- |
The id of the group |
name |
readonly |
String |
- |
- |
The group name |
email |
readonly |
string |
- |
- |
The principal email address for this group (admin email address) |
has_credit_card |
readonly |
Boolean |
- |
- |
Whether the group has entered a credit card on Maestrano or not |
free_trial_end_at |
readonly |
Time |
- |
- |
When the group free trial will be finishing on Maestrano. You may optionally consider this date for your own free trial (optional) |
currency |
readonly |
String |
- |
- |
The currency used by this Group in ISO 4217 format (3 letter code) |
country |
readonly |
String |
- |
- |
The country of the group in ISO 3166-1 alpha-2 format (2 letter code). E.g: 'US' for USA, 'AU' for Australia. |
city |
readonly |
String |
- |
- |
The city of the group |
timezone |
readonly |
String |
- |
- |
The group timezone in Olson format |
created_at |
readonly |
Time |
- |
- |
When the group was created |
updated_at |
readonly |
Time |
- |
- |
When the group was last updated |
##### Actions
List all groups having access to your application
```ruby
groups = Maestrano::Account::Group.all;
```
Access a single group by id
```ruby
group = Maestrano::Account::Group.retrieve("usr-f1d2s54");
```
##### Using presets
All actions can be performed with presets, for instance to list all groups with presets
```ruby
groups = Maestrano::Account::Group['my-preset'].all
```
## Connec!™ Data Sharing
Maestrano offers the capability to share actual business data between applications via its data sharing platform Connec!™.
The platform exposes a set of RESTful JSON APIs allowing your application to receive data generated by other applications and update data in other applications as well!
Connec!™ also offers the ability to create webhooks on your side to get automatically notified of changes happening in other systems.
Connec!™ enables seamless data sharing between the Maestrano applications as well as popular apps such as QuickBooks and Xero. One connector - tens of integrations!
### Making Requests
Connec!™ REST API documentation can be found here: http://maestrano.github.io/connec
The Maestrano API provides a built-in client - based on HTTParty - for connecting to Connec!™. Things like connection and authentication are automatically managed by the Connec!™ client.
```ruby
# Pass the customer group id as argument
client = Maestrano::Connec::Client.new("cld-f7f5g4")
# Retrieve all organizations (customers and suppliers) created in other applications
resp = client.get('/organizations')
resp.body # returns the raw response "{\"organizations\":[ ... ]}"
resp.parsed_response # returns a ruby hash { "organizations": [ ... ] }
# Create a new organization
client.post('/organizations', { organizations: { name: "DoeCorp Inc."} })
# Update an organization
client.put('/organizations/e32303c1-5102-0132-661e-600308937d74', { organizations: { is_customer: true} })
# With presets
client_presets = Maestrano::Connec::Client['my-preset'].new("cld-f7f5g4")
client_presets.get('/organizations')
```
### Webhook Notifications
If you have configured the Maestrano API to receive update notifications (see 'subscriptions' configuration at the top) from Connec!™ then you can expect to receive regular POST requests on the notification_path you have configured.
Notifications are JSON messages containing the list of entities that have recently changed in other systems. You will only receive notifications for entities you have subscribed to.
Example of notification message:
```ruby
{
"organizations": [
{ "id": "e32303c1-5102-0132-661e-600308937d74", name: "DoeCorp Inc.", ... }
],
"people": [
{ "id": "a34303d1-4142-0152-362e-610408337d74", first_name: "John", last_name: "Doe", ... }
]
}
```
Entities sent via notifications follow the same data structure as the one described in our REST API documentation (available at http://maestrano.github.io/connec)
## Support
This README is still in the process of being written and improved. As such it might not cover some of the questions you might have.
So if you have any question or need help integrating with us just let us know at support@maestrano.com
## License
MIT License. Copyright 2015 Maestrano Pty Ltd. https://maestrano.com
You are not granted rights or licenses to the trademarks of Maestrano.