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
```
#### 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
```
## 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 2014 Maestrano Pty Ltd. https://maestrano.com
You are not granted rights or licenses to the trademarks of Maestrano.