...
Code Block | ||
---|---|---|
| ||
# Retrieve all your bills curl -u <my-app-id>:<my-app-secret> \ -H 'Accept: application/json' \ https://maestrano.com/api/v1/account/bills # Retrieve a specific bill curl -u <my-app-id>:<my-app-secret> \ -H 'Accept: application/json' \ https://maestrano.com/api/v1/account/bills/bill-520 |
RecurringBill - Recurring subscription fees
The command below shows how to create a $29.90 recurring bill for a user license.
...
language | bash |
---|
...
The table below summarises all the fields available on the Bill model:
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. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
updated_at | readonly | Time | - | - | When the bill was last updated. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
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. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
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. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
RecurringBill - Recurring subscription fees
The command below shows how to create a $29.90 recurring bill for a user license.
Code Block | ||
---|---|---|
| ||
# Request curl -u <my-app-id>:<my-app-secret> \ -X "POST" \ -H 'Accept: application/json' \ -H "Content-type: application/json" \ -d '{"group_id":"cld-4", "price_cents":2990, "description":"User license", "period": "Month", "start_date": "2015-08-27T23:22:37Z", }' \ "remaining_cycles":null } } |
This command allows you to cancel a recurring bill:
Code Block | ||
---|---|---|
| ||
# Request curl -u <my-app-id>:<my-app-secret> \ -X "DELETE" \ -H 'Accept: application/json' \ https://maestrano.com/api/v1/account/recurring_bills/rbill-523 # Response { "success":true, "errors":https://maestrano.com/api/v1/account/recurring_bills # Response { "success":true, "errors":{}, "data":{ "object":"account_recurring_bill", "id":"rbill-523", "group_id":"cld-4", "created_at":"2015-06-03T05:02:19Z", "updated_at":"2015-06-03T05:02:19Z", "price_cents":2990, "status":"cancelledsubmitted", "currency":"AUD", "description":"User license", "start_date":"2015-08-27T23:22:37Z", "period":"month", "frequency":1, "cycles":null, "initial_cents":0, "last_execution_at":null, "next_execution_at":"2015-08-27T23:22:37Z", "remaining_cycles":null } } |
Below is how to retrieve all your recurring bills as well as a single recurring bill:
...
language | bash |
---|
...
This command allows you to cancel a recurring bill:
Code Block | ||
---|---|---|
| ||
# Request
curl -u <my-app-id>:<my-app-secret> \
-X "DELETE" \
-H 'Accept: application/json' \
https://maestrano.com/api/v1/account/recurring_bills/rbill-523
# Response
{
"success":true,
"errors":{},
"data":{
"object":"account_recurring_bill",
"id":"rbill-523",
"group_id":"cld-4",
"created_at":"2015-06-03T05:02:19Z",
"updated_at":"2015-06-03T05:02:19Z",
"price_cents":2990,
"status":"cancelled",
"currency":"AUD",
"description":"User license",
"start_date":"2015-08-27T23:22:37Z",
"period":"month",
"frequency":1,
"cycles":null,
"initial_cents":0,
"last_execution_at":null,
"next_execution_at":"2015-08-27T23:22:37Z",
"remaining_cycles":null
}
} |
Below is how to retrieve all your recurring bills as well as a single recurring bill:
Code Block | ||
---|---|---|
| ||
# Retrieve all your recurring bills
curl -u <my-app-id>:<my-app-secret> \
-H 'Accept: application/json' \
https://maestrano.com/api/v1/account/recurring_bills
# Retrieve a specific recurring bill
curl -u <my-app-id>:<my-app-secret> \
-H 'Accept: application/json' \
https://maestrano.com/api/v1/account/recurring_bills/rbill-523 |
The table below summarises all the fields available on the RecurringBill model:
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. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
created_at | readonly | Time | - | - | When the recurring bill was created. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
updated_at | readonly | Time | - | - | When the recurring bill was last updated. Uses ISO 8601 format (e.g.: 2015-06-03T05:00:33Z) |
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 |