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
  •  
  •  
  •  
90 changes: 45 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ curl -u <api_key>:x -H Accept:application/json -H Content-Type:application/json
Run the following command to install the package and automatically add the dependency to your composer.json file:

```bash
composer require "maxio/advanced-billing-sdk:9.1.0"
composer require "maxio/advanced-billing-sdk:10.0.0"
```

Or add it to the composer.json file manually as given below:

```json
"require": {
"maxio/advanced-billing-sdk": "9.1.0"
"maxio/advanced-billing-sdk": "10.0.0"
}
```

You can also view the package at:
https://packagist.org/packages/maxio/advanced-billing-sdk#9.1.0
https://packagist.org/packages/maxio/advanced-billing-sdk#10.0.0

## Initialize the API Client

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

The following parameters are configurable for the API Client:

| Parameter | Type | Description |
| --- | --- | --- |
| site | `string` | The subdomain for your Advanced Billing site.<br>*Default*: `'subdomain'` |
| environment | [`Environment`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/README.md#environments) | The API environment. <br> **Default: `Environment.US`** |
| environment | [`Environment`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/README.md#environments) | The API environment. <br> **Default: `Environment.US`** |
| timeout | `int` | Timeout for API calls in seconds.<br>*Default*: `120` |
| enableRetries | `bool` | Whether to enable retries and backoff feature.<br>*Default*: `false` |
| numberOfRetries | `int` | The number of retries to make.<br>*Default*: `0` |
Expand All @@ -62,8 +62,8 @@ The following parameters are configurable for the API Client:
| retryOnTimeout | `bool` | Whether to retry on request timeout.<br>*Default*: `true` |
| httpStatusCodesToRetry | `array` | Http status codes to retry against.<br>*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` |
| httpMethodsToRetry | `array` | Http methods to retry against.<br>*Default*: `'GET', 'PUT'` |
| proxyConfiguration | [`ProxyConfigurationBuilder`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/proxy-configuration-builder.md) | Represents the proxy configurations for API calls |
| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication |
| proxyConfiguration | [`ProxyConfigurationBuilder`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/proxy-configuration-builder.md) | Represents the proxy configurations for API calls |
| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication |

The API client can be initialized as follows:

Expand Down Expand Up @@ -99,56 +99,56 @@ 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-php-sdk/tree/9.1.0/doc/auth/basic-authentication.md)
* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/auth/basic-authentication.md)

## List of APIs

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

## SDK Infrastructure

### Configuration

* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/proxy-configuration-builder.md)
* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/proxy-configuration-builder.md)

### HTTP

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

### Utilities

* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/api-exception.md)
* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/api-exception.md)

18 changes: 12 additions & 6 deletions doc/controllers/advance-invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ $advanceInvoiceController = $client->getAdvanceInvoiceController();

# Issue Advance Invoice

Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility for generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided.
A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error.
That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated.
We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it.
Issues an invoice in advance for a subscription's next renewal date. For the most part, advance invoices function like any other invoice, except they are issued early and have special behavior upon being voided. For more information on advance invoices, including eligibility for generating one, see [Issue Invoice In Advance](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance).

A subscription can only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists returns an error.

Regeneration of the invoice can be forced with the params `force: true`, which voids an advance invoice if one exists and generates a new one. If no advance invoice exists, a new one is generated.

Consider using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it.

```php
function issueAdvanceInvoice(int $subscriptionId, ?IssueAdvanceInvoiceRequest $body = null): Invoice
Expand Down Expand Up @@ -125,8 +128,11 @@ try {

# Void Advance Invoice

Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.
A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs](../../doc/models/invoice.md).
Voids a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.

A `reason` is required to void, and the invoice must have an open status. Voiding causes any prepayments and credits that were applied to the invoice to be returned to the subscription.

For a full overview of the impact of voiding, see [Invoice](../../doc/models/invoice.md).

```php
function voidAdvanceInvoice(int $subscriptionId, ?VoidInvoiceRequest $body = null): Invoice
Expand Down
6 changes: 2 additions & 4 deletions doc/controllers/api-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ try {

# Export Proforma Invoices

Creates a proforma invoices export and returns a batch job object.

It is only available for Relationship Invoicing architecture.
Creates a proforma invoices export and returns a batch job object. Proforma invoices are only available on Relationship Invoicing sites.

```php
function exportProformaInvoices(): BatchJobResponse
Expand Down Expand Up @@ -315,7 +313,7 @@ try {

# Read Proforma Invoices Export

Returns a batch job object for a proforma invoices export.
Returns a batch job object for a proforma invoices export. Proforma invoices are only available on Relationship Invoicing sites.

```php
function readProformaInvoicesExport(string $batchId): BatchJobResponse
Expand Down
24 changes: 9 additions & 15 deletions doc/controllers/billing-portal.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@ $billingPortalController = $client->getBillingPortalController();

Enables Billing Portal access for a customer, with an option to send an invitation email at the same time.

## Billing Portal Documentation

Full documentation on how the Billing Portal operates within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview).

This documentation is focused on how to configure the Billing Portal Settings, as well as Subscriber Interaction and Merchant Management of the Billing Portal.

You can use this endpoint to enable Billing Portal access for a Customer, with the option of sending the Customer an Invitation email at the same time.

## Billing Portal Security

If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**
If your customer has been invited to the Billing Portal, they receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**

If you need to provide your customer their Management URL through other means, you can retrieve it [via the API](../../doc/controllers/billing-portal.md#read-billing-portal-link). Because the URL is cryptographically signed with a timestamp, merchants cannot generate the URL without requesting it through the API.

If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing.
To prevent abuse and overuse, request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request every time.

In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time.
For more information configuring the Billing Portal, see [Billing Portal Overview](https://maxio.zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview).

```php
function enableBillingPortalForCustomer(int $customerId, ?int $autoInvite = null): CustomerResponse
Expand Down Expand Up @@ -86,13 +80,13 @@ try {

Returns the exact URL required for a subscriber to access the Billing Portal.

## Rules for Management Link API
## Management Link Request Rules

+ When retrieving a management URL, multiple requests for the same customer in a short period will return the **same** URL
+ We will not generate a new URL for 15 days
+ When retrieving a management URL, multiple requests for the same customer in a short period return the **same** URL
+ A new URL is not generated for 15 days
+ You must cache and remember this URL if you are going to need it again within 15 days
+ Only request a new URL after the `new_link_available_at` date
+ You are limited to 15 requests for the same URL. If you make more than 15 requests before `new_link_available_at`, you will be blocked from further Management URL requests (with a response code `429`)
+ You are limited to 15 requests for the same URL. If you make more than 15 requests before `new_link_available_at`, you are blocked from further Management URL requests (with a response code `429`).

```php
function readBillingPortalLink(int $customerId): PortalManagementLink
Expand Down
Loading
Loading