Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
131 changes: 69 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
## Introduction

Maxio Advanced Billing (formerly Chargify) provides an HTTP-based API that conforms to the principles of REST.
One of the many reasons to use Advanced Billing is the immense feature set and surrounding community [client libraries](page:development-tools/client-libraries).
The Maxio API returns JSON responses as the primary and recommended format, but XML is also provided as a backwards compatible option for Merchants who require it.
One of the many reasons to use Advanced Billing is the immense feature set and [client libraries](page:development-tools/client-libraries).
The Maxio API returns JSON responses as the primary and recommended format, but XML is also provided as a backwards compatible option for merchants who require it.

### Steps to make your first Maxio Advanced Billing API call

1. [Sign-up](https://app.chargify.com/signup/maxio-billing-sandbox) or [log-in](https://app.chargify.com/login.html) to your [test site](https://maxio.zendesk.com/hc/en-us/articles/24250712113165-Testing-Overview) account.
2. [Setup and configure authentication](https://maxio.zendesk.com/hc/en-us/articles/24294819360525-API-Keys) credentials.
3. Submit your API request and try it out.
4. Verify results through response.
5. Test our integrations.
2. [Setup authentication](https://maxio.zendesk.com/hc/en-us/articles/24294819360525-API-Keys) credentials.
3. [Submit an API request and verify the response](page:development-tools/client-libraries#make-your-first-maxio-advanced-billing-api-request).
4. Test the Advanced Billing [integrations](https://www.maxio.com/integrations).

We strongly suggest exploring the developer portal, our [integrations](https://www.maxio.com/integrations) and the API guide, as well as the entire set of application-based documentation to aid in your discovery of the product.
Next, you can explore [authentication methods](page:introduction/authentication), [basic concepts](page:introduction/basic-concepts/connected-sites) for interacting with Advanced Billing via the API, and the entire set of [application-based documentation](https://docs.maxio.com/hc/en-us) to aid in your discovery of the product.

#### Example
#### Request Example

The following example uses the curl command-line tool to execute API requests.
The following example uses the curl command-line tool to make an API request.

**Request**

Expand All @@ -31,31 +30,31 @@ The package is compatible with Python versions `3.7+`.
Install the package from PyPi using the following pip command:

```bash
pip install maxio-advanced-billing-sdk==6.1.0
pip install maxio-advanced-billing-sdk==7.0.0
```

You can also view the package at:
https://pypi.python.org/pypi/maxio-advanced-billing-sdk/6.1.0
https://pypi.python.org/pypi/maxio-advanced-billing-sdk/7.0.0

## Initialize the API Client

**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/client.md)
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/client.md)

The following parameters are configurable for the API Client:

| Parameter | Type | Description |
| --- | --- | --- |
| `site` | `str` | The subdomain for your Advanced Billing site.<br>*Default*: `'subdomain'` |
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.US`** |
| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests |
| `override_http_client_configuration` | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
| `http_call_back` | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
| `timeout` | `float` | The value to use for connection timeout. <br> **Default: 120** |
| `max_retries` | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
| `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
| `retry_statuses` | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
| `retry_methods` | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
| `basic_auth_credentials` | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |
| site | `str` | The subdomain for your Advanced Billing site.<br>*Default*: `'subdomain'` |
| environment | `Environment` | The API environment. <br> **Default: `Environment.US`** |
| http_client_instance | `HttpClient` | The Http Client passed from the sdk user for making requests |
| override_http_client_configuration | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
| http_call_back | `HttpCallBack` | The callback value that is invoked before and after an HTTP call is made to an endpoint |
| timeout | `float` | The value to use for connection timeout. <br> **Default: 120** |
| max_retries | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
| backoff_factor | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
| retry_statuses | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
| retry_methods | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
| basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |

The API client can be initialized as follows:

Expand Down Expand Up @@ -85,46 +84,54 @@ The SDK can be configured to use a different environment for making API calls. A

This API uses the following authentication schemes.

* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/auth/basic-authentication.md)
* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/auth/basic-authentication.md)

## List of APIs

* [API Exports](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/api-exports.md)
* [Advance Invoice](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/advance-invoice.md)
* [Billing Portal](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/billing-portal.md)
* [Component Price Points](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/component-price-points.md)
* [Custom Fields](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/custom-fields.md)
* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/events-based-billing-segments.md)
* [Payment Profiles](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/payment-profiles.md)
* [Product Families](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/product-families.md)
* [Product Price Points](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/product-price-points.md)
* [Proforma Invoices](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/proforma-invoices.md)
* [Reason Codes](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/reason-codes.md)
* [Referral Codes](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/referral-codes.md)
* [Sales Commissions](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/sales-commissions.md)
* [Subscription Components](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-components.md)
* [Subscription Groups](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-groups.md)
* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-group-invoice-account.md)
* [Subscription Group Status](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-group-status.md)
* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-invoice-account.md)
* [Subscription Notes](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-notes.md)
* [Subscription Products](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-products.md)
* [Subscription Status](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscription-status.md)
* [Coupons](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/coupons.md)
* [Components](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/components.md)
* [Customers](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/customers.md)
* [Events](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/events.md)
* [Insights](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/insights.md)
* [Invoices](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/invoices.md)
* [Offers](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/offers.md)
* [Products](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/products.md)
* [Sites](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/sites.md)
* [Subscriptions](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/subscriptions.md)
* [Webhooks](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/controllers/webhooks.md)

## Classes Documentation

* [Utility Classes](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/utility-classes.md)
* [HttpResponse](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/http-response.md)
* [HttpRequest](https://www.github.com/maxio-com/ab-python-sdk/tree/6.1.0/doc/http-request.md)
* [API Exports](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/api-exports.md)
* [Advance Invoice](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/advance-invoice.md)
* [Billing Portal](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/billing-portal.md)
* [Component Price Points](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/component-price-points.md)
* [Custom Fields](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/custom-fields.md)
* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/events-based-billing-segments.md)
* [Payment Profiles](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/payment-profiles.md)
* [Product Families](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/product-families.md)
* [Product Price Points](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/product-price-points.md)
* [Proforma Invoices](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/proforma-invoices.md)
* [Reason Codes](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/reason-codes.md)
* [Referral Codes](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/referral-codes.md)
* [Sales Commissions](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/sales-commissions.md)
* [Subscription Components](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-components.md)
* [Subscription Groups](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-groups.md)
* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-group-invoice-account.md)
* [Subscription Group Status](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-group-status.md)
* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-invoice-account.md)
* [Subscription Notes](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-notes.md)
* [Subscription Products](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-products.md)
* [Subscription Status](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscription-status.md)
* [Coupons](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/coupons.md)
* [Components](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/components.md)
* [Customers](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/customers.md)
* [Events](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/events.md)
* [Insights](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/insights.md)
* [Invoices](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/invoices.md)
* [Offers](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/offers.md)
* [Products](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/products.md)
* [Sites](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/sites.md)
* [Subscriptions](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/subscriptions.md)
* [Webhooks](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/controllers/webhooks.md)

## SDK Infrastructure

### HTTP

* [HttpResponse](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/http-response.md)
* [HttpRequest](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/http-request.md)

### Utilities

* [ApiHelper](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/api-helper.md)
* [HttpDateTime](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/http-date-time.md)
* [RFC3339DateTime](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/rfc3339-date-time.md)
* [UnixDateTime](https://www.github.com/maxio-com/ab-python-sdk/tree/7.0.0/doc/unix-date-time.md)

2 changes: 1 addition & 1 deletion advancedbilling/controllers/base_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BaseController(object):

@staticmethod
def user_agent():
return 'AB SDK Python:6.1.0 on OS {os-info}'
return 'AB SDK Python:7.0.0 on OS {os-info}'

@staticmethod
def user_agent_parameters():
Expand Down
2 changes: 1 addition & 1 deletion advancedbilling/controllers/coupons_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def validate_coupon(self,
ResponseHandler()
.deserializer(APIHelper.json_deserialize)
.deserialize_into(CouponResponse.from_dictionary)
.local_error('404', 'Not Found', SingleStringErrorResponseException)
.local_error_template('404', 'Not Found: \'{$response.body}\'', SingleStringErrorResponseException)
).execute()

def create_or_update_coupon_currency_prices(self,
Expand Down
2 changes: 1 addition & 1 deletion advancedbilling/controllers/custom_fields_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create_metafields(self,
and another 100 for Customer.
### Metafields "On-the-Fly"
It is possible to create Metafields “on the fly” when you create your
Metadata – if a non-existant name is passed when creating Metadata, a
Metadata – if a non-existent name is passed when creating Metadata, a
Metafield for that key will be automatically created. The Metafield
API, however, gives you more control over your “keys”.
### Metafield Scope Warning
Expand Down
2 changes: 1 addition & 1 deletion advancedbilling/controllers/insights_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def read_site_stats(self):
## Stats Documentation
There currently is not a complimentary matching set of documentation
that compliments this endpoint. However, each Site's dashboard will
reflect the summary of information provided in the Stats reposnse.
reflect the summary of information provided in the Stats response.
```
https://subdomain.chargify.com/dashboard
```
Expand Down
57 changes: 9 additions & 48 deletions advancedbilling/controllers/invoices_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def list_invoices(self,
subscription group you want to fetch consolidated
invoices for. This will return a paginated list of
consolidated invoices for the specified group.
consolidation_level -- str -- The consolidation level of
the invoice. Allowed Values: none, parent, child or
comma-separated lists of thereof, e.g. none,parent.
page -- int -- Result records are organized in pages. By
default, the first page of results is displayed. The
page parameter specifies a page number of results to
Expand Down Expand Up @@ -210,6 +213,9 @@ def list_invoices(self,
.query_param(Parameter()
.key('subscription_group_uid')
.value(options.get('subscription_group_uid', None)))
.query_param(Parameter()
.key('consolidation_level')
.value(options.get('consolidation_level', None)))
.query_param(Parameter()
.key('page')
.value(options.get('page', None)))
Expand Down Expand Up @@ -446,54 +452,9 @@ def record_payment_for_invoice(self,
body=None):
"""Does a POST request to /invoices/{uid}/payments.json.

This API call should be used when you want to record a payment of a
given type against a specific invoice. If you would like to apply a
payment across multiple invoices, you can use the Bulk Payment
endpoint.
## Create a Payment from the existing payment profile
In order to apply a payment to an invoice using an existing payment
profile, specify `type` as `payment`, the amount less than the invoice
total, and the customer's `payment_profile_id`. The ID of a payment
profile might be retrieved via the Payment Profiles API endpoint.
```
{
"type": "payment",
"payment": {
"amount": 10.00,
"payment_profile_id": 123
}
}
```
## Create a Payment from the Subscription's Prepayment Account
In order apply a prepayment to an invoice, specify the `type` as
`prepayment`, and also the `amount`.
```
{
"type": "prepayment",
"payment": {
"amount": 10.00
}
}
```
Note that the `amount` must be less than or equal to the
Subscription's Prepayment account balance.
## Create a Payment from the Subscription's Service Credit Account
In order to apply a service credit to an invoice, specify the `type`
as `service_credit`, and also the `amount`:
```
{
"type": "service_credit",
"payment": {
"amount": 10.00
}
}
```
Note that Advanced Billing will attempt to fully pay the invoice's
`due_amount` from the Subscription's Service Credit account. At this
time, partial payments from a Service Credit Account are only allowed
for consolidated invoices (subscription groups). Therefore, for normal
invoices the Service Credit account balance must be greater than or
equal to the invoice's `due_amount`.
Applies a payment of a given type against a specific invoice. If you
would like to apply a payment across multiple invoices, you can use
the Bulk Payment endpoint.

Args:
uid (str): The unique identifier for the invoice, this does not
Expand Down
Loading