{"_id":"5a0f6108823e2900127fd235","category":"5a0f6108823e2900127fd211","user":"5564a0073a61a72f0067cb22","project":"555fbba928249c1900618a82","parentDoc":null,"version":"5a0f6108823e2900127fd210","updates":["5595c7e9f44370190028891c","562aa244ed4bea0d00c11d8b","56bb4e10dabd992100b674f7","56f19a949791b22d0077ba0f"],"next":{"pages":[],"description":""},"createdAt":"2015-06-10T22:06:37.745Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"language":"json","status":200,"name":"","code":"{}"},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"API Authentication (HTTP Basic)\"\n}\n[/block]\nRecurly uses HTTP Basic Authentication—your [Private API key](https://app.recurly.com/go/developer/api_access) is securely encrypted by the SSL channel.\n\nIf you are testing the API calls via the command line with cURL, try:\n\n```\ncurl -H 'Accept: application/xml' \\\n     -H 'X-Api-Version: 2.9' \\\n     -H 'Content-Type: application/xml; charset=utf-8' \\\n     -u '[apikey]' \\\n    https://[subdomain].recurly.com/v2/accounts\n```\n\nReplace `[apikey]` and `[subdomain]` with the appropriate values for your site.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Calculating your own authorization header\"\n}\n[/block]\nMost programming languages encode the authorization header automatically. With HTTP Basic Authentication, the `Authorization` header is a string containing a Base-64 encoded username and password. In the case of Recurly’s API, you need only specify the username as your API key. If your library requires a password, set it to an empty string.\n\n```\n\"Authorization\": \"Basic \" + base64_encode(API Key)\n```\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Additional Request Headers\"\n}\n[/block]\n## Accept Header\nRecurly API v2 returns results as XML. Your requests should always include the header requesting the results as XML:\n\n```\nAccept: application/xml\n```\n\n## Content-Type Header\nWhen sending data to Recurly in a POST or PUT request, your request must specify the content type of your request:\n\n```\nContent-Type: application/xml; charset=utf-8\n```\n\n## X-Api-Version Header\nWhen sending data to Recurly, your request should specify the API version you're attempting to interact with:\n```\nX-Api-Version: 2.9\n```\nYou learn more about the different versions in the [API Versioning](doc:versioning) section.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Acceptable API versions\",\n  \"body\": \"Recurly supports the following API versions:**[2.2](https://dev.recurly.com/v2.2/docs)**, **[2.3](https://dev.recurly.com/v2.3/docs)**, **[2.4](https://dev.recurly.com/v2.4/docs)**, **[2.5](https://dev.recurly.com/v2.5/docs)**, **[2.6](https://dev.recurly.com/v2.6/docs)**, **[2.7](https://dev.recurly.com/v2.7/docs)**,**[2.8](https://dev.recurly.com/v2.8/docs)**,**[2.9](https://dev.recurly.com/v2.9/docs)**\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public API Key\"\n}\n[/block]\nRecurly uses two types of API keys: public and private. The Public API key is used by [Recurly.js](doc:recurlyjs) to identify its requests as belonging to your Recurly site. This key can be safely included in Javascript code.\n\nRecurly provides each site with one Public Key. The Public API Key can be regenerated on the [API Credentials](https://app.recurly.com/go/developer/api_access) page.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Private API Keys\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Treat your Private API Keys like passwords!\",\n  \"body\": \"The API key allows access to your site's data. Do not include it in Javascript code exposed to browsers.\"\n}\n[/block]\nRecurly supports the use of multiple Private API keys, which can be used to integrate third party services using unique, controlled credentials.\n\n## Limits & Pricing\nMerchants on the Core or grandfathered Recurly plans or merchants in sandbox mode will be granted 5 private API keys. Merchants on Recurly’s Professional plan will be granted 10 private API keys.\n\n## Default Key\nYour default private API key should be used to integrate Recurly with your backend systems. There will be at least one key active at all times.\n\n## Additional Keys\nAdditional private API keys should be used to connect your Recurly data to additional sources, like analytics software, accounting packages, or email tools. Recurly recommends clearly labeling the name of each key to identify the associated vendor.\n\n## Regenerating Private API Keys\nYour API key can be regenerated by clicking on the Regenerate button on the [API credentials](https://app.recurly.com/go/developer/api_access) page. When you generate a private API key, you have two options:\n\n1. Block the old key immediately. This is primarily recommended when the security of a key has been compromised.\n2. Allow the old key access for 12 hours. This is primarily used when updating systems and a smooth transition between keys is needed.\n\n*If a private API key is changed, an email alert will be sent to your Recurly Site Technical Contact.*\n\n## Read-Only Keys\nWhen creating a private key, you will have the option to set the key to “read-only”. This means the API key may make GET requests but cannot not PUT, POST or DELETE requests.","excerpt":"","slug":"getting-started","type":"basic","title":"Authentication","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Authentication


API Authentication (HTTP Basic)

Recurly uses HTTP Basic Authentication—your Private API key is securely encrypted by the SSL channel.

If you are testing the API calls via the command line with cURL, try:

curl -H 'Accept: application/xml' \
     -H 'X-Api-Version: 2.9' \
     -H 'Content-Type: application/xml; charset=utf-8' \
     -u '[apikey]' \
    https://[subdomain].recurly.com/v2/accounts

Replace [apikey] and [subdomain] with the appropriate values for your site.

Calculating your own authorization header

Most programming languages encode the authorization header automatically. With HTTP Basic Authentication, the Authorization header is a string containing a Base-64 encoded username and password. In the case of Recurly’s API, you need only specify the username as your API key. If your library requires a password, set it to an empty string.

"Authorization": "Basic " + base64_encode(API Key)

Additional Request Headers

Accept Header

Recurly API v2 returns results as XML. Your requests should always include the header requesting the results as XML:

Accept: application/xml

Content-Type Header

When sending data to Recurly in a POST or PUT request, your request must specify the content type of your request:

Content-Type: application/xml; charset=utf-8

X-Api-Version Header

When sending data to Recurly, your request should specify the API version you're attempting to interact with:

X-Api-Version: 2.9

You learn more about the different versions in the API Versioning section.

Acceptable API versions

Recurly supports the following API versions:2.2, 2.3, 2.4, 2.5, 2.6, 2.7,2.8,2.9

Public API Key

Recurly uses two types of API keys: public and private. The Public API key is used by Recurly.js to identify its requests as belonging to your Recurly site. This key can be safely included in Javascript code.

Recurly provides each site with one Public Key. The Public API Key can be regenerated on the API Credentials page.

Private API Keys

Treat your Private API Keys like passwords!

The API key allows access to your site's data. Do not include it in Javascript code exposed to browsers.

Recurly supports the use of multiple Private API keys, which can be used to integrate third party services using unique, controlled credentials.

Limits & Pricing

Merchants on the Core or grandfathered Recurly plans or merchants in sandbox mode will be granted 5 private API keys. Merchants on Recurly’s Professional plan will be granted 10 private API keys.

Default Key

Your default private API key should be used to integrate Recurly with your backend systems. There will be at least one key active at all times.

Additional Keys

Additional private API keys should be used to connect your Recurly data to additional sources, like analytics software, accounting packages, or email tools. Recurly recommends clearly labeling the name of each key to identify the associated vendor.

Regenerating Private API Keys

Your API key can be regenerated by clicking on the Regenerate button on the API credentials page. When you generate a private API key, you have two options:

  1. Block the old key immediately. This is primarily recommended when the security of a key has been compromised.
  2. Allow the old key access for 12 hours. This is primarily used when updating systems and a smooth transition between keys is needed.

If a private API key is changed, an email alert will be sent to your Recurly Site Technical Contact.

Read-Only Keys

When creating a private key, you will have the option to set the key to “read-only”. This means the API key may make GET requests but cannot not PUT, POST or DELETE requests.

View all 117 endpoints
{"_id":"5a0f6108823e2900127fd236","category":"5a0f6108823e2900127fd211","user":"559d85d26b21311700fb0b7b","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-18T22:26:12.882Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Recurly strives to provide developers with stable APIs to integrate against while still being able to provide new and expanded functionality. To balance these two goals we provide different API versions and only add new features to the latest version of the API. This allows you to choose the best time to update your integration and take advantage of new features.\n\nRecurly offers the following API versions:  [2.9](https://dev.recurly.com/v2.9/docs), [2.8](https://dev.recurly.com/v2.8/docs),  [2.7](https://dev.recurly.com/v2.7/docs), [2.6](https://dev.recurly.com/v2.6/docs), [2.5](https://dev.recurly.com/v2.5/docs), [2.4](https://dev.recurly.com/v2.4/docs), [2.3](https://dev.recurly.com/v2.3/docs), [2.2](https://dev.recurly.com/v2.2/docs).\n\n## Requesting A Version\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"API Version Deprecation\",\n  \"body\": \"As a matter of policy, API versions will remain supported by Recurly for 2 years after they are released. After this time period, the API versions will be deprecated and no longer supported, but will still function.\\n\\nAPI versions 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6 will be deprecated on May 1, 2019. Once deprecated, Recurly will no longer support these versions and any associated client libraries, but calls to these versions will function normally. You should expect that updates may include changes to product usability and integrations, so we recommend starting the update process as soon as possible.\\n\\nAPI versions 2.0-2.6 will reach their end of life on November 1, 2019. On and after this date, these API versions will no longer function.\\n\\nWe will be happy to assist you in upgrading to the current API version. Please reach out to us at [email protected] if you have any questions with this documentation.\"\n}\n[/block]\n\nWhen making requests to Recurly, your request should specify the desired API version using the `X-Api-Version` header:\n```\nX-Api-Version: 2.9\n```\nFor backwards compatibility, if no version is specified the default is 2.0.\n\n## Deprecation\n\nTo signal that an API version is deprecated and will be removed in the future, Recurly will respond the following headers:\n```\nRecurly-Deprecated: TRUE\nRecurly-Sunset-Date: 2018-06-01T00:00:00+00:00\n```\nThe sunset date is an ISO 8601 date time when the version will no longer be accessible.\n\nYour integration should check for those headers so you can make updates in a timely fashion.\n\n## Changes in v2.9\n\nRoute changes:\n\n- Added `POST /v2/purchases/authorize`\n\nRequest and Response Changes:\n\n- Changed `GET /v2/adjustments/:adjustment_id`\n  - Changed `<subscription>`\n    - path: `<subscription href=\"\"></subscription>`\n    - description: tag is only returned if adjustment is originating from a subscription plan\n      charge, setup fee, add on, trial or proration credit.  It is no longer\n      returned for other adjustments\n  - Added `<proration_rate>`\n    - path: `<proration_rate type=\"float\">0.500</proration_rate>`\n    - description: The proration rate is only present on prorated adjustments. It represents how much the adjustment\n      was prorated to account for a mid cycle subscription change.\n- Changed `<invoice>` and `<transaction>` responses\n  - Removed deprecated singular `<subscription>` links. Now only plural `<subscriptions>`\n    links are returned.\n- Changed `GET /v2/subscriptions` and `GET /v2/account/:account_code/subscriptions`\n  to accept a `started_with_gift` parameter. It can generate some slower queries\n  so we're going to leave it out of the public docs.\n\nA complete list of changes for all versions is available on the [API Release Notes](https://dev.recurly.com/page/api-release-notes) page.","excerpt":"","slug":"versioning","type":"basic","title":"API Versioning","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

API Versioning


Recurly strives to provide developers with stable APIs to integrate against while still being able to provide new and expanded functionality. To balance these two goals we provide different API versions and only add new features to the latest version of the API. This allows you to choose the best time to update your integration and take advantage of new features.

Recurly offers the following API versions: 2.9, 2.8, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2.

Requesting A Version

API Version Deprecation

As a matter of policy, API versions will remain supported by Recurly for 2 years after they are released. After this time period, the API versions will be deprecated and no longer supported, but will still function.

API versions 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, and 2.6 will be deprecated on May 1, 2019. Once deprecated, Recurly will no longer support these versions and any associated client libraries, but calls to these versions will function normally. You should expect that updates may include changes to product usability and integrations, so we recommend starting the update process as soon as possible.

API versions 2.0-2.6 will reach their end of life on November 1, 2019. On and after this date, these API versions will no longer function.

We will be happy to assist you in upgrading to the current API version. Please reach out to us at [email protected] if you have any questions with this documentation.

When making requests to Recurly, your request should specify the desired API version using the X-Api-Version header:

X-Api-Version: 2.9

For backwards compatibility, if no version is specified the default is 2.0.

Deprecation

To signal that an API version is deprecated and will be removed in the future, Recurly will respond the following headers:

Recurly-Deprecated: TRUE
Recurly-Sunset-Date: 2018-06-01T00:00:00+00:00

The sunset date is an ISO 8601 date time when the version will no longer be accessible.

Your integration should check for those headers so you can make updates in a timely fashion.

Changes in v2.9

Route changes:

  • Added POST /v2/purchases/authorize

Request and Response Changes:

  • Changed GET /v2/adjustments/:adjustment_id
    • Changed <subscription>
      • path: <subscription href=""></subscription>
      • description: tag is only returned if adjustment is originating from a subscription plan
        charge, setup fee, add on, trial or proration credit. It is no longer
        returned for other adjustments
    • Added <proration_rate>
      • path: <proration_rate type="float">0.500</proration_rate>
      • description: The proration rate is only present on prorated adjustments. It represents how much the adjustment
        was prorated to account for a mid cycle subscription change.
  • Changed <invoice> and <transaction> responses
    • Removed deprecated singular <subscription> links. Now only plural <subscriptions>
      links are returned.
  • Changed GET /v2/subscriptions and GET /v2/account/:account_code/subscriptions
    to accept a started_with_gift parameter. It can generate some slower queries
    so we're going to leave it out of the public docs.

A complete list of changes for all versions is available on the API Release Notes page.

{"_id":"5a0f6108823e2900127fd237","category":"5a0f6108823e2900127fd211","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:48:39.567Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"language":"json","status":400,"name":"","code":"{}"}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Next Link\"\n}\n[/block]\nThe amount of records returns within a single API request defaults to 50. It may be changed to a maximum of 200 using a `per_page` query parameter, e.g. to return 200 accounts at a time:\n\n```\nhttps://your-subdomain.recurly.com/v2/accounts?per_page=200\n```\n\nWhen there are more records remaining than fit in the current response, the `Link` header is specified with the URI to the next page of results.\n\n```\nStatus: 200 OK \nLink: <https://your-subdomain.recurly.com/v2/accounts?cursor=1972702718353176814%3A1465932489>; rel=\"next\" \nETag: \"a4b0568a2278bc591ceb64b31547eb78\" \n```\n\nThe `cursor` parameter is a time-based pointer indicating where to resume the results. By using a cursor instead of page numbers, the API avoids returning duplicate records in the case where additional resources are added between pagination requests.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Sorting and Filtering\"\n}\n[/block]\n Many endpoints support these advanced pagination parameters:\n\n* `sort` : String: The attribute that will be used to order records: `created_at`, `updated_at`. Defaults to `created_at`.\n* `order` : String : The order in which products will be returned: `asc` for ascending order, `desc` for descending order. Defaults to `desc`.\n* `begin_time` : Datetime : Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.\n* `end_time` : Datetime : Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.\n\nReview the parameters on each endpoint for more details.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"An account that was updated on `2016-01-19` and then again on `2016-03-23` would not be returned in a request for `sort=updated_at&end_time=2016-03-01`.\",\n  \"title\": \"Updated at really means last updated at\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Counting Records\"\n}\n[/block]\nStarting with API version 2.6, you must explicitly make a `HEAD` request to get the server count. Endpoints that return a list of resources will respond to this request and include a header indicating the total number of records available. They will not contain the xml body. The server count is specified with the `X-Records` header. E.g., for an endpoint with 14 records:\n\n```\nX-Records: 14\n```\n\nYou can pass filtering parameters (described above) to narrow down the resources you wish to count. Consider the example of counting all `collected` invoices in `2016`. You can send a `HEAD` request to this endpoint then parse the count from the X-Records response header:\n\n```\nhttps://your-subdomain.recurly.com/v2/invoices?begin_time=2016-01-01T00:00:00&end_time=2017-01-01T00:00:00&state=collected\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples\"\n}\n[/block]\nThis will return accounts that were created on or before 2016-01-01 0:00 UTC in descending order of creation date:\n```\nhttps://your-subdomain.recurly.com/v2/accounts?sort=created_at&order=desc&end_time=2016-01-01\n```\n\nThis will return accounts that were last updated on or after 2016-07-01 10:30:01 Mountain Daylight Time in ascending order of updated date:\n\n```\nhttps://your-subdomain.recurly.com/v2/accounts?sort=updated_at&order=asc&begin_time=2016-07-01T10:30:01-06:00\n```\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"It's important to be aware that when paging through records sorted by their `updated_at` value, the order will change if they are modified:\\n* In ascending order, changes to records in previous pages will cause them to move back the end of the list, meaning you may see them multiple times. This can be avoided by using the time the pagination starts as the `end_time`.\\n* In descending order, changes to records in later pages will cause them to move up to the beginning of the list, meaning you would miss results.\",\n  \"title\": \"Beware of changes to records when sorting by updated_at\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n// When accessing a sub resource with a many-to-one relation\\n// to the parent model, the attribute returns a Recurly_Stub.\\n// For example, take Account -> Invoices\\n\\n$account = Recurly_Account::get('my_account_code');\\n\\n// Calling ->invoices returns a Stub which allows lazily loading the list\\n$invoices = $account->invoices;\\n\\nprint $invoices;\\n// => <Recurly_Stub[invoices] href=https://api.recurly.com/v2/accounts/my_account_code/invoices>\\n\\n/**\\n * Prior to 2.5.0 calling ->get() would only return the first page\\n * of results. With 2.5.0 and later, all results will be returned.\\n */\\nforeach ($invoices->get() as $inv) {\\n   print $inv->invoice_number . \\\"\\\\n\\\";\\n}\\n\\n/**\\n * Creating a List object directly will also allow you to iterate\\n * through all pages\\n */\\n$invoices = Recurly_InvoiceList::getForAccount('my_account_code');\\n\\n// Prints all invoices on the account\\nforeach ($invoices as $inv) {\\n   print $inv->invoice_number . \\\"\\\\n\\\";\\n}\\n\",\n      \"language\": \"php\",\n      \"gist\": \"44632c432dce4f56a0fa\"\n    },\n    {\n      \"code\": \"# Pagination in the ruby client is done using\\n# the Recurly::Pager class.\\n\\n# You can also create a Pager directly from any resource\\nRecurly::Invoice.paginate.class\\n#=> Recurly::Resource::Pager\\n\\n# paginate optionally takes the sorting and filtering params\\n# if you want to specify them\\nopts = {\\n  begin_time: DateTime.new(2016,1,1),\\n  end_time: DateTime.new(2017,1,1),\\n  state: :collected,\\n  per_page: 10\\n}\\n\\n# find_each will fetch the pages for you\\n# until there are none left. It presents\\n# all the invoices on the server as a single enumerable\\nRecurly::Invoice.paginate(opts).find_each do |invoice|\\n  puts invoice.invoice_number\\nend\\n\\n# You can also use #find_each directly on the resource\\nRecurly::Invoice.find_each do |invoice|\\n  puts invoice.invoice_number\\nend\\n\\n# When accessing a sub resource with a many-to-one relation \\n# to the parent model, the attribute returns a Recurly::Resource::Pager. \\n# For example, take Account -> Invoices\\naccount = Recurly::Account.find('my_account_code')\\n\\naccount.invoices.class\\n#=> Recurly::Resource::Pager\\n\\n# Pager#each can be used to iterate through the only the given page\\naccount.invoices.each do |invoice|\\n  puts invoice.invoice_number\\nend\\n\\n# The default page size is 50 items, if you wish to page through more\\n# you can use Pager#find_each, find_each continues to fetch pages until\\n# there are none left\\naccount.invoices.find_each do |invoice|\\n  puts invoice.invoice_number\\nend\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"# When accessing a sub resource with a many-to-one relation\\n# to the parent model, the attribute returns a `relatiator` function.\\n# When called it returns a recurly.resource.Page.\\n# For example, take Account -> Invoices\\n\\naccount = recurly.Account.get('tester')\\n\\nprint account.invoices\\n# => <function relatitator at 0x1023628c0>\\n\\nprint account.invoices().__class__\\n# => <class 'recurly.resource.Page'>\\n\\n# To page through every invoice on the account\\nfor invoice in account.invoices():\\n    print invoice.invoice_number\\n\\n# You can also call the all() method on\\n# a resource to page through every resource\\n# on your site. For instance, to page through\\n# every invoice:\\nfor invoice in recurly.Invoice.all():\\n    print invoice.invoice_number\",\n      \"language\": \"python\",\n      \"name\": null\n    },\n    {\n      \"code\": \"using System.Linq;\\n\\nvar accounts = Accounts.List();\\nwhile (accounts.Any())\\n{\\n    foreach (var account in accounts)\\n        Console.WriteLine(account);\\n    accounts = accounts.Next;\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"The PHP `Recurly_Pager` class sets up an iterator across all the relevant records. It does not provide pagination functionality by default.\",\n  \"title\": \"PHP Pagination\"\n}\n[/block]","excerpt":"","slug":"pagination","type":"basic","title":"Pagination","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Pagination


Next Link

The amount of records returns within a single API request defaults to 50. It may be changed to a maximum of 200 using a per_page query parameter, e.g. to return 200 accounts at a time:

https://your-subdomain.recurly.com/v2/accounts?per_page=200

When there are more records remaining than fit in the current response, the Link header is specified with the URI to the next page of results.

Status: 200 OK 
Link: <https://your-subdomain.recurly.com/v2/accounts?cursor=1972702718353176814%3A1465932489>; rel="next" 
ETag: "a4b0568a2278bc591ceb64b31547eb78"

The cursor parameter is a time-based pointer indicating where to resume the results. By using a cursor instead of page numbers, the API avoids returning duplicate records in the case where additional resources are added between pagination requests.

Sorting and Filtering

Many endpoints support these advanced pagination parameters:

  • sort : String: The attribute that will be used to order records: created_at, updated_at. Defaults to created_at.
  • order : String : The order in which products will be returned: asc for ascending order, desc for descending order. Defaults to desc.
  • begin_time : Datetime : Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
  • end_time : Datetime : Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.

Review the parameters on each endpoint for more details.

Updated at really means last updated at

An account that was updated on 2016-01-19 and then again on 2016-03-23 would not be returned in a request for sort=updated_at&end_time=2016-03-01.

Counting Records

Starting with API version 2.6, you must explicitly make a HEAD request to get the server count. Endpoints that return a list of resources will respond to this request and include a header indicating the total number of records available. They will not contain the xml body. The server count is specified with the X-Records header. E.g., for an endpoint with 14 records:

X-Records: 14

You can pass filtering parameters (described above) to narrow down the resources you wish to count. Consider the example of counting all collected invoices in 2016. You can send a HEAD request to this endpoint then parse the count from the X-Records response header:

https://your-subdomain.recurly.com/v2/invoices?begin_time=2016-01-01T00:00:00&end_time=2017-01-01T00:00:00&state=collected

Examples

This will return accounts that were created on or before 2016-01-01 0:00 UTC in descending order of creation date:

https://your-subdomain.recurly.com/v2/accounts?sort=created_at&order=desc&end_time=2016-01-01

This will return accounts that were last updated on or after 2016-07-01 10:30:01 Mountain Daylight Time in ascending order of updated date:

https://your-subdomain.recurly.com/v2/accounts?sort=updated_at&order=asc&begin_time=2016-07-01T10:30:01-06:00

Beware of changes to records when sorting by updated_at

It's important to be aware that when paging through records sorted by their updated_at value, the order will change if they are modified:

  • In ascending order, changes to records in previous pages will cause them to move back the end of the list, meaning you may see them multiple times. This can be avoided by using the time the pagination starts as the end_time.
  • In descending order, changes to records in later pages will cause them to move up to the beginning of the list, meaning you would miss results.
<?php
// When accessing a sub resource with a many-to-one relation
// to the parent model, the attribute returns a Recurly_Stub.
// For example, take Account -> Invoices

$account = Recurly_Account::get('my_account_code');

// Calling ->invoices returns a Stub which allows lazily loading the list
$invoices = $account->invoices;

print $invoices;
// => <Recurly_Stub[invoices] href=https://api.recurly.com/v2/accounts/my_account_code/invoices>

/**
 * Prior to 2.5.0 calling ->get() would only return the first page
 * of results. With 2.5.0 and later, all results will be returned.
 */
foreach ($invoices->get() as $inv) {
   print $inv->invoice_number . "\n";
}

/**
 * Creating a List object directly will also allow you to iterate
 * through all pages
 */
$invoices = Recurly_InvoiceList::getForAccount('my_account_code');

// Prints all invoices on the account
foreach ($invoices as $inv) {
   print $inv->invoice_number . "\n";
}
# Pagination in the ruby client is done using
# the Recurly::Pager class.

# You can also create a Pager directly from any resource
Recurly::Invoice.paginate.class
#=> Recurly::Resource::Pager

# paginate optionally takes the sorting and filtering params
# if you want to specify them
opts = {
  begin_time: DateTime.new(2016,1,1),
  end_time: DateTime.new(2017,1,1),
  state: :collected,
  per_page: 10
}

# find_each will fetch the pages for you
# until there are none left. It presents
# all the invoices on the server as a single enumerable
Recurly::Invoice.paginate(opts).find_each do |invoice|
  puts invoice.invoice_number
end

# You can also use #find_each directly on the resource
Recurly::Invoice.find_each do |invoice|
  puts invoice.invoice_number
end

# When accessing a sub resource with a many-to-one relation 
# to the parent model, the attribute returns a Recurly::Resource::Pager. 
# For example, take Account -> Invoices
account = Recurly::Account.find('my_account_code')

account.invoices.class
#=> Recurly::Resource::Pager

# Pager#each can be used to iterate through the only the given page
account.invoices.each do |invoice|
  puts invoice.invoice_number
end

# The default page size is 50 items, if you wish to page through more
# you can use Pager#find_each, find_each continues to fetch pages until
# there are none left
account.invoices.find_each do |invoice|
  puts invoice.invoice_number
end
# When accessing a sub resource with a many-to-one relation
# to the parent model, the attribute returns a `relatiator` function.
# When called it returns a recurly.resource.Page.
# For example, take Account -> Invoices

account = recurly.Account.get('tester')

print account.invoices
# => <function relatitator at 0x1023628c0>

print account.invoices().__class__
# => <class 'recurly.resource.Page'>

# To page through every invoice on the account
for invoice in account.invoices():
    print invoice.invoice_number

# You can also call the all() method on
# a resource to page through every resource
# on your site. For instance, to page through
# every invoice:
for invoice in recurly.Invoice.all():
    print invoice.invoice_number
using System.Linq;

var accounts = Accounts.List();
while (accounts.Any())
{
    foreach (var account in accounts)
        Console.WriteLine(account);
    accounts = accounts.Next;
}

PHP Pagination

The PHP Recurly_Pager class sets up an iterator across all the relevant records. It does not provide pagination functionality by default.

{"_id":"5a0f6108823e2900127fd238","category":"5a0f6108823e2900127fd211","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:49:59.038Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"In order to provide a fast response time to all our customers, we may rate limit excessive requests. By default, new Recurly sites have the following API rate limits:\n\n* Sandbox sites: 400 requests/min. All requests count towards the rate limit.\n* Production sites: 1,000 requests/min. Only GET and HEAD requests count towards the rate limit.\n\nOnce your site moves into production mode, Recurly will only rate limit GET and HEAD requests. New subscriptions, account modifications, and other requests using POST, PUT, or DELETE methods will not count against your rate limit.\n\nThe rate limit is calculated over a sliding 5 minute window. This means a production site could make 4,000 requests within one minute and not hit the rate limit so long as the site made less than 1,000 requests during the prior 4 minutes.\n\nWhen your site reaches its rate limit, your site technical contact will receive an email alerting them of the issue. This email will be sent not more than once every three hours. Our support team will also be notified. Please reach out to Recurly support if you need assistance in resolving this issue.\n\nIf an API request exceeds the rate limit, the API returns a 429 status code indicating `Too Many Requests`. If your business needs a higher limit, please contact support.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"HTTP Headers\"\n}\n[/block]\nEvery authenticated API request returns headers with your current rate limit information. Your requests’ rate limit headers may look like:\n\n```\nX-RateLimit-Limit: 5000\nX-RateLimit-Remaining: 4999\nX-RateLimit-Reset: 1414622019\n```\n\nThe `X-RateLimit-Limit` is your total request limit during the 5 minute window (e.g. requests/min * 5 min). The `X-RateLimit-Remaining` indicates the number of requests remaining until your requests will be denied. Finally, the `X-RateLimit-Reset` header contains a timestamp for when the current window will completely reset assuming no further API requests are made.","excerpt":"","slug":"rate-limits","type":"basic","title":"Rate Limits","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Rate Limits


In order to provide a fast response time to all our customers, we may rate limit excessive requests. By default, new Recurly sites have the following API rate limits:

  • Sandbox sites: 400 requests/min. All requests count towards the rate limit.
  • Production sites: 1,000 requests/min. Only GET and HEAD requests count towards the rate limit.

Once your site moves into production mode, Recurly will only rate limit GET and HEAD requests. New subscriptions, account modifications, and other requests using POST, PUT, or DELETE methods will not count against your rate limit.

The rate limit is calculated over a sliding 5 minute window. This means a production site could make 4,000 requests within one minute and not hit the rate limit so long as the site made less than 1,000 requests during the prior 4 minutes.

When your site reaches its rate limit, your site technical contact will receive an email alerting them of the issue. This email will be sent not more than once every three hours. Our support team will also be notified. Please reach out to Recurly support if you need assistance in resolving this issue.

If an API request exceeds the rate limit, the API returns a 429 status code indicating Too Many Requests. If your business needs a higher limit, please contact support.

HTTP Headers

Every authenticated API request returns headers with your current rate limit information. Your requests’ rate limit headers may look like:

X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
X-RateLimit-Reset: 1414622019

The X-RateLimit-Limit is your total request limit during the 5 minute window (e.g. requests/min * 5 min). The X-RateLimit-Remaining indicates the number of requests remaining until your requests will be denied. Finally, the X-RateLimit-Reset header contains a timestamp for when the current window will completely reset assuming no further API requests are made.

{"_id":"5a0f6108823e2900127fd239","category":"5a0f6108823e2900127fd211","parentDoc":null,"user":"5564a0073a61a72f0067cb22","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["56cd46e949abf10b0036a1e6","59b1583ffff23e00100d1937"],"next":{"pages":[],"description":""},"createdAt":"2015-06-10T22:06:26.211Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"## SUCCESSFUL STATUS CODES (2XX)\n`200 OK`\nThe request was successful.\n`201 Created`\nThe resource was successfully created. Confirms a success when creating a new account, credit, subscription, etc.\n`204 No Content`\nThe request was successful and there is no response body.\n\n## CLIENT ERROR STATUS CODES (4XX)\n`400 Bad Request`\nThe request was invalid or could not be understood by the server. Resubmitting the request will likely result in the same error. This commonly occurs when your XML is invalid, e.g. ampersands are not correctly encoded in the text of your request. Please inspect the body of the response for more details regarding the error.\n`401 Unauthorized`\nYour API key is missing or invalid.\n`402 Payment Required`\nYour Recurly account is in production mode but is not in good standing. Please pay any outstanding invoices.\n`403 Forbidden`\nThe login is attempting to perform an action it does not have privileges to access. Verify your login credentials are for the appropriate account.\n`404 Not Found`\nThe resource was not found with the given identifier. The response body will explain which resource was not found.\n`405 Method Not Allowed`\nThe requested method is not valid at the given URL.\n`406 Not Acceptable`\nThe request's Accept header is not set to application/xml.\n`412 Precondition Failed`\nThe request was unsuccessful because a condition was not met. For example, this message may be returned if you attempt to cancel a subscription for an account that has no subscription.\n`422 Unprocessable Entity`\nCould not process a POST or PUT request because the request is invalid. See the response body for more details.\n`429 Too many Requests`\nYou have made too many API requests in the last hour. Future API requests will be ignored until the beginning of the next hour.\n\n## SERVER ERROR STATUS CODES (5XX)\n`500 Internal Server Error`\nThe server encountered an error while processing your request and failed.\n`502 Gateway Error`\nThe load balancer or web server has trouble connecting to the Recurly app. Please try the request again.\n`503 Service Unavailable`\nThe service is temporarily unavailable. Please try the request again.\n\n##FUTURE COMPATIBILITY\nFor future compatibility, please interpret the following status code ranges:\n\n**200–299** as success,\n**400–499** as client request errors,\n**500–599** as server errors\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"404 Not Found Responses\"\n}\n[/block]\nWhen a lookup, update, or delete request is requested on an object that does not exist, the server returns `404 Not Found`:\n\n```\nStatus: 404 Not Found\nContent-Type: application/xml; charset=utf-8\n```\n\n```\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<error>\n  <symbol>not_found</symbol>\n  <description>The record could not be located.</description>\n</error>\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"422 Unprocessable Entity Responses\"\n}\n[/block]\nIf the requested create, update, or delete cannot be performed due to validation errors, the server returns a `422 Unprocessable Entity` response with either an array of the validation errors or a single error:\n\n```\nStatus: 422 Unprocessable Entity\nContent-Type: application/xml; charset=utf-8\n```\n\n```\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>\n  <error field=\"model_name.field_name\" symbol=\"not_a_number\" lang=\"en-US\">is not a number</error>\n</errors>\n```\n\n```\n<error>\n  <symbol>simultaneous_request</symbol>\n  <description>\n    A change for subscription 3cf89f0c3fcda0b15c50134f63856d4e is already in progress.\n  </description>\n</error>\n```","excerpt":"Every request includes an HTTP status code with the result. The status code should examined before the response. In most error cases, the response body will contain an errors XML document with more details.","slug":"welcome","type":"basic","title":"HTTP Status Codes","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

HTTP Status Codes

Every request includes an HTTP status code with the result. The status code should examined before the response. In most error cases, the response body will contain an errors XML document with more details.

SUCCESSFUL STATUS CODES (2XX)

200 OK
The request was successful.
201 Created
The resource was successfully created. Confirms a success when creating a new account, credit, subscription, etc.
204 No Content
The request was successful and there is no response body.

CLIENT ERROR STATUS CODES (4XX)

400 Bad Request
The request was invalid or could not be understood by the server. Resubmitting the request will likely result in the same error. This commonly occurs when your XML is invalid, e.g. ampersands are not correctly encoded in the text of your request. Please inspect the body of the response for more details regarding the error.
401 Unauthorized
Your API key is missing or invalid.
402 Payment Required
Your Recurly account is in production mode but is not in good standing. Please pay any outstanding invoices.
403 Forbidden
The login is attempting to perform an action it does not have privileges to access. Verify your login credentials are for the appropriate account.
404 Not Found
The resource was not found with the given identifier. The response body will explain which resource was not found.
405 Method Not Allowed
The requested method is not valid at the given URL.
406 Not Acceptable
The request's Accept header is not set to application/xml.
412 Precondition Failed
The request was unsuccessful because a condition was not met. For example, this message may be returned if you attempt to cancel a subscription for an account that has no subscription.
422 Unprocessable Entity
Could not process a POST or PUT request because the request is invalid. See the response body for more details.
429 Too many Requests
You have made too many API requests in the last hour. Future API requests will be ignored until the beginning of the next hour.

SERVER ERROR STATUS CODES (5XX)

500 Internal Server Error
The server encountered an error while processing your request and failed.
502 Gateway Error
The load balancer or web server has trouble connecting to the Recurly app. Please try the request again.
503 Service Unavailable
The service is temporarily unavailable. Please try the request again.

FUTURE COMPATIBILITY

For future compatibility, please interpret the following status code ranges:

200–299 as success,
400–499 as client request errors,
500–599 as server errors

404 Not Found Responses

When a lookup, update, or delete request is requested on an object that does not exist, the server returns 404 Not Found:

Status: 404 Not Found
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <symbol>not_found</symbol>
  <description>The record could not be located.</description>
</error>

422 Unprocessable Entity Responses

If the requested create, update, or delete cannot be performed due to validation errors, the server returns a 422 Unprocessable Entity response with either an array of the validation errors or a single error:

Status: 422 Unprocessable Entity
Content-Type: application/xml; charset=utf-8
<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error field="model_name.field_name" symbol="not_a_number" lang="en-US">is not a number</error>
</errors>
<error>
  <symbol>simultaneous_request</symbol>
  <description>
    A change for subscription 3cf89f0c3fcda0b15c50134f63856d4e is already in progress.
  </description>
</error>
{"_id":"5a0f6108823e2900127fd22b","category":"5a0f6108823e2900127fd213","user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","parentDoc":null,"version":"5a0f6108823e2900127fd210","updates":["55940e20fd29b92300c262bf","55b2bfc0a74a380d00e290a6","55b2c0466862a10d00887adf","55bbb926a8400c2d00873f2a","565f689e413e06170093df6a","58d2b9a19c99c92f00646f8e","5977a75032f043002002f6d9","59b738dba50f750030f42a78","59ccac98e30e6c00300cef7d"],"next":{"pages":[],"description":""},"createdAt":"2015-06-26T18:25:56.960Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Recurly has a variety of official client libraries you should check out!\n\n[PHP](https://dev.recurly.com/page/php)\n[Ruby](https://dev.recurly.com/page/ruby)\n[Python](https://dev.recurly.com/page/python)\n[Java](https://github.com/killbilling/recurly-java-library)\n[.Net](https://dev.recurly.com/page/net)\niOS – [Github](https://github.com/recurly/recurly-client-ios) | [Documentation](http://cocoadocs.org/docsets/RecurlySDK/)\n[Android](https://github.com/recurly/recurly-client-android)\n\nThere are also some unofficial libraries created by our users:\n\n[GO](https://github.com/blacklightcms/recurly)\n[Node.js](https://github.com/cgerrior/node-recurly)\n[Elixir](https://github.com/bhelx/recurly-client-elixir)","excerpt":"","slug":"client-libraries","type":"basic","title":"Client Libraries","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Client Libraries


Recurly has a variety of official client libraries you should check out!

PHP
Ruby
Python
Java
.Net
iOS – Github | Documentation
Android

There are also some unofficial libraries created by our users:

GO
Node.js
Elixir

{"_id":"5a0f6109823e2900127fd248","category":"5a0f6108823e2900127fd215","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["56cec52444c5700b0095c02b"],"next":{"pages":[],"description":""},"createdAt":"2015-08-31T20:16:33.273Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"","language":"text"}]},"method":"get","results":{"codes":[{"language":"xml","code":"<account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n  <billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\"/>\n  <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n  <redemptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/redemptions\"/>\n  <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n  <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n  <account_code>1</account_code>\n  <state>active</state>\n  <username>verena1234</username>\n  <email>[email protected]</email>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company_name>New Company Name</company_name>\n  <vat_number nil=\"nil\"/>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <address>\n    <address1>123 Main St.</address1>\n    <address2 nil=\"nil\"/>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <phone nil=\"nil\"/>\n  </address>\n  <accept_language nil=\"nil\"/>\n  <has_live_subscription type=\"boolean\">true</has_live_subscription>\n  <has_active_subscription type=\"boolean\">true</has_active_subscription>\n  <has_future_subscription type=\"boolean\">false</has_future_subscription>\n  <has_canceled_subscription type=\"boolean\">false</has_canceled_subscription>\n  <has_past_due_invoice type=\"boolean\">false</has_past_due_invoice>\n  <hosted_login_token>96e74bd5e14d18e6da463a0d638a2621</hosted_login_token>\n  <created_at type=\"datetime\">2016-07-08T20:59:43Z</created_at>\n  <updated_at type=\"datetime\">2016-07-11T17:56:24Z</updated_at>\n  <closed_at nil=\"nil\"/>\n</account>","name":"","status":200}]},"settings":"","auth":"required","params":[{"_id":"557f45d07eafa719001d1c2b","ref":"","in":"body","required":false,"desc":"The URL of adjustments for the specified account.","default":"","type":"string","name":"adjustments"},{"_id":"57a21cf65220910e002a1764","ref":"","in":"body","required":false,"desc":"The URL of the account balance for the specified account.","default":"","type":"string","name":"account_balance"},{"_id":"557f45d07eafa719001d1c2a","ref":"","in":"body","required":false,"desc":"The URL of billing info for the specified account.","default":"","type":"string","name":"billing_info"},{"_id":"557f45d07eafa719001d1c29","ref":"","in":"body","required":false,"desc":"The URL of invoices for the specified account.","default":"","type":"string","name":"invoices"},{"_id":"55e4aa556f190c1900a40881","ref":"","in":"body","required":false,"desc":"The URL of the coupon redemption for the specified account.","default":"","type":"string","name":"redemption"},{"_id":"55e4aa556f190c1900a40880","ref":"","in":"body","required":false,"desc":"The URL of subscriptions for the specified account.","default":"","type":"string","name":"subscriptions"},{"_id":"55e4aa556f190c1900a4087f","ref":"","in":"body","required":false,"desc":"The URL of transactions for the specified account.","default":"","type":"string","name":"transactions"},{"_id":"55e4aa556f190c1900a4087e","ref":"","in":"body","required":false,"desc":"The unique identifier of the account.","default":"","type":"string","name":"account_code"},{"_id":"55e4aa556f190c1900a4087d","ref":"","in":"body","required":false,"desc":"The state of accounts to return: `active` or `closed`.","default":"","type":"string","name":"state"},{"_id":"55e4aa556f190c1900a4087c","ref":"","in":"body","required":false,"desc":"The username of the account.","default":"","type":"string","name":"username"},{"_id":"55e4aa556f190c1900a4087b","ref":"","in":"body","required":false,"desc":"The email address of the account.","default":"","type":"string","name":"email"},{"_id":"560b18973bcbd80d0077d0c0","ref":"","in":"body","required":false,"desc":"Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.","default":"","type":"array_string","name":"cc_emails"},{"_id":"55e4aa556f190c1900a4087a","ref":"","in":"body","required":false,"desc":"The first name of the account.","default":"","type":"string","name":"first_name"},{"_id":"55e4aa556f190c1900a40879","ref":"","in":"body","required":false,"desc":"The last name of the account.","default":"","type":"string","name":"last_name"},{"_id":"55e4aa556f190c1900a40878","ref":"","in":"body","required":false,"desc":"The company name of the account.","default":"","type":"string","name":"company_name"},{"_id":"55e4aa556f190c1900a40877","ref":"","in":"body","required":false,"desc":"The VAT number of the account (to avoid having the VAT applied).","default":"","type":"string","name":"vat_number"},{"_id":"55e4aa556f190c1900a40876","ref":"","in":"body","required":false,"desc":"The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.","default":"","type":"boolean","name":"tax_exempt"},{"_id":"55e4aa556f190c1900a40875","ref":"","in":"body","required":false,"desc":"The nested address information of the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.","default":"","type":"object","name":"address"},{"_id":"57fffdd8c7609a0f0063caaf","ref":"","in":"body","required":false,"desc":"The nested shipping address information of the account: `first_name`, `last_name`, `company_name`, `email`, `phone`, `vat_number`,  `address1`, `address2`, `city`, `state`, `zip`, `country`, `nickname`. You can pass in up to 20 account shipping addresses along with the request to create a new account. When providing a shipping address, the following are required: first_name, last_name, address1, city, state, zip, and country.","default":"","type":"object","name":"shipping_address"},{"_id":"55e4aa556f190c1900a40874","ref":"","in":"body","required":false,"desc":"The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.","default":"","type":"string","name":"accept_language"},{"_id":"55e4aa556f190c1900a40873","ref":"","in":"body","required":false,"desc":"The unique token for automatically logging the account in to the hosted management pages. You may automatically log the user into their hosted management pages by directing the user to: `https://:subdomain.recurly.com/account/:hosted_login_token`.","default":"","type":"string","name":"hosted_login_token"},{"_id":"55e4aa556f190c1900a40872","ref":"","in":"body","required":false,"desc":"The date and time the account was created in Recurly.","default":"","type":"datetime","name":"created_at"},{"_id":"5783dc55359cd219005453ec","ref":"","in":"body","required":false,"desc":"The date and time the account or its billing info was last updated.","default":"","type":"datetime","name":"updated_at"},{"_id":"5783dcff359cd219005453ee","ref":"","in":"body","required":false,"desc":"For closed accounts, the date and time it was closed.","default":"","type":"datetime","name":"closed_at"},{"_id":"58c8255f5cb4fe1b00ec5679","ref":"","in":"body","required":false,"desc":"True if the account has at least one live subscription.","default":"","type":"boolean","name":"has_live_subscription"},{"_id":"58c8255f5cb4fe1b00ec5678","ref":"","in":"body","required":false,"desc":"True if the account has at least one active subscription.","default":"","type":"boolean","name":"has_active_subscription"},{"_id":"58c8255f5cb4fe1b00ec5677","ref":"","in":"body","required":false,"desc":"True if the account has at least one future subscription.","default":"","type":"boolean","name":"has_future_subscription"},{"_id":"58c8255f5cb4fe1b00ec5676","ref":"","in":"body","required":false,"desc":"True if the account has at least one canceled subscription.","default":"","type":"boolean","name":"has_canceled_subscription"},{"_id":"58c8255f5cb4fe1b00ec5675","ref":"","in":"body","required":false,"desc":"True if the account has at least one past due invoice.","default":"","type":"boolean","name":"has_past_due_invoice"}],"url":"/accounts"},"isReference":true,"order":0,"body":"","excerpt":"Accounts are core to managing your customers inside of Recurly. The account object stores the entire Recurly history of your customer and acts as the entry point for working with a customer's billing information, subscription data, transactions, invoices and more.","slug":"account-object","type":"get","title":"Account Object","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getAccount Object

Accounts are core to managing your customers inside of Recurly. The account object stores the entire Recurly history of your customer and acts as the entry point for working with a customer's billing information, subscription data, transactions, invoices and more.

Body Params

adjustments:
string
The URL of adjustments for the specified account.
account_balance:
string
The URL of the account balance for the specified account.
billing_info:
string
The URL of billing info for the specified account.
invoices:
string
The URL of invoices for the specified account.
redemption:
string
The URL of the coupon redemption for the specified account.
subscriptions:
string
The URL of subscriptions for the specified account.
transactions:
string
The URL of transactions for the specified account.
account_code:
string
The unique identifier of the account.
state:
string
The state of accounts to return: `active` or `closed`.
username:
string
The username of the account.
email:
string
The email address of the account.
cc_emails:
array of strings
Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.
first_name:
string
The first name of the account.
last_name:
string
The last name of the account.
company_name:
string
The company name of the account.
vat_number:
string
The VAT number of the account (to avoid having the VAT applied).
tax_exempt:
boolean
The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
address:
object
The nested address information of the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.
shipping_address:
object
The nested shipping address information of the account: `first_name`, `last_name`, `company_name`, `email`, `phone`, `vat_number`, `address1`, `address2`, `city`, `state`, `zip`, `country`, `nickname`. You can pass in up to 20 account shipping addresses along with the request to create a new account. When providing a shipping address, the following are required: first_name, last_name, address1, city, state, zip, and country.
accept_language:
string
The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.
hosted_login_token:
string
The unique token for automatically logging the account in to the hosted management pages. You may automatically log the user into their hosted management pages by directing the user to: `https://:subdomain.recurly.com/account/:hosted_login_token`.
created_at:
datetime
The date and time the account was created in Recurly.
updated_at:
datetime
The date and time the account or its billing info was last updated.
closed_at:
datetime
For closed accounts, the date and time it was closed.
has_live_subscription:
boolean
True if the account has at least one live subscription.
has_active_subscription:
boolean
True if the account has at least one active subscription.
has_future_subscription:
boolean
True if the account has at least one future subscription.
has_canceled_subscription:
boolean
True if the account has at least one canceled subscription.
has_past_due_invoice:
boolean
True if the account has at least one past due invoice.

Definition

{{ api_url }}{{ page_api_url }}

Result Format

<account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
  <billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info"/>
  <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
  <redemptions href="https://your-subdomain.recurly.com/v2/accounts/1/redemptions"/>
  <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
  <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
  <account_code>1</account_code>
  <state>active</state>
  <username>verena1234</username>
  <email>[email protected]</email>
  <cc_emails>[email protected],[email protected]</cc_emails>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company_name>New Company Name</company_name>
  <vat_number nil="nil"/>
  <tax_exempt type="boolean">false</tax_exempt>
  <address>
    <address1>123 Main St.</address1>
    <address2 nil="nil"/>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <phone nil="nil"/>
  </address>
  <accept_language nil="nil"/>
  <has_live_subscription type="boolean">true</has_live_subscription>
  <has_active_subscription type="boolean">true</has_active_subscription>
  <has_future_subscription type="boolean">false</has_future_subscription>
  <has_canceled_subscription type="boolean">false</has_canceled_subscription>
  <has_past_due_invoice type="boolean">false</has_past_due_invoice>
  <hosted_login_token>96e74bd5e14d18e6da463a0d638a2621</hosted_login_token>
  <created_at type="datetime">2016-07-08T20:59:43Z</created_at>
  <updated_at type="datetime">2016-07-11T17:56:24Z</updated_at>
  <closed_at nil="nil"/>
</account>


{"_id":"5a0f6109823e2900127fd249","category":"5a0f6108823e2900127fd215","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["55f1f9abd4d3160d00439b6c"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T21:38:24.720Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","status":200,"language":"xml","code":"<accounts type=\"array\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n    <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n    <account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\"/>\n    <account_balance href=\"https://your-subdomain.recurly.com/v2/accounts/1/balance\"/>\n    <billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\"/>\n    <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n    <shipping_addresses href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses\"/>\n    <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n    <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n    <account_code>1</account_code>\n    <state>active</state>\n    <username>verena1234</username>\n    <email>[email protected]</email>\n    <cc_emails>[email protected],[email protected]</cc_emails>\n    <first_name>Verena</first_name>\n    <last_name>Example</last_name>\n    <company_name>New Company Name</company_name>\n    <vat_number nil=\"nil\"/>\n    <tax_exempt type=\"boolean\">false</tax_exempt>\n    <address>\n      <address1>123 Main St.</address1>\n      <address2 nil=\"nil\"/>\n      <city>San Francisco</city>\n      <state>CA</state>\n      <zip>94105</zip>\n      <country>US</country>\n      <phone nil=\"nil\"/>\n    </address>\n    <accept_language nil=\"nil\"/>\n    <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>\n    <created_at type=\"datetime\">2016-08-03T15:44:05Z</created_at>\n    <updated_at type=\"datetime\">2017-03-15T21:22:18Z</updated_at>\n    <closed_at nil=\"nil\"/>\n    <has_live_subscription type=\"boolean\">false</has_live_subscription>\n    <has_active_subscription type=\"boolean\">false</has_active_subscription>\n    <has_future_subscription type=\"boolean\">false</has_future_subscription>\n    <has_canceled_subscription type=\"boolean\">false</has_canceled_subscription>\n    <has_past_due_invoice type=\"boolean\">false</has_past_due_invoice>\n  </account>\n</accounts>"}]},"settings":"","examples":{"codes":[{"language":"php","code":"<?php\n\n$accounts = Recurly_AccountList::getActive();\nforeach ($accounts as $account) {\n  print \"Account: $account\\n\";\n}\n","name":""},{"language":"ruby","code":"Recurly::Account.find_each do |account|\n  puts \"Account: #{account.inspect}\"\nend"},{"language":"python","code":"#client version 2.1.6+\nfor account in Account.all():\n    print 'Account: %s' % account\n\n#client version <= 2.1.5\naccounts = Account.all()\nwhile accounts:\n    for account in accounts:\n        print 'Account: %s' % account\n    try:\n        accounts = accounts.next_page()\n    except PageError:\n        accounts = ()"},{"code":"using System.Linq;\n\nvar accounts = Accounts.List();\nwhile (accounts.Any())\n{\n\tforeach (var account in accounts)\n\t\tConsole.WriteLine(account);\n\taccounts = accounts.Next;\n}","name":null,"language":"csharp"}]},"method":"get","auth":"required","params":[{"_id":"56465088054d8f0d00bc76aa","ref":"","in":"query","required":false,"desc":"The state of accounts to return: `active`, `closed`, `subscriber`, `non_subscriber`, `past_due`.","default":"","type":"string","name":"state"},{"_id":"578ea5b0c93aac0e00ec8899","ref":"","in":"query","required":false,"desc":"The attribute that will be used to order records: `created_at`, `updated_at`.","default":"created_at","type":"string","name":"sort"},{"_id":"578ea5b0c93aac0e00ec8898","ref":"","in":"query","required":false,"desc":"The order in which products will be returned: `asc` for ascending order, `desc` for descending order.","default":"desc","type":"string","name":"order"},{"_id":"578ea5b0c93aac0e00ec8897","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"begin_time"},{"_id":"578ea5b0c93aac0e00ec8896","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"end_time"},{"_id":"56d8bace7ce7550b00c81d77","ref":"","in":"query","required":false,"desc":"Number of records to return per page, up to a maximum of 200.","default":"50","type":"int","name":"per_page"},{"_id":"56d8bace7ce7550b00c81d78","ref":"","in":"query","required":false,"desc":"Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.","default":"","type":"int","name":"cursor"}],"url":"/accounts"},"isReference":true,"order":1,"body":"###Account Query States\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"state\",\n    \"h-1\": \"description\",\n    \"0-0\": \"`active`\",\n    \"1-0\": \"`closed`\",\n    \"0-1\": \"Open accounts.\",\n    \"1-1\": \"Accounts that are not open.\",\n    \"2-0\": \"`subscriber`\",\n    \"2-1\": \"Accounts with subscriptions that are valid for the current time. This includes subscriptions in a trial period.\",\n    \"3-0\": \"`non_subscriber`\",\n    \"3-1\": \"Accounts without subscriptions that are valid for the current time.\",\n    \"4-0\": \"`past_due`\",\n    \"4-1\": \"Accounts with invoices that have failed initial collection but still have collection attempts remaining.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Please note: a queried state and the base state of a returned account may differ. For example, querying for `past_due` account will not result in a list of accounts with a `past_due` state (they will either be `active` or `closed`). Only base states (`active`, `closed`) will be present in the returned account records.\"\n}\n[/block]","excerpt":"Returns a list of accounts on your site. Results are ordered by the time created, sorted by newest first.","slug":"list-accounts","type":"get","title":"List Accounts","__v":1,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getList Accounts

Returns a list of accounts on your site. Results are ordered by the time created, sorted by newest first.

Query Params

state:
string
The state of accounts to return: `active`, `closed`, `subscriber`, `non_subscriber`, `past_due`.
sort:
stringcreated_at
The attribute that will be used to order records: `created_at`, `updated_at`.
order:
stringdesc
The order in which products will be returned: `asc` for ascending order, `desc` for descending order.
begin_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
end_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
per_page:
integer50
Number of records to return per page, up to a maximum of 200.
cursor:
integer
Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.

Account Query States

state
description

active

Open accounts.

closed

Accounts that are not open.

subscriber

Accounts with subscriptions that are valid for the current time. This includes subscriptions in a trial period.

non_subscriber

Accounts without subscriptions that are valid for the current time.

past_due

Accounts with invoices that have failed initial collection but still have collection attempts remaining.

Please note: a queried state and the base state of a returned account may differ. For example, querying for past_due account will not result in a list of accounts with a past_due state (they will either be active or closed). Only base states (active, closed) will be present in the returned account records.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

$accounts = Recurly_AccountList::getActive();
foreach ($accounts as $account) {
  print "Account: $account\n";
}
Recurly::Account.find_each do |account|
  puts "Account: #{account.inspect}"
end
#client version 2.1.6+
for account in Account.all():
    print 'Account: %s' % account

#client version <= 2.1.5
accounts = Account.all()
while accounts:
    for account in accounts:
        print 'Account: %s' % account
    try:
        accounts = accounts.next_page()
    except PageError:
        accounts = ()
using System.Linq;

var accounts = Accounts.List();
while (accounts.Any())
{
	foreach (var account in accounts)
		Console.WriteLine(account);
	accounts = accounts.Next;
}

Result Format

<accounts type="array">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1">
    <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
    <account_acquisition href="https://your-subdomain.recurly.com/v2/accounts/1/acquisition"/>
    <account_balance href="https://your-subdomain.recurly.com/v2/accounts/1/balance"/>
    <billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info"/>
    <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
    <shipping_addresses href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses"/>
    <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
    <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
    <account_code>1</account_code>
    <state>active</state>
    <username>verena1234</username>
    <email>[email protected]</email>
    <cc_emails>[email protected],[email protected]</cc_emails>
    <first_name>Verena</first_name>
    <last_name>Example</last_name>
    <company_name>New Company Name</company_name>
    <vat_number nil="nil"/>
    <tax_exempt type="boolean">false</tax_exempt>
    <address>
      <address1>123 Main St.</address1>
      <address2 nil="nil"/>
      <city>San Francisco</city>
      <state>CA</state>
      <zip>94105</zip>
      <country>US</country>
      <phone nil="nil"/>
    </address>
    <accept_language nil="nil"/>
    <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>
    <created_at type="datetime">2016-08-03T15:44:05Z</created_at>
    <updated_at type="datetime">2017-03-15T21:22:18Z</updated_at>
    <closed_at nil="nil"/>
    <has_live_subscription type="boolean">false</has_live_subscription>
    <has_active_subscription type="boolean">false</has_active_subscription>
    <has_future_subscription type="boolean">false</has_future_subscription>
    <has_canceled_subscription type="boolean">false</has_canceled_subscription>
    <has_past_due_invoice type="boolean">false</has_past_due_invoice>
  </account>
</accounts>


{"_id":"5a0f6109823e2900127fd24a","category":"5a0f6108823e2900127fd215","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["562908002c0fd9190067da26"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T20:12:03.880Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n  \ntry {\n  $account = new Recurly_Account('b6f5783');\n  $account->email = '[email protected]';\n  $account->first_name = 'Verena';\n  $account->last_name = 'Example';\n  $account->create();\n\n  print \"Account: $account\\n\";\n\n} catch (Recurly_ValidationError $e) {\n  print \"Invalid Account: $e\";\n}","name":""},{"language":"ruby","code":"account = Recurly::Account.create(\n  :account_code => '1',\n  :email        => '[email protected]',\n  :first_name   => 'Verena',\n  :last_name    => 'Example',\n    :shipping_addresses => [\n      {\n          :nickname => 'Work',\n            :first_name => 'Verena',\n            :last_name => 'Example',\n            :company => 'Recurly Inc',\n            :phone => '555-222-1212',\n            :email => '[email protected]',\n            :address1 => '123 Main St.',\n            :address2 => 'Suite 101',\n            :city => 'San Francisco',\n            :state => 'CA',\n            :zip => '94105',\n            :country => 'US'\n        },\n        {\n          :nickname => 'Home',\n            :first_name => 'Verena',\n            :last_name => 'Example',\n            :phone => '555-867-5309',\n            :email => '[email protected]',\n            :address1 => '123 Fourth St.',\n            :address2 => 'Apt. 101',\n            :city => 'San Francisco',\n            :state => 'CA',\n            :zip => '94105',\n            :country => 'US'\n        }\n    ]\n)"},{"language":"python","code":"account = recurly.Account(account_code='1')\naccount.email = '[email protected]'\naccount.first_name = 'Verena'\naccount.last_name = 'Example'\naccount.save()"},{"language":"csharp","code":"var account = new Account(\"1\")\n{\n  Email = \"[email protected]\",\n  FirstName = \"Verena\",\n  LastName = \"Example\"\n};\naccount.Create();"},{"code":"<account>\n  <account_code>1</account_code>\n  <email>[email protected]</email>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <username>verena1234</username>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <company_name>Recurly Inc</company_name>\n  <address>\n    <address1>123 Main St.</address1>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n  </address>\n  <shipping_addresses>\n    <shipping_address>\n      <nickname>Work</nickname>\n      <first_name>Verena</first_name>\n      <last_name>Example</last_name>\n      <company>Recurly Inc</company>\n      <phone>555-222-1212</phone>\n      <email>[email protected]</email>\n      <address1>123 Main St.</address1>\n      <address2>Suite 101</address2>\n      <city>San Francisco</city>\n      <state>CA</state>\n      <zip>94105</zip>\n      <country>US</country>\n    </shipping_address>\n    <shipping_address>\n      <nickname>Home</nickname>\n      <first_name>Verena</first_name>\n      <last_name>Example</last_name>\n      <phone>555-867-5309</phone>\n      <email>[email protected]</email>\n      <address1>123 Fourth St.</address1>\n      <address2>Apt. 101</address2>\n      <city>San Francisco</city>\n      <state>CA</state>\n      <zip>94105</zip>\n      <country>US</country>\n    </shipping_address>\n  </shipping_addresses>\n</account>","language":"xml"}]},"method":"post","results":{"codes":[{"status":201,"language":"xml","code":"<account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n  <billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\"/>\n  <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n  <redemption href=\"https://your-subdomain.recurly.com/v2/accounts/1/redemption\"/>\n  <shipping_addresses href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses\"/>\n  <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n  <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n  <account_code>1</account_code>\n  <state>active</state>\n  <username>verena1234</username>\n  <email>[email protected]</email>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company_name>Recurly Inc</company_name>\n  <vat_number nil=\"nil\"/>\n  <address>\n    <address1>123 Main St.</address1>\n    <address2 nil=\"nil\"/>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <phone nil=\"nil\"/>\n  </address>\n  <accept_language nil=\"nil\"/>\n  <hosted_login_token>3ed66441313a90bd7e8039b31985dee8</hosted_login_token>\n  <created_at type=\"datetime\">2016-06-14T16:08:41Z</created_at>\n  <closed_at nil=\"nil\"/>\n</account>","name":""}]},"settings":"","auth":"required","params":[{"_id":"557f3209e211d20d00601425","ref":"","in":"body","required":true,"desc":"A unique identifier used by your application to identify the account. This code may only contain the following characters: [a-z 0-9 @ - _ .] but it may not begin with a dot or hyphen character. Max of 50 characters.","default":"","type":"string","name":"account_code"},{"_id":"557f3209e211d20d00601424","ref":"","in":"body","required":false,"desc":"The username for the account, ignore if you do not use usernames. Max of 255 characters.","default":"","type":"string","name":"username"},{"_id":"557f3209e211d20d00601423","ref":"","in":"body","required":false,"desc":"The email address for the account.","default":"","type":"string","name":"email"},{"_id":"557f32d1e211d20d00601430","ref":"","in":"body","required":false,"desc":"The first name for the account. Max of 255 characters.","default":"","type":"string","name":"first_name"},{"_id":"557f32d1e211d20d0060142f","ref":"","in":"body","required":false,"desc":"The last name for the account.  Max of 255 characters.","default":"","type":"string","name":"last_name"},{"_id":"557f32d1e211d20d0060142e","ref":"","in":"body","required":false,"desc":"The company name for the account. Max of 50 characters.","default":"","type":"string","name":"company_name"},{"_id":"557f32d1e211d20d0060142d","ref":"","in":"body","required":false,"desc":"The VAT number to avoid having the VAT applied (if applicable).","default":"","type":"string","name":"vat_number"},{"_id":"557f32d1e211d20d0060142c","ref":"","in":"body","required":false,"desc":"The tax status for the account.","default":"","type":"boolean","name":"tax_exempt"},{"_id":"557f32d1e211d20d0060142b","ref":"","in":"body","required":false,"desc":"The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.","default":"","type":"string","name":"entity_use_code"},{"_id":"58cffafa2cb80d1b005486a8","ref":"","in":"body","required":false,"desc":"The nested account acquisition information: `cost_in_cents`, `currency`, `channel`, `subchannel`, `campaign`","default":"","type":"object","name":"account_acquisition"},{"_id":"557f32d1e211d20d0060142a","ref":"","in":"body","required":false,"desc":"The nested billing information. If present, the account will only be created after the billing information is validated.","default":"","type":"object","name":"billing_info"},{"_id":"557f32d1e211d20d00601429","ref":"","in":"body","required":false,"desc":"The nested address information for the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.","default":"","type":"object","name":"address"},{"_id":"58010a4657be4b1900eaf2a6","ref":"","in":"body","required":false,"desc":"The nested shipping address information of the account: `first_name`, `last_name`, `company_name`, `email`, `phone`, `vat_number`,  `address1`, `address2`, `city`, `state`, `zip`, `country`, `nickname`. You can pass in up to 20 account shipping addresses along with the request to create a new account. When providing a shipping address, the following are required: first_name, last_name, address1, city, state, zip, and country.","default":"","type":"object","name":"shipping_address"},{"_id":"557f32d1e211d20d00601428","ref":"","in":"body","required":false,"desc":"The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.","default":"","type":"string","name":"accept_language"},{"_id":"561c362cd308ee0d00749370","ref":"","in":"body","required":false,"desc":"Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.","default":"","type":"array_string","name":"cc_emails"}],"url":"/accounts"},"isReference":true,"order":2,"body":"","excerpt":"Creates a new account. You may optionally include billing information.","slug":"create-an-account","type":"post","title":"Create Account","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account

Creates a new account. You may optionally include billing information.

Body Params

account_code:
required
string
A unique identifier used by your application to identify the account. This code may only contain the following characters: [a-z 0-9 @ - _ .] but it may not begin with a dot or hyphen character. Max of 50 characters.
username:
string
The username for the account, ignore if you do not use usernames. Max of 255 characters.
email:
string
The email address for the account.
first_name:
string
The first name for the account. Max of 255 characters.
last_name:
string
The last name for the account. Max of 255 characters.
company_name:
string
The company name for the account. Max of 50 characters.
vat_number:
string
The VAT number to avoid having the VAT applied (if applicable).
tax_exempt:
boolean
The tax status for the account.
entity_use_code:
string
The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.
account_acquisition:
object
The nested account acquisition information: `cost_in_cents`, `currency`, `channel`, `subchannel`, `campaign`
billing_info:
object
The nested billing information. If present, the account will only be created after the billing information is validated.
address:
object
The nested address information for the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.
shipping_address:
object
The nested shipping address information of the account: `first_name`, `last_name`, `company_name`, `email`, `phone`, `vat_number`, `address1`, `address2`, `city`, `state`, `zip`, `country`, `nickname`. You can pass in up to 20 account shipping addresses along with the request to create a new account. When providing a shipping address, the following are required: first_name, last_name, address1, city, state, zip, and country.
accept_language:
string
The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.
cc_emails:
array of strings
Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php
  
try {
  $account = new Recurly_Account('b6f5783');
  $account->email = '[email protected]';
  $account->first_name = 'Verena';
  $account->last_name = 'Example';
  $account->create();

  print "Account: $account\n";

} catch (Recurly_ValidationError $e) {
  print "Invalid Account: $e";
}
account = Recurly::Account.create(
  :account_code => '1',
  :email        => '[email protected]',
  :first_name   => 'Verena',
  :last_name    => 'Example',
    :shipping_addresses => [
      {
          :nickname => 'Work',
            :first_name => 'Verena',
            :last_name => 'Example',
            :company => 'Recurly Inc',
            :phone => '555-222-1212',
            :email => '[email protected]',
            :address1 => '123 Main St.',
            :address2 => 'Suite 101',
            :city => 'San Francisco',
            :state => 'CA',
            :zip => '94105',
            :country => 'US'
        },
        {
          :nickname => 'Home',
            :first_name => 'Verena',
            :last_name => 'Example',
            :phone => '555-867-5309',
            :email => '[email protected]',
            :address1 => '123 Fourth St.',
            :address2 => 'Apt. 101',
            :city => 'San Francisco',
            :state => 'CA',
            :zip => '94105',
            :country => 'US'
        }
    ]
)
account = recurly.Account(account_code='1')
account.email = '[email protected]'
account.first_name = 'Verena'
account.last_name = 'Example'
account.save()
var account = new Account("1")
{
  Email = "[email protected]",
  FirstName = "Verena",
  LastName = "Example"
};
account.Create();
<account>
  <account_code>1</account_code>
  <email>[email protected]</email>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <username>verena1234</username>
  <cc_emails>[email protected],[email protected]</cc_emails>
  <company_name>Recurly Inc</company_name>
  <address>
    <address1>123 Main St.</address1>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
  </address>
  <shipping_addresses>
    <shipping_address>
      <nickname>Work</nickname>
      <first_name>Verena</first_name>
      <last_name>Example</last_name>
      <company>Recurly Inc</company>
      <phone>555-222-1212</phone>
      <email>[email protected]</email>
      <address1>123 Main St.</address1>
      <address2>Suite 101</address2>
      <city>San Francisco</city>
      <state>CA</state>
      <zip>94105</zip>
      <country>US</country>
    </shipping_address>
    <shipping_address>
      <nickname>Home</nickname>
      <first_name>Verena</first_name>
      <last_name>Example</last_name>
      <phone>555-867-5309</phone>
      <email>[email protected]</email>
      <address1>123 Fourth St.</address1>
      <address2>Apt. 101</address2>
      <city>San Francisco</city>
      <state>CA</state>
      <zip>94105</zip>
      <country>US</country>
    </shipping_address>
  </shipping_addresses>
</account>

Result Format

<account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
  <billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info"/>
  <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
  <redemption href="https://your-subdomain.recurly.com/v2/accounts/1/redemption"/>
  <shipping_addresses href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses"/>
  <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
  <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
  <account_code>1</account_code>
  <state>active</state>
  <username>verena1234</username>
  <email>[email protected]</email>
  <cc_emails>[email protected],[email protected]</cc_emails>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company_name>Recurly Inc</company_name>
  <vat_number nil="nil"/>
  <address>
    <address1>123 Main St.</address1>
    <address2 nil="nil"/>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <phone nil="nil"/>
  </address>
  <accept_language nil="nil"/>
  <hosted_login_token>3ed66441313a90bd7e8039b31985dee8</hosted_login_token>
  <created_at type="datetime">2016-06-14T16:08:41Z</created_at>
  <closed_at nil="nil"/>
</account>


{"_id":"5a0f6109823e2900127fd24b","category":"5a0f6108823e2900127fd215","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["55bbdd4e1067fc1700510eed"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T21:45:49.420Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<?php\n\ntry {\n  $account = Recurly_Account::get('1');\n  print \"Account: $account\\n\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Account not found.\\n\";\n}","language":"php","name":""},{"code":"begin\n  account = Recurly::Account.find '1'\n  puts \"Account: #{account.inspect}\"\nrescue Recurly::Resource::NotFound => e\n  puts e.message\nend","language":"ruby"},{"code":"try:\n  account = recurly.Account.get('1')\n  print \"Account: %s\" % account\nexcept NotFoundError:\n  print \"Account not found.\\n\"","language":"python"},{"code":"try\n{\n\tvar account = Accounts.Get(\"1\");\n\tConsole.WriteLine(\"Account \" + account);\n}\ncatch (NotFoundException e)\n{\n\tConsole.WriteLine(\"Account not found.\");\n}","language":"csharp"}]},"method":"get","results":{"codes":[{"name":"","code":"<account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n  <account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\"/>\n  <account_balance href=\"https://your-subdomain.recurly.com/v2/accounts/1/balance\"/>\n  <billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\"/>\n  <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n  <shipping_addresses href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses\"/>\n  <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n  <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n  <account_code>1</account_code>\n  <state>active</state>\n  <username>verena1234</username>\n  <email>[email protected]</email>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company_name>New Company Name</company_name>\n  <vat_number nil=\"nil\"/>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <address>\n    <address1>123 Main St.</address1>\n    <address2 nil=\"nil\"/>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <phone nil=\"nil\"/>\n  </address>\n  <accept_language nil=\"nil\"/>\n  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>\n  <created_at type=\"datetime\">2016-08-03T15:44:05Z</created_at>\n  <updated_at type=\"datetime\">2017-03-15T21:22:18Z</updated_at>\n  <closed_at nil=\"nil\"/>\n  <has_live_subscription type=\"boolean\">false</has_live_subscription>\n  <has_active_subscription type=\"boolean\">false</has_active_subscription>\n  <has_future_subscription type=\"boolean\">false</has_future_subscription>\n  <has_canceled_subscription type=\"boolean\">false</has_canceled_subscription>\n  <has_past_due_invoice type=\"boolean\">false</has_past_due_invoice>\n</account>","language":"xml","status":200}]},"settings":"","auth":"required","params":[{"_id":"557f478deb75d80d00af4086","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code"},"isReference":true,"order":3,"body":"","excerpt":"Returns information about a single account.","slug":"get-account","type":"get","title":"Lookup Account","__v":1,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Account

Returns information about a single account.

Path Params

account_code:
required
string
Account's unique code.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $account = Recurly_Account::get('1');
  print "Account: $account\n";
} catch (Recurly_NotFoundError $e) {
  print "Account not found.\n";
}
begin
  account = Recurly::Account.find '1'
  puts "Account: #{account.inspect}"
rescue Recurly::Resource::NotFound => e
  puts e.message
end
try:
  account = recurly.Account.get('1')
  print "Account: %s" % account
except NotFoundError:
  print "Account not found.\n"
try
{
	var account = Accounts.Get("1");
	Console.WriteLine("Account " + account);
}
catch (NotFoundException e)
{
	Console.WriteLine("Account not found.");
}

Result Format

<account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
  <account_acquisition href="https://your-subdomain.recurly.com/v2/accounts/1/acquisition"/>
  <account_balance href="https://your-subdomain.recurly.com/v2/accounts/1/balance"/>
  <billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info"/>
  <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
  <shipping_addresses href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses"/>
  <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
  <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
  <account_code>1</account_code>
  <state>active</state>
  <username>verena1234</username>
  <email>[email protected]</email>
  <cc_emails>[email protected],[email protected]</cc_emails>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company_name>New Company Name</company_name>
  <vat_number nil="nil"/>
  <tax_exempt type="boolean">false</tax_exempt>
  <address>
    <address1>123 Main St.</address1>
    <address2 nil="nil"/>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <phone nil="nil"/>
  </address>
  <accept_language nil="nil"/>
  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>
  <created_at type="datetime">2016-08-03T15:44:05Z</created_at>
  <updated_at type="datetime">2017-03-15T21:22:18Z</updated_at>
  <closed_at nil="nil"/>
  <has_live_subscription type="boolean">false</has_live_subscription>
  <has_active_subscription type="boolean">false</has_active_subscription>
  <has_future_subscription type="boolean">false</has_future_subscription>
  <has_canceled_subscription type="boolean">false</has_canceled_subscription>
  <has_past_due_invoice type="boolean">false</has_past_due_invoice>
</account>


{"_id":"5a0f6109823e2900127fd24c","category":"5a0f6108823e2900127fd215","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["568ffb69769f210d00132584"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T21:57:38.556Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"<account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n  <account_balance href=\"https://your-subdomain.recurly.com/v2/accounts/1/balance\"/>\n  <billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\"/>\n  <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n  <redemptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/redemptions\"/>\n  <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n  <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n  <account_code>1</account_code>\n  <state>active</state>\n  <username>verena1234</username>\n  <email>[email protected]</email>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company_name>New Company Name</company_name>\n  <vat_number nil=\"nil\"/>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <address>\n    <address1>123 Main St.</address1>\n    <address2 nil=\"nil\"/>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <phone nil=\"nil\"/>\n  </address>\n  <accept_language nil=\"nil\"/>\n  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>\n  <created_at type=\"datetime\">2016-08-03T15:44:05Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:30:50Z</updated_at>\n  <closed_at nil=\"nil\"/>\n</account>","language":"xml","status":200}]},"settings":"","examples":{"codes":[{"code":"<?php\n\ntry {\n  $account = Recurly_Account::get('b6f5783');\n  $account->company_name = 'New Company Name';\n  $account->update();\n\n  print \"Account: $account\\n\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid account code: $e\";\n}","name":"","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('account_1')\naccount.company_name = 'New Company Name'\naccount.save"},{"language":"python","code":"account = recurly.Account.get('account_1')\naccount.company_name = 'New Company Name'\naccount.save()"},{"language":"csharp","code":"var account = Account.Get(\"account_1\");\naccount.CompanyName = 'New Company Name'\naccount.Update();"},{"language":"xml","code":"<account>\n  <company_name>New Company Name</company_name>\n</account>"}]},"method":"put","auth":"required","params":[{"_id":"557f4a527eafa719001d1c43","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"557f4a527eafa719001d1c42","ref":"","in":"body","required":false,"desc":"The username for the account, ignore if you do not use usernames. Max of 255 characters.","default":"","type":"string","name":"username"},{"_id":"557f4a527eafa719001d1c41","ref":"","in":"body","required":false,"desc":"The email address for the account.","default":"","type":"string","name":"email"},{"_id":"557f4a527eafa719001d1c40","ref":"","in":"body","required":false,"desc":"The first name for the account. Max of 255 characters.","default":"","type":"string","name":"first_name"},{"_id":"557f4a527eafa719001d1c3f","ref":"","in":"body","required":false,"desc":"The last name for the account. Max of 255 characters.","default":"","type":"string","name":"last_name"},{"_id":"557f4a527eafa719001d1c3e","ref":"","in":"body","required":false,"desc":"The company name for the account. Max of 50 characters.","default":"","type":"string","name":"company_name"},{"_id":"557f4a527eafa719001d1c3d","ref":"","in":"body","required":false,"desc":"The VAT number to avoid having the VAT applied (if applicable).","default":"","type":"string","name":"vat_number"},{"_id":"557f4a527eafa719001d1c3c","ref":"","in":"body","required":false,"desc":"The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.","default":"","type":"boolean","name":"tax_exempt"},{"_id":"557f4a527eafa719001d1c3b","ref":"","in":"body","required":false,"desc":"The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.","default":"","type":"string","name":"entity_use_code"},{"_id":"58cffb3be865c00f00f93dfb","ref":"","in":"body","required":false,"desc":"The nested account acquisition information: `cost_in_cents`, currency`, `channel`, `subchannel`, `campaign`","default":"","type":"object","name":"account_acquisition"},{"_id":"557f4a527eafa719001d1c3a","ref":"","in":"body","required":false,"desc":"The nested billing information. If present, the account will only be created after the billing information is validated.","default":"","type":"object","name":"billing_info"},{"_id":"557f4a527eafa719001d1c39","ref":"","in":"body","required":false,"desc":"The nested address information for the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.","default":"","type":"object","name":"address"},{"_id":"557f4a527eafa719001d1c38","ref":"","in":"body","required":false,"desc":"The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.","default":"","type":"string","name":"accept_language"},{"_id":"561c3606d468a60d00f51ebe","ref":"","in":"body","required":false,"desc":"Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.","default":"","type":"array_string","name":"cc_emails"}],"url":"/accounts/:account_code"},"isReference":true,"order":4,"body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Please note\",\n  \"body\": \"You may optionally include billing information when updating an account. If the billing information is provided, the billing information will be validated. The account will only be updated if the billing information is valid.\"\n}\n[/block]","excerpt":"Updates an existing account.","slug":"update-account","type":"put","title":"Update Account","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account

Updates an existing account.

Path Params

account_code:
required
string
Account's unique code.

Body Params

username:
string
The username for the account, ignore if you do not use usernames. Max of 255 characters.
email:
string
The email address for the account.
first_name:
string
The first name for the account. Max of 255 characters.
last_name:
string
The last name for the account. Max of 255 characters.
company_name:
string
The company name for the account. Max of 50 characters.
vat_number:
string
The VAT number to avoid having the VAT applied (if applicable).
tax_exempt:
boolean
The tax status of the account. `true` exempts tax on the account, `false` applies tax on the account.
entity_use_code:
string
The Avalara AvaTax value that can be passed to identify the customer type for tax purposes. The range of values can be A - R (more info at Avalara). Value is case-sensitive.
account_acquisition:
object
The nested account acquisition information: `cost_in_cents`, currency`, `channel`, `subchannel`, `campaign`
billing_info:
object
The nested billing information. If present, the account will only be created after the billing information is validated.
address:
object
The nested address information for the account: `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`.
accept_language:
string
The ISO 639-1 language code from the user's browser, indicating their preferred language and locale.
cc_emails:
array of strings
Additional email address that should receive account correspondence. These should be separated only by commas. These CC emails will receive all emails that the `email` field also receives.

Please note

You may optionally include billing information when updating an account. If the billing information is provided, the billing information will be validated. The account will only be updated if the billing information is valid.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $account = Recurly_Account::get('b6f5783');
  $account->company_name = 'New Company Name';
  $account->update();

  print "Account: $account\n";
} catch (Recurly_NotFoundError $e) {
  print "Invalid account code: $e";
}
account = Recurly::Account.find('account_1')
account.company_name = 'New Company Name'
account.save
account = recurly.Account.get('account_1')
account.company_name = 'New Company Name'
account.save()
var account = Account.Get("account_1");
account.CompanyName = 'New Company Name'
account.Update();
<account>
  <company_name>New Company Name</company_name>
</account>

Result Format

<account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
  <account_balance href="https://your-subdomain.recurly.com/v2/accounts/1/balance"/>
  <billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info"/>
  <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
  <redemptions href="https://your-subdomain.recurly.com/v2/accounts/1/redemptions"/>
  <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
  <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
  <account_code>1</account_code>
  <state>active</state>
  <username>verena1234</username>
  <email>[email protected]</email>
  <cc_emails>[email protected],[email protected]</cc_emails>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company_name>New Company Name</company_name>
  <vat_number nil="nil"/>
  <tax_exempt type="boolean">false</tax_exempt>
  <address>
    <address1>123 Main St.</address1>
    <address2 nil="nil"/>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <phone nil="nil"/>
  </address>
  <accept_language nil="nil"/>
  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>
  <created_at type="datetime">2016-08-03T15:44:05Z</created_at>
  <updated_at type="datetime">2016-08-03T16:30:50Z</updated_at>
  <closed_at nil="nil"/>
</account>


{"_id":"5a0f6109823e2900127fd24d","category":"5a0f6108823e2900127fd215","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:00:42.004Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $account = Recurly_Account::get('b6f5783');\n  $account->close();\n\n  print \"Account: $account\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid account code: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.destroy"},{"code":"account = recurly.Account.get('1')\naccount.delete()","language":"python"},{"code":"var account = Accounts.Get(\"1\");\naccount.Close();","language":"csharp"}]},"method":"delete","results":{"codes":[{"name":"","code":"","language":"xml","status":200}]},"settings":"","auth":"required","params":[{"_id":"55944ebb5c9eaa2300a86337","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code"},"isReference":true,"order":5,"body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Please note\",\n  \"body\": \"Closing an account permanently deletes its billing information and cancels any active subscriptions (canceled subscriptions will remain active until the end of the current billing cycle before expiring).\"\n}\n[/block]","excerpt":"Marks an account as closed and cancels any active subscriptions.","slug":"close-account","type":"delete","title":"Close Account","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

deleteClose Account

Marks an account as closed and cancels any active subscriptions.

Path Params

account_code:
required
string
Account's unique code.

Please note

Closing an account permanently deletes its billing information and cancels any active subscriptions (canceled subscriptions will remain active until the end of the current billing cycle before expiring).

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $account = Recurly_Account::get('b6f5783');
  $account->close();

  print "Account: $account";
} catch (Recurly_NotFoundError $e) {
  print "Invalid account code: $e";
}
account = Recurly::Account.find('1')
account.destroy
account = recurly.Account.get('1')
account.delete()
var account = Accounts.Get("1");
account.Close();


{"_id":"5a0f6109823e2900127fd24e","category":"5a0f6108823e2900127fd215","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:03:14.174Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","name":"","code":"<?php\n\ntry {\n  $account = Recurly_Account::get('b6f5783');\n  $account->reopen();\n\n  // Or to fetch and reopen in one call\n  // $account = Recurly_Account::reopenAccount('b6f5783');\n\n  print \"Account: $account\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid account code: $e\";\n} catch (Recurly_ValidationError $e) {\n  print \"Account already open: $e\";\n}"},{"code":"account = Recurly::Account.find '1'\naccount.reopen","language":"ruby"},{"code":"account = recurly.Account.get('1')\naccount.reopen() ","language":"python"},{"code":"var account = Accounts.Get(\"1\");\naccount.Reopen();","language":"csharp"}]},"method":"put","results":{"codes":[{"name":"","status":200,"language":"xml","code":"<account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <adjustments href=\"https://your-subdomain.recurly.com/v2/accounts/1/adjustments\"/>\n  <account_balance href=\"https://your-subdomain.recurly.com/v2/accounts/1/balance\"/>\n  <invoices href=\"https://your-subdomain.recurly.com/v2/accounts/1/invoices\"/>\n  <redemptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/redemptions\"/>\n  <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/subscriptions\"/>\n  <transactions href=\"https://your-subdomain.recurly.com/v2/accounts/1/transactions\"/>\n  <account_code>1</account_code>\n  <state>active</state>\n  <username>verena1234</username>\n  <email>[email protected]</email>\n  <cc_emails>[email protected],[email protected]</cc_emails>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company_name>New Company Name</company_name>\n  <vat_number nil=\"nil\"/>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <address>\n    <address1>123 Main St.</address1>\n    <address2 nil=\"nil\"/>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <phone nil=\"nil\"/>\n  </address>\n  <accept_language nil=\"nil\"/>\n  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>\n  <created_at type=\"datetime\">2016-08-03T15:44:05Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:31:25Z</updated_at>\n  <closed_at nil=\"nil\"/>\n</account>"}]},"settings":"","auth":"required","params":[{"_id":"55944ed45c9eaa2300a86339","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code/reopen"},"isReference":true,"order":6,"body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Please note\",\n  \"body\": \"Editing an account, creating an account with the same `account_code` as the deleted account, or creating a new transaction or subscription will also reopen an account. Reopening an account will restore its history. Reopening an account does not modify any previously canceled or expired subscriptions and billing information will need to be provided by the customer to continue billing.\"\n}\n[/block]","excerpt":"Transitions a closed account back to active.","slug":"reopen-account","type":"put","title":"Reopen Account","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putReopen Account

Transitions a closed account back to active.

Path Params

account_code:
required
string
Account's unique code.

Please note

Editing an account, creating an account with the same account_code as the deleted account, or creating a new transaction or subscription will also reopen an account. Reopening an account will restore its history. Reopening an account does not modify any previously canceled or expired subscriptions and billing information will need to be provided by the customer to continue billing.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $account = Recurly_Account::get('b6f5783');
  $account->reopen();

  // Or to fetch and reopen in one call
  // $account = Recurly_Account::reopenAccount('b6f5783');

  print "Account: $account";
} catch (Recurly_NotFoundError $e) {
  print "Invalid account code: $e";
} catch (Recurly_ValidationError $e) {
  print "Account already open: $e";
}
account = Recurly::Account.find '1'
account.reopen
account = recurly.Account.get('1')
account.reopen() 
var account = Accounts.Get("1");
account.Reopen();

Result Format

<account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <adjustments href="https://your-subdomain.recurly.com/v2/accounts/1/adjustments"/>
  <account_balance href="https://your-subdomain.recurly.com/v2/accounts/1/balance"/>
  <invoices href="https://your-subdomain.recurly.com/v2/accounts/1/invoices"/>
  <redemptions href="https://your-subdomain.recurly.com/v2/accounts/1/redemptions"/>
  <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/subscriptions"/>
  <transactions href="https://your-subdomain.recurly.com/v2/accounts/1/transactions"/>
  <account_code>1</account_code>
  <state>active</state>
  <username>verena1234</username>
  <email>[email protected]</email>
  <cc_emails>[email protected]le.com,[email protected]</cc_emails>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company_name>New Company Name</company_name>
  <vat_number nil="nil"/>
  <tax_exempt type="boolean">false</tax_exempt>
  <address>
    <address1>123 Main St.</address1>
    <address2 nil="nil"/>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <phone nil="nil"/>
  </address>
  <accept_language nil="nil"/>
  <hosted_login_token>71c122cb16fc90252ff845eacf5d7814</hosted_login_token>
  <created_at type="datetime">2016-08-03T15:44:05Z</created_at>
  <updated_at type="datetime">2016-08-03T16:31:25Z</updated_at>
  <closed_at nil="nil"/>
</account>


{"_id":"5a0f6109823e2900127fd24f","category":"5a0f6108823e2900127fd215","user":"559d85d26b21311700fb0b7b","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-19T19:51:58.991Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"get","results":{"codes":[{"code":"<account_balance href=\"https://your-subdomain.recurly.com/v2/accounts/1/balance\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <past_due type=\"boolean\">false</past_due>\n  <balance_in_cents>\n    <USD type=\"integer\">3000</USD>\n    <EUR type=\"integer\">0</EUR>\n  </balance_in_cents>\n</account_balance>","name":"","status":200,"language":"xml"},{"language":"json","code":"<error>\n  <symbol>unavailable_in_api_version</symbol>\n  <description>This request cannot be completed using this version of the API. It was added in version '2.3'.</description>\n</error>","name":"","status":400},{"code":"<error>\n  <symbol>not_found</symbol>\n  <description lang=\"en-US\">Couldn't find Account with account_code = not-1</description>\n</error>","status":404,"language":"text"}]},"settings":"","auth":"required","params":[{"_id":"578e888a36baeb17003fd5fb","ref":"","in":"query","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code/balance"},"isReference":true,"order":7,"body":"","excerpt":"Returns the account's past due status and balance in each of the site's supported currencies.","slug":"lookup-account-balance","type":"get","title":"Lookup Account Balance","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Account Balance

Returns the account's past due status and balance in each of the site's supported currencies.

Query Params

account_code:
required
string
Account's unique code.

Definition

{{ api_url }}{{ page_api_url }}

Result Format

<account_balance href="https://your-subdomain.recurly.com/v2/accounts/1/balance">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <past_due type="boolean">false</past_due>
  <balance_in_cents>
    <USD type="integer">3000</USD>
    <EUR type="integer">0</EUR>
  </balance_in_cents>
</account_balance>
<error>
  <symbol>unavailable_in_api_version</symbol>
  <description>This request cannot be completed using this version of the API. It was added in version '2.3'.</description>
</error>
<error>
  <symbol>not_found</symbol>
  <description lang="en-US">Couldn't find Account with account_code = not-1</description>
</error>


{"_id":"5a0f6109823e2900127fd250","category":"5a0f6108823e2900127fd215","user":"55648cf93b87582b003ab8b1","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:04:40.352Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $notes = Recurly_NoteList::get('b6f5783');\n  foreach ($notes as $note) {\n    print \"Note: {$note->message}\\n\";\n  }\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid account code: $e\";\n}","language":"php"},{"code":"try:\n  account = recurly.Account.get('1')\n  for note in account.notes():\n   print \"Note: %s\" % note.message\nexcept NotFoundError:\n  print \"Account not found.\\n\"","language":"python"},{"code":"using System.Linq;\n\nvar account = Accounts.Get(\"1\");\nvar notes = account.GetNotes();\nwhile (notes.Any())\n{\n\tforeach (var note in notes)\n\t\tConsole.WriteLine(\"Note: \" + note.Message);\n\tnotes = notes.Next;\n}","language":"csharp"}]},"method":"get","results":{"codes":[{"name":"","code":"<notes type=\"array\">\n  <note>\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n    <message>This is my second note</message>\n    <created_at type=\"datetime\">2015-06-14T16:08:41Z</created_at>\n  </note>\n  <note>\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n    <message>This is my first note</message>\n    <created_at type=\"datetime\">2016-06-13T16:06:21Z</created_at>\n  </note>\n  <!-- Continued... -->\n</notes>","language":"xml","status":200}]},"settings":"","auth":"required","params":[{"_id":"55944eddccc3052300569882","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5783c946ce802f0e0087d4bb","ref":"","in":"query","required":false,"desc":"Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.","default":"","type":"string","name":"cursor"},{"_id":"578ea620c93aac0e00ec889d","ref":"","in":"query","required":false,"desc":"The attribute that will be used to order records: `created_at`, `updated_at`.","default":"created_at","type":"string","name":"sort"},{"_id":"578ea620c93aac0e00ec889c","ref":"","in":"query","required":false,"desc":"The order in which products will be returned: `asc` for ascending order, `desc` for descending order.","default":"desc","type":"string","name":"order"},{"_id":"578ea620c93aac0e00ec889b","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"begin_time"},{"_id":"578ea620c93aac0e00ec889a","ref":"","in":"query","required":false,"desc":"","default":"","type":"datetime","name":"end_time"},{"_id":"5783c946ce802f0e0087d4ba","ref":"","in":"query","required":false,"desc":"Number of records to return per page, up to a maximum of 200.","default":"50","type":"int","name":"per_page"}],"url":"/accounts/:account_code/notes"},"isReference":true,"order":8,"body":"","excerpt":"Returns a list of the notes on an account sorted in descending order (most recently created first).","slug":"list-account-notes","type":"get","title":"List Account Notes","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getList Account Notes

Returns a list of the notes on an account sorted in descending order (most recently created first).

Path Params

account_code:
required
string
Account's unique code.

Query Params

cursor:
string
Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.
sort:
stringcreated_at
The attribute that will be used to order records: `created_at`, `updated_at`.
order:
stringdesc
The order in which products will be returned: `asc` for ascending order, `desc` for descending order.
begin_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
end_time:
datetime
per_page:
integer50
Number of records to return per page, up to a maximum of 200.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $notes = Recurly_NoteList::get('b6f5783');
  foreach ($notes as $note) {
    print "Note: {$note->message}\n";
  }
} catch (Recurly_NotFoundError $e) {
  print "Invalid account code: $e";
}
try:
  account = recurly.Account.get('1')
  for note in account.notes():
   print "Note: %s" % note.message
except NotFoundError:
  print "Account not found.\n"
using System.Linq;

var account = Accounts.Get("1");
var notes = account.GetNotes();
while (notes.Any())
{
	foreach (var note in notes)
		Console.WriteLine("Note: " + note.Message);
	notes = notes.Next;
}

Result Format

<notes type="array">
  <note>
    <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
    <message>This is my second note</message>
    <created_at type="datetime">2015-06-14T16:08:41Z</created_at>
  </note>
  <note>
    <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
    <message>This is my first note</message>
    <created_at type="datetime">2016-06-13T16:06:21Z</created_at>
  </note>
  <!-- Continued... -->
</notes>


{"_id":"5a0f6108823e2900127fd226","category":"5a0f6108823e2900127fd216","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55ad15f7f93f0c0d005b88a2","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-14T17:02:21.737Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"get","results":{"codes":[{"language":"xml","status":200,"name":"","code":"<shipping_addresses type=\"array\">\n  <shipping_address href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1\">\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n    <subscriptions href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1/subscriptions\">\n    <id>1</id>\n    <nickname>Work</nickname>\n    <first_name>Verena</first_name>\n    <last_name>Example</last_name>\n    <company>Recurly Inc</company>\n    <phone>555-222-1212</phone>\n    <email>[email protected]</email>\n    <address1>123 Main St.</address1>\n    <address2>Suite 101</address2>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <created_at type=\"datetime\">2016-06-14T16:08:41Z</created_at>\n    <updated_at type=\"datetime\">2016-06-14T16:08:41Z</updated_at>\n  </shipping_address>\n  <shipping_address href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/2\">\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n    <shipping_address_id>2</shipping_address_id>\n    <nickname>Home</nickname>\n    <first_name>Verena</first_name>\n    <last_name>Example</last_name>\n    <phone>555-867-5309</phone>\n    <email>[email protected]</email>\n    <address1>123 Fourth St.</address1>\n    <address2>Apt. 101</address2>\n    <city>San Francisco</city>\n    <state>CA</state>\n    <zip>94105</zip>\n    <country>US</country>\n    <created_at type=\"datetime\">2016-06-14T16:08:42Z</created_at>\n    <updated_at type=\"datetime\">2016-06-14T16:08:42Z</updated_at>\n  </shipping_address>\n</shipping_addresses>"}]},"settings":"","examples":{"codes":[{"language":"ruby","code":"# First get an account\naccount = Recurly::Account.find('1')\n\n# Get all shipping addresses\nshipping_addresses = account.shipping_addresses\n\n# If you want to pass sorting/filtering params:\nshipping_addresses = account.shipping_addresses.all(sort: :updated_at, order: :asc)"},{"language":"python","code":"# first we need any account object\naccount = Account.get('1')\n\n# the shipping_addresses method fetches the shipping addresses\n# associated with this account\nshipping_addresses = account.shipping_addresses()"}]},"auth":"required","params":[{"_id":"578d1aa09a98a41900717d95","ref":"","in":"path","required":true,"desc":"Unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"55821a9e5b7fa60d0068b420","ref":"","in":"query","required":false,"desc":"Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.","default":"","type":"string","name":"cursor"},{"_id":"578ea7d5426c561700db8694","ref":"","in":"query","required":false,"desc":"The attribute that will be used to order records: `created_at`, `updated_at`.","default":"created_at","type":"string","name":"sort"},{"_id":"578ea7d5426c561700db8693","ref":"","in":"query","required":false,"desc":"The order in which products will be returned: `asc` for ascending order, `desc` for descending order.","default":"desc","type":"string","name":"order"},{"_id":"578ea7d5426c561700db8692","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"begin_time"},{"_id":"578ea7d5426c561700db8691","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"end_time"},{"_id":"55821a9e5b7fa60d0068b41f","ref":"","in":"query","required":false,"desc":"Number of records to return per page, up to a maximum of 200.","default":"50","type":"int","name":"per_page"}],"url":"/accounts/:account_code/shipping_addresses"},"isReference":true,"order":0,"body":"","excerpt":"Returns a list of shipping addresses for an account.","slug":"list-accounts-shipping-address","type":"get","title":"List Account's Shipping Address","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getList Account's Shipping Address

Returns a list of shipping addresses for an account.

Path Params

account_code:
required
string
Unique account identifier.

Query Params

cursor:
string
Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.
sort:
stringcreated_at
The attribute that will be used to order records: `created_at`, `updated_at`.
order:
stringdesc
The order in which products will be returned: `asc` for ascending order, `desc` for descending order.
begin_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
end_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
per_page:
integer50
Number of records to return per page, up to a maximum of 200.

Definition

{{ api_url }}{{ page_api_url }}

Examples

# First get an account
account = Recurly::Account.find('1')

# Get all shipping addresses
shipping_addresses = account.shipping_addresses

# If you want to pass sorting/filtering params:
shipping_addresses = account.shipping_addresses.all(sort: :updated_at, order: :asc)
# first we need any account object
account = Account.get('1')

# the shipping_addresses method fetches the shipping addresses
# associated with this account
shipping_addresses = account.shipping_addresses()

Result Format

<shipping_addresses type="array">
  <shipping_address href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1">
    <account href="https://your-subdomain.recurly.com/v2/accounts/1">
    <subscriptions href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1/subscriptions">
    <id>1</id>
    <nickname>Work</nickname>
    <first_name>Verena</first_name>
    <last_name>Example</last_name>
    <company>Recurly Inc</company>
    <phone>555-222-1212</phone>
    <email>[email protected]</email>
    <address1>123 Main St.</address1>
    <address2>Suite 101</address2>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <created_at type="datetime">2016-06-14T16:08:41Z</created_at>
    <updated_at type="datetime">2016-06-14T16:08:41Z</updated_at>
  </shipping_address>
  <shipping_address href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/2">
    <account href="https://your-subdomain.recurly.com/v2/accounts/1">
    <shipping_address_id>2</shipping_address_id>
    <nickname>Home</nickname>
    <first_name>Verena</first_name>
    <last_name>Example</last_name>
    <phone>555-867-5309</phone>
    <email>[email protected]</email>
    <address1>123 Fourth St.</address1>
    <address2>Apt. 101</address2>
    <city>San Francisco</city>
    <state>CA</state>
    <zip>94105</zip>
    <country>US</country>
    <created_at type="datetime">2016-06-14T16:08:42Z</created_at>
    <updated_at type="datetime">2016-06-14T16:08:42Z</updated_at>
  </shipping_address>
</shipping_addresses>


{"_id":"5a0f6108823e2900127fd227","category":"5a0f6108823e2900127fd216","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55ad15f7f93f0c0d005b88a2","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-14T17:07:57.182Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"get","results":{"codes":[{"status":200,"language":"xml","code":"<shipping_address href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <id>1</id>\n  <nickname>Verena Example</nickname>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company>Recurly Inc</company>\n  <phone>555-222-124</phone>\n  <email>[email protected]</email>\n  <vat_number nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"/>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <created_at type=\"datetime\">2016-06-14T16:08:41Z</created_at>\n  <updated_at type=\"datetime\">2016-06-14T16:08:41Z</updated_at>\n</shipping_address>","name":""}]},"settings":"","auth":"required","params":[{"_id":"58011177d19a512d00a7ca56","ref":"","in":"path","required":true,"desc":"Unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"5783cda85cbce30e0074e228","ref":"","in":"path","required":true,"desc":"Shipping address unique identifier.","default":"","type":"string","name":"shipping_address_id"}],"url":"/accounts/:account_code/shipping_addresses/:shipping_address_id"},"isReference":true,"order":1,"body":"","excerpt":"Lookup the details of an account's shipping address.","slug":"lookup-shipping-address","type":"get","title":"Lookup Shipping Address","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Shipping Address

Lookup the details of an account's shipping address.

Path Params

account_code:
required
string
Unique account identifier.
shipping_address_id:
required
string
Shipping address unique identifier.

Definition

{{ api_url }}{{ page_api_url }}

Result Format

<shipping_address href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <id>1</id>
  <nickname>Verena Example</nickname>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company>Recurly Inc</company>
  <phone>555-222-124</phone>
  <email>[email protected]</email>
  <vat_number nil="nil"/>
  <address1>123 Main St.</address1>
  <address2 nil="nil"/>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <created_at type="datetime">2016-06-14T16:08:41Z</created_at>
  <updated_at type="datetime">2016-06-14T16:08:41Z</updated_at>
</shipping_address>


{"_id":"5a0f6108823e2900127fd228","category":"5a0f6108823e2900127fd216","project":"555fbba928249c1900618a82","user":"55ad15f7f93f0c0d005b88a2","parentDoc":null,"version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-14T17:14:41.338Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"code":"# Shipping addresses can be created in 3 ways:\n#   1. Embed 1 to many shipping address on an account creation\n#   2. Embed 1 shipping address on subscription creation\n#   3. Create a shipping address on an existing account\n# For 1 and 2, see account and subscription creation respectively\n# This code example shows case #3\n\n# Fetch an existing account\naccount = Recurly::Account.find('1')\n\n# Call create on the shipping_addresses association\nshipping_address = account.shipping_addresses.create(\n  nickname: \"Work\",\n  first_name: \"Verena\",\n  last_name: \"Example\",\n  company: \"Recurly Inc.\",\n  phone: \"555-555-5555\",\n  email: \"[email protected]\",\n  address1: \"400 Alabama St.\",\n  city: \"San Francisco\",\n  state: \"CA\",\n  zip: \"94110\",\n  country: \"US\"\n)\n","language":"ruby"},{"language":"xml","code":"<shipping_address>\n  <nickname>Work</nickname>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company>Recurly Inc</company>\n  <phone>555-222-1212</phone>\n  <email>[email protected]</email>\n  <address1>123 Main St.</address1>\n  <address2>Suite 101</address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n</shipping_address>"},{"code":"# Shipping addresses can be created in 3 ways:\n#   1. Embed 1 to many shipping address on an account creation\n#   2. Embed 1 shipping address on subscription creation\n#   3. Create a shipping address on an existing account\n# For 1 and 2, see account and subscription creation respectively\n# This code example shows case #3\n\n# First find an existing account\naccount = Account.get('1')\n\n# Create your shipping address object\nshad = ShippingAddress()\nshad.nickname = \"Work\"\nshad.first_name = \"Verena\"\nshad.last_name = \"Example\"\nshad.company = \"Recurly Inc.\"\nshad.phone = \"555-555-5555\"\nshad.email = \"[email protected]\"\nshad.address1 = \"123 Main St.\"\nshad.city = \"San Francisco\"\nshad.state = \"CA\"\nshad.zip = \"94110\"\nshad.country = \"US\"\n\n# Persist the shipping address and link to the account\naccount.create_shipping_address(shad)","language":"python"}]},"method":"post","results":{"codes":[{"status":201,"language":"xml","code":"<shipping_address href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <id>1</id>\n  <nickname>Work</nickname>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company>Recurly Inc</company>\n  <phone>555-222-1212</phone>\n  <email>[email protected]</email>\n  <vat_number nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2>Suite 101</address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <created_at type=\"datetime\">2016-06-14T16:08:41Z</created_at>\n  <updated_at type=\"datetime\">2016-06-14T16:08:41Z</updated_at>\n</shipping_address>","name":""}]},"auth":"required","params":[{"_id":"5801189ed1c26f0f00ac53b9","ref":"","in":"path","required":true,"desc":"Unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"5898d9b4372db21b008cb0e5","ref":"","in":"body","required":false,"desc":"A nickname for the shipping address. Defaults to \"first_name last_name\". Max of 255 characters.","default":"","type":"string","name":"nickname"},{"_id":"557f32d1e211d20d00601430","ref":"","in":"body","required":true,"desc":"The first name for the account. Max of 255 characters.","default":"","type":"string","name":"first_name"},{"_id":"557f32d1e211d20d0060142f","ref":"","in":"body","required":true,"desc":"The last name for the account.  Max of 255 characters.","default":"","type":"string","name":"last_name"},{"_id":"557f32d1e211d20d0060142e","ref":"","in":"body","required":false,"desc":"The company name for the shipping address. Max of 50 characters.","default":"","type":"string","name":"company"},{"_id":"5898d9b4372db21b008cb0e4","ref":"","in":"body","required":false,"desc":"The phone number for the shipping address.","default":"","type":"string","name":"phone"},{"_id":"557f3209e211d20d00601423","ref":"","in":"body","required":false,"desc":"The email address for the shipping address.","default":"","type":"string","name":"email"},{"_id":"557f32d1e211d20d00601429","ref":"","in":"body","required":true,"desc":"Address line 1.","default":"","type":"string","name":"address1"},{"_id":"5898d9b4372db21b008cb0e3","ref":"","in":"body","required":true,"desc":"Address line 2.","default":"","type":"string","name":"address2"},{"_id":"5898d9b4372db21b008cb0e2","ref":"","in":"body","required":true,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5898d9b4372db21b008cb0e1","ref":"","in":"body","required":true,"desc":"State or region","default":"","type":"string","name":"state"},{"_id":"5898d9b4372db21b008cb0e0","ref":"","in":"body","required":true,"desc":"Zip or postal code","default":"","type":"string","name":"zip"},{"_id":"5898d9b4372db21b008cb0df","ref":"","in":"body","required":true,"desc":"Country,  [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements).","default":"","type":"string","name":"country"},{"_id":"557f32d1e211d20d0060142d","ref":"","in":"body","required":false,"desc":"Customer's VAT number (to avoid having VAT applied, if applicable).","default":"","type":"string","name":"vat_number"}],"url":"/accounts/:account_code/shipping_addresses"},"isReference":true,"order":2,"body":"","excerpt":"Creates a new shipping address on an existing account.","slug":"create-shipping-address-on-an-account","type":"post","title":"Create Shipping Address","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Shipping Address

Creates a new shipping address on an existing account.

Path Params

account_code:
required
string
Unique account identifier.

Body Params

nickname:
string
A nickname for the shipping address. Defaults to "first_name last_name". Max of 255 characters.
first_name:
required
string
The first name for the account. Max of 255 characters.
last_name:
required
string
The last name for the account. Max of 255 characters.
company:
string
The company name for the shipping address. Max of 50 characters.
phone:
string
The phone number for the shipping address.
email:
string
The email address for the shipping address.
address1:
required
string
Address line 1.
address2:
required
string
Address line 2.
city:
required
string
City
state:
required
string
State or region
zip:
required
string
Zip or postal code
country:
required
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements).
vat_number:
string
Customer's VAT number (to avoid having VAT applied, if applicable).

Definition

{{ api_url }}{{ page_api_url }}

Examples

# Shipping addresses can be created in 3 ways:
#   1. Embed 1 to many shipping address on an account creation
#   2. Embed 1 shipping address on subscription creation
#   3. Create a shipping address on an existing account
# For 1 and 2, see account and subscription creation respectively
# This code example shows case #3

# Fetch an existing account
account = Recurly::Account.find('1')

# Call create on the shipping_addresses association
shipping_address = account.shipping_addresses.create(
  nickname: "Work",
  first_name: "Verena",
  last_name: "Example",
  company: "Recurly Inc.",
  phone: "555-555-5555",
  email: "[email protected]",
  address1: "400 Alabama St.",
  city: "San Francisco",
  state: "CA",
  zip: "94110",
  country: "US"
)
<shipping_address>
  <nickname>Work</nickname>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company>Recurly Inc</company>
  <phone>555-222-1212</phone>
  <email>[email protected]</email>
  <address1>123 Main St.</address1>
  <address2>Suite 101</address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
</shipping_address>
# Shipping addresses can be created in 3 ways:
#   1. Embed 1 to many shipping address on an account creation
#   2. Embed 1 shipping address on subscription creation
#   3. Create a shipping address on an existing account
# For 1 and 2, see account and subscription creation respectively
# This code example shows case #3

# First find an existing account
account = Account.get('1')

# Create your shipping address object
shad = ShippingAddress()
shad.nickname = "Work"
shad.first_name = "Verena"
shad.last_name = "Example"
shad.company = "Recurly Inc."
shad.phone = "555-555-5555"
shad.email = "[email protected]"
shad.address1 = "123 Main St."
shad.city = "San Francisco"
shad.state = "CA"
shad.zip = "94110"
shad.country = "US"

# Persist the shipping address and link to the account
account.create_shipping_address(shad)

Result Format

<shipping_address href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <id>1</id>
  <nickname>Work</nickname>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company>Recurly Inc</company>
  <phone>555-222-1212</phone>
  <email>[email protected]</email>
  <vat_number nil="nil"/>
  <address1>123 Main St.</address1>
  <address2>Suite 101</address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <created_at type="datetime">2016-06-14T16:08:41Z</created_at>
  <updated_at type="datetime">2016-06-14T16:08:41Z</updated_at>
</shipping_address>


{"_id":"5a0f6108823e2900127fd229","category":"5a0f6108823e2900127fd216","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55ad15f7f93f0c0d005b88a2","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-14T17:54:09.840Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"put","results":{"codes":[{"language":"xml","code":"<shipping_address href=\"https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\">\n  <id>1</id>\n  <nickname>newnick</nickname>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company>Recurly Inc</company>\n  <phone>555-222-1234</phone>\n  <email>[email protected]</email>\n  <vat_number nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"/>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <created_at type=\"datetime\">2016-06-14T16:08:41Z</created_at>\n  <updated_at type=\"datetime\">2016-06-14T16:08:41Z</updated_at>\n</shipping_address>","name":"","status":201}]},"settings":"","examples":{"codes":[{"language":"ruby","code":"# Call update_attributes on any shipping_address object\nshipping_address.update_attributes(\n  nickname: 'newnick',\n  phone: '555-222-1234'\n)"},{"code":"<shipping_address>\n  <nickname></nickname>\n  <phone>555-222-1234</phone>\n  <address2></address2>\n</shipping_address>","language":"xml"},{"code":"# mutate the properties of any shipping address object\nshipping_address.nickname = 'newnickname'\nshipping_address.phone = '555-555-1234'\n\n# then call save\nshipping_address.save()","language":"python"}]},"auth":"required","params":[{"_id":"5801189ed1c26f0f00ac53b9","ref":"","in":"path","required":true,"desc":"Unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"58011c36d19a512d00a7ca6a","ref":"","in":"path","required":true,"desc":"Shipping address unique identifier.","default":"","type":"string","name":"shipping_address_id"},{"_id":"5898dbfbec49fb0f004c25e4","ref":"","in":"body","required":false,"desc":"A nickname for the shipping address. Defaults to \"first_name last_name\". Max of 255 characters.","default":"","type":"string","name":"nickname"},{"_id":"557f32d1e211d20d00601430","ref":"","in":"body","required":false,"desc":"The first name for the account. Max of 255 characters.","default":"","type":"string","name":"first_name"},{"_id":"557f32d1e211d20d0060142f","ref":"","in":"body","required":false,"desc":"The last name for the account.  Max of 255 characters.","default":"","type":"string","name":"last_name"},{"_id":"557f32d1e211d20d0060142e","ref":"","in":"body","required":false,"desc":"The company name for the account. Max of 50 characters.","default":"","type":"string","name":"company"},{"_id":"5898dbfbec49fb0f004c25e3","ref":"","in":"body","required":false,"desc":"The phone number for the shipping address.","default":"","type":"string","name":"phone"},{"_id":"557f3209e211d20d00601423","ref":"","in":"body","required":false,"desc":"The email address for the account.","default":"","type":"string","name":"email"},{"_id":"5898dbfbec49fb0f004c25e2","ref":"","in":"body","required":false,"desc":"Address line 1.","default":"","type":"string","name":"address1"},{"_id":"5898dbfbec49fb0f004c25e1","ref":"","in":"body","required":false,"desc":"Address line 2.","default":"","type":"string","name":"address2"},{"_id":"5898dbfbec49fb0f004c25e0","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5898dbfbec49fb0f004c25df","ref":"","in":"body","required":false,"desc":"State or region","default":"","type":"string","name":"state"},{"_id":"5898dbfbec49fb0f004c25de","ref":"","in":"body","required":false,"desc":"Zip or postal code","default":"","type":"string","name":"zip"},{"_id":"5898dbfbec49fb0f004c25dd","ref":"","in":"body","required":false,"desc":"Country,  [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements).","default":"","type":"string","name":"country"},{"_id":"557f32d1e211d20d0060142d","ref":"","in":"body","required":false,"desc":"The VAT number to avoid having the VAT applied (if applicable).","default":"","type":"string","name":"vat_number"}],"url":"/accounts/:account_code/shipping_addresses/:shipping_address_id"},"isReference":true,"order":3,"body":"","excerpt":"Updates an existing shipping address on an existing account.","slug":"edit-shipping-address-on-an-existing-account","type":"put","title":"Update Shipping Address","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Shipping Address

Updates an existing shipping address on an existing account.

Path Params

account_code:
required
string
Unique account identifier.
shipping_address_id:
required
string
Shipping address unique identifier.

Body Params

nickname:
string
A nickname for the shipping address. Defaults to "first_name last_name". Max of 255 characters.
first_name:
string
The first name for the account. Max of 255 characters.
last_name:
string
The last name for the account. Max of 255 characters.
company:
string
The company name for the account. Max of 50 characters.
phone:
string
The phone number for the shipping address.
email:
string
The email address for the account.
address1:
string
Address line 1.
address2:
string
Address line 2.
city:
string
City
state:
string
State or region
zip:
string
Zip or postal code
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements).
vat_number:
string
The VAT number to avoid having the VAT applied (if applicable).

Definition

{{ api_url }}{{ page_api_url }}

Examples

# Call update_attributes on any shipping_address object
shipping_address.update_attributes(
  nickname: 'newnick',
  phone: '555-222-1234'
)
<shipping_address>
  <nickname></nickname>
  <phone>555-222-1234</phone>
  <address2></address2>
</shipping_address>
# mutate the properties of any shipping address object
shipping_address.nickname = 'newnickname'
shipping_address.phone = '555-555-1234'

# then call save
shipping_address.save()

Result Format

<shipping_address href="https://your-subdomain.recurly.com/v2/accounts/1/shipping_addresses/1">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1">
  <id>1</id>
  <nickname>newnick</nickname>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company>Recurly Inc</company>
  <phone>555-222-1234</phone>
  <email>[email protected]</email>
  <vat_number nil="nil"/>
  <address1>123 Main St.</address1>
  <address2 nil="nil"/>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <created_at type="datetime">2016-06-14T16:08:41Z</created_at>
  <updated_at type="datetime">2016-06-14T16:08:41Z</updated_at>
</shipping_address>


{"_id":"5a0f6108823e2900127fd22a","category":"5a0f6108823e2900127fd216","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55ad15f7f93f0c0d005b88a2","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-10-15T00:27:13.096Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"ruby","code":"# call destroy on any shipping address object\nshipping_address.destroy"},{"language":"xml","code":"<shipping_address>\n  <nickname></nickname>\n  <phone>555-222-1234</phone>\n  <address2></address2>\n</shipping_address>"},{"code":"# call delete() on any shipping address object\nshipping_address.delete()","language":"python"}]},"method":"delete","results":{"codes":[{"status":204,"language":"xml","code":"Status: 204 No Content","name":""}]},"settings":"","auth":"required","params":[{"_id":"5801189ed1c26f0f00ac53b9","ref":"","in":"path","required":true,"desc":"Unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"58011c36d19a512d00a7ca6a","ref":"","in":"path","required":true,"desc":"Shipping address unique identifier.","default":"","type":"string","name":"shipping_address_id"}],"url":"/accounts/:account_code/shipping_addresses/:shipping_address_id"},"isReference":true,"order":4,"body":"","excerpt":"Deletes an existing shipping address from an existing account.","slug":"delete-shipping-address-on-an-existing-account","type":"delete","title":"Delete Shipping Address","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

deleteDelete Shipping Address

Deletes an existing shipping address from an existing account.

Path Params

account_code:
required
string
Unique account identifier.
shipping_address_id:
required
string
Shipping address unique identifier.

Definition

{{ api_url }}{{ page_api_url }}

Examples

# call destroy on any shipping address object
shipping_address.destroy
<shipping_address>
  <nickname></nickname>
  <phone>555-222-1234</phone>
  <address2></address2>
</shipping_address>
# call delete() on any shipping address object
shipping_address.delete()

Result Format

Status: 204 No Content


{"_id":"5a0f610b823e2900127fd2b8","category":"5a0f6108823e2900127fd217","project":"555fbba928249c1900618a82","parentDoc":null,"user":"559d85d26b21311700fb0b7b","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-12T19:37:00.632Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"xml","code":"<account_acquisition>\n  <cost_in_cents type=\"integer\">199</cost_in_cents>\n  <currency>USD</currency>\n  <channel>blog</channel>\n  <subchannel>Whitepaper Blog Post</subchannel>\n  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n</account_acquisition>"},{"language":"php","code":"$acquisition = new Recurly_AccountAcquisition();\n$acquisition->account_code = '1';\n$acquisition->cost_in_cents = 142;\n$acquisition->currency = 'USD';\n$acquisition->channel = 'paid_search';\n$acquisition->subchannel = 'Google Ads';\n$acquisition->campaign = 'JSE-2345';\n$acquisition->create();"}]},"method":"post","results":{"codes":[{"name":"","code":"<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <cost_in_cents type=\"integer\">199</cost_in_cents>\n  <currency>USD</currency>\n  <channel>blog</channel>\n  <subchannel>Whitepaper Blog Post</subchannel>\n  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n  <created_at type=\"datetime\">2016-08-12T19:45:14Z</created_at>\n  <updated_at type=\"datetime\">2016-08-12T19:45:14Z</updated_at>\n</account_acquisition>","language":"xml","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[{"_id":"57ae255c9af3430e00e17672","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"57ae27581a95170e000f2233","ref":"","in":"body","required":false,"desc":"Total cost of marketing activities to acquire the customer.","default":"","type":"int","name":"cost_in_cents"},{"_id":"57ae27581a95170e000f2232","ref":"","in":"body","required":false,"desc":"Currency, 3-letter ISO code.","default":"","type":"string","name":"currency"},{"_id":"57ae27581a95170e000f2231","ref":"","in":"body","required":false,"desc":"The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.","default":"","type":"string","name":"channel"},{"_id":"57ae27581a95170e000f2230","ref":"","in":"body","required":false,"desc":"A free-form field to provide additional detail on the acquisition channel.","default":"","type":"string","name":"subchannel"},{"_id":"57ae27581a95170e000f222f","ref":"","in":"body","required":false,"desc":"Identifier for the marketing campaign used to convert this account.","default":"","type":"string","name":"campaign"}],"url":"/accounts/:account_code/acquisition"},"isReference":true,"order":0,"body":"","excerpt":"Create or update an account's acquisition data.","slug":"create-account-acquisition","type":"post","title":"Create Account Acquisition","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account Acquisition

Create or update an account's acquisition data.

Path Params

account_code:
required
string
Account's unique code.

Body Params

cost_in_cents:
integer
Total cost of marketing activities to acquire the customer.
currency:
string
Currency, 3-letter ISO code.
channel:
string
The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.
subchannel:
string
A free-form field to provide additional detail on the acquisition channel.
campaign:
string
Identifier for the marketing campaign used to convert this account.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<account_acquisition>
  <cost_in_cents type="integer">199</cost_in_cents>
  <currency>USD</currency>
  <channel>blog</channel>
  <subchannel>Whitepaper Blog Post</subchannel>
  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>
</account_acquisition>
$acquisition = new Recurly_AccountAcquisition();
$acquisition->account_code = '1';
$acquisition->cost_in_cents = 142;
$acquisition->currency = 'USD';
$acquisition->channel = 'paid_search';
$acquisition->subchannel = 'Google Ads';
$acquisition->campaign = 'JSE-2345';
$acquisition->create();

Result Format

<account_acquisition href="https://your-subdomain.recurly.com/v2/accounts/1/acquisition">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <cost_in_cents type="integer">199</cost_in_cents>
  <currency>USD</currency>
  <channel>blog</channel>
  <subchannel>Whitepaper Blog Post</subchannel>
  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>
  <created_at type="datetime">2016-08-12T19:45:14Z</created_at>
  <updated_at type="datetime">2016-08-12T19:45:14Z</updated_at>
</account_acquisition>
{}


{"_id":"5a0f610b823e2900127fd2b9","category":"5a0f6108823e2900127fd217","parentDoc":null,"project":"555fbba928249c1900618a82","user":"559d85d26b21311700fb0b7b","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-12T19:37:45.157Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"Recurly_AccountAcquisition::get('1');"}]},"method":"get","results":{"codes":[{"name":"","code":"<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <cost_in_cents type=\"integer\">199</cost_in_cents>\n  <currency>USD</currency>\n  <channel>blog</channel>\n  <subchannel>Whitepaper Blog Post</subchannel>\n  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n  <created_at type=\"datetime\">2016-08-12T19:45:14Z</created_at>\n  <updated_at type=\"datetime\">2016-08-12T19:45:14Z</updated_at>\n</account_acquisition>","language":"xml","status":200},{"name":"","code":"<error>\n  <symbol>not_found</symbol>\n  <description lang=\"en-US\">Couldn't find AccountAcquisition with account_code = 1</description>\n</error>","language":"xml","status":404}]},"settings":"","auth":"required","params":[{"_id":"57ae255c9af3430e00e17672","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code/acquisition"},"isReference":true,"order":1,"body":"","excerpt":"Returns an account's acquisition data.","slug":"lookup-account-acquisition","type":"get","title":"Lookup Account Acquisition","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Account Acquisition

Returns an account's acquisition data.

Path Params

account_code:
required
string
Account's unique code.

Definition

{{ api_url }}{{ page_api_url }}

Examples

Recurly_AccountAcquisition::get('1');

Result Format

<account_acquisition href="https://your-subdomain.recurly.com/v2/accounts/1/acquisition">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <cost_in_cents type="integer">199</cost_in_cents>
  <currency>USD</currency>
  <channel>blog</channel>
  <subchannel>Whitepaper Blog Post</subchannel>
  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>
  <created_at type="datetime">2016-08-12T19:45:14Z</created_at>
  <updated_at type="datetime">2016-08-12T19:45:14Z</updated_at>
</account_acquisition>
<error>
  <symbol>not_found</symbol>
  <description lang="en-US">Couldn't find AccountAcquisition with account_code = 1</description>
</error>


{"_id":"5a0f610b823e2900127fd2ba","category":"5a0f6108823e2900127fd217","parentDoc":null,"user":"559d85d26b21311700fb0b7b","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-12T19:48:43.370Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<account_acquisition>\n  <cost_in_cents type=\"integer\">150</cost_in_cents>\n  <currency>EUR</currency>\n</account_acquisition>","language":"xml"},{"code":"$acquisition = Recurly_AccountAcquisition::get($account_code);\n$acquisition->currency = 'EUR';\n$acquisition->cost_in_cents = 150;\n$acquisition->update();","language":"php"}]},"method":"put","results":{"codes":[{"name":"","code":"<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <cost_in_cents type=\"integer\">150</cost_in_cents>\n  <currency>EUR</currency>\n  <channel>blog</channel>\n  <subchannel>Whitepaper Blog Post</subchannel>\n  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n  <created_at type=\"datetime\">2016-08-12T19:49:43Z</created_at>\n  <updated_at type=\"datetime\">2016-08-12T19:49:55Z</updated_at>\n</account_acquisition>","language":"xml","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[{"_id":"57ae255c9af3430e00e17672","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"57ae27581a95170e000f2233","ref":"","in":"body","required":false,"desc":"Total cost of marketing activities to acquire the customer.","default":"","type":"int","name":"cost_in_cents"},{"_id":"57ae27581a95170e000f2232","ref":"","in":"body","required":false,"desc":"Currency, 3-letter ISO code.","default":"","type":"string","name":"currency"},{"_id":"57ae27581a95170e000f2231","ref":"","in":"body","required":false,"desc":"The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.","default":"","type":"string","name":"channel"},{"_id":"57ae27581a95170e000f2230","ref":"","in":"body","required":false,"desc":"A free-form field to provide additional detail on the acquisition channel.","default":"","type":"string","name":"subchannel"},{"_id":"57ae27581a95170e000f222f","ref":"","in":"body","required":false,"desc":"Identifier for the marketing campaign used to convert this account.","default":"","type":"string","name":"campaign"}],"url":"/accounts/:account_code/acquisition"},"isReference":true,"order":2,"body":"","excerpt":"Create or update an account's acquisition data.","slug":"update-account-acquisition","type":"put","title":"Update Account Acquisition","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account Acquisition

Create or update an account's acquisition data.

Path Params

account_code:
required
string
Account's unique code.

Body Params

cost_in_cents:
integer
Total cost of marketing activities to acquire the customer.
currency:
string
Currency, 3-letter ISO code.
channel:
string
The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.
subchannel:
string
A free-form field to provide additional detail on the acquisition channel.
campaign:
string
Identifier for the marketing campaign used to convert this account.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<account_acquisition>
  <cost_in_cents type="integer">150</cost_in_cents>
  <currency>EUR</currency>
</account_acquisition>
$acquisition = Recurly_AccountAcquisition::get($account_code);
$acquisition->currency = 'EUR';
$acquisition->cost_in_cents = 150;
$acquisition->update();

Result Format

<account_acquisition href="https://your-subdomain.recurly.com/v2/accounts/1/acquisition">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <cost_in_cents type="integer">150</cost_in_cents>
  <currency>EUR</currency>
  <channel>blog</channel>
  <subchannel>Whitepaper Blog Post</subchannel>
  <campaign>mailchimp67a904de95.0914d8f4b4</campaign>
  <created_at type="datetime">2016-08-12T19:49:43Z</created_at>
  <updated_at type="datetime">2016-08-12T19:49:55Z</updated_at>
</account_acquisition>
{}


{"_id":"5a0f610b823e2900127fd2bb","category":"5a0f6108823e2900127fd217","parentDoc":null,"project":"555fbba928249c1900618a82","user":"559d85d26b21311700fb0b7b","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-08-12T19:48:02.744Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"delete","results":{"codes":[{"name":"","code":"","language":"xml","status":204},{"name":"","code":"<error>\n  <symbol>not_found</symbol>\n  <description lang=\"en-US\">Couldn't find AccountAcquisition with account_code = 1</description>\n</error>","language":"xml","status":404}]},"settings":"","examples":{"codes":[{"code":"Recurly_AccountAcquisition::deleteForAccount('1');","language":"php"}]},"auth":"required","params":[{"_id":"57ae255c9af3430e00e17672","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code/acquisition"},"isReference":true,"order":3,"body":"","excerpt":"Remove an account's acquisition data.","slug":"clear-account-acquisition","type":"delete","title":"Clear Account Acquisition","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

deleteClear Account Acquisition

Remove an account's acquisition data.

Path Params

account_code:
required
string
Account's unique code.

Definition

{{ api_url }}{{ page_api_url }}

Examples

Recurly_AccountAcquisition::deleteForAccount('1');


{"_id":"5a0f610a823e2900127fd28a","category":"5a0f6108823e2900127fd218","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-15T21:26:29.282Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[]},"method":"get","results":{"codes":[{"code":"<adjustment href=\"https://your-subdomain.recurly.com/v2/adjustments/37bff9dd3ec90471cf62bd4f6f80db3d\" type=\"charge\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <invoice href=\"https://your-subdomain.recurly.com/v2/invoices/1006\"/>\n  <subscription href=\"https://your-subdomain.recurly.com/v2/subscriptions/37bfef7a8e44cfc3817b7a43eba8a6e6\"/>\n  <uuid>37bff9dd3ec90471cf62bd4f6f80db3d</uuid>\n  <state>invoiced</state>\n  <description>Refund for Setup fee: Gold plan</description>\n  <accounting_code nil=\"nil\"/>\n  <product_code>gold</product_code>\n  <origin>setup_fee</origin>\n  <unit_amount_in_cents type=\"integer\">800</unit_amount_in_cents>\n  <quantity type=\"integer\">-1</quantity>\n  <quantity_remaining type=\"integer\">0</quantity_remaining>\n  <original_adjustment_uuid>37bfef7af3cd23ee89d77a435aa1838d</original_adjustment_uuid>\n  <discount_in_cents type=\"integer\">0</discount_in_cents>\n  <tax_in_cents type=\"integer\">-70</tax_in_cents>\n  <total_in_cents type=\"integer\">-870</total_in_cents>\n  <currency>EUR</currency>\n  <proration_rate type=\"float\">0.1</proration_rate>\n  <taxable type=\"boolean\">false</taxable>\n  <tax_type>usst</tax_type>\n  <tax_region>CA</tax_region>\n  <tax_rate type=\"float\">0.0875</tax_rate>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <tax_code nil=\"nil\"/>\n  <tax_details type=\"array\">\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>state</type>\n      <tax_rate type=\"float\">0.065</tax_rate>\n      <tax_in_cents type=\"integer\">-52</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>county</type>\n      <tax_rate type=\"float\">0.01</tax_rate>\n      <tax_in_cents type=\"integer\">-8</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>city</type>\n      <tax_rate type=\"float\">0.0</tax_rate>\n      <tax_in_cents type=\"integer\">0</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>special</type>\n      <tax_rate type=\"float\">0.0125</tax_rate>\n      <tax_in_cents type=\"integer\">-10</tax_in_cents>\n    </tax_detail>\n  </tax_details>\n  <start_date type=\"datetime\">2016-08-03T16:02:24Z</start_date>\n  <end_date nil=\"nil\"/>\n  <created_at type=\"datetime\">2016-08-03T16:13:44Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:13:44Z</updated_at>\n  <revenue_schedule_type>evenly</revenue_schedule_type>\n</adjustment>","language":"xml","status":200,"name":""}]},"auth":"required","params":[{"_id":"55f88d0560cc850d008a7bae","ref":"","in":"body","required":false,"desc":"The URL of the account for the specified adjustment.","default":"","type":"string","name":"account"},{"_id":"55f88d0560cc850d008a7bad","ref":"","in":"body","required":false,"desc":"The URL of the invoice for the specified adjustment.","default":"","type":"string","name":"invoice"},{"_id":"55f8905559eace0d0087dc69","ref":"","in":"body","required":false,"desc":"The type of adjustment to return: `charge` or `credit`.","default":"","type":"string","name":"type"},{"_id":"55f88d0560cc850d008a7bac","ref":"","in":"body","required":false,"desc":"The unique identifier of the adjustment.","default":"","type":"string","name":"uuid"},{"_id":"55f88d0560cc850d008a7bab","ref":"","in":"body","required":false,"desc":"The state of the adjustments to return: `pending` or `invoiced`.","default":"","type":"string","name":"state"},{"_id":"55f88d0560cc850d008a7baa","ref":"","in":"body","required":false,"desc":"Description of the adjustment for the adjustment. Max 255 characters.","default":"","type":"string","name":"description"},{"_id":"55f88d0560cc850d008a7ba9","ref":"","in":"body","required":false,"desc":"Accounting code. Max of 20 characters.","default":"","type":"string","name":"accounting_code"},{"_id":"55f88d0560cc850d008a7ba8","ref":"","in":"body","required":false,"desc":"The origin of the adjustment to return: `plan`, `plan_trial`, `setup_fee`, `add_on`, `add_on_trial`, `one_time`, `debit`, `credit`, `coupon`, or `carryforward`.","default":"","type":"string","name":"origin"},{"_id":"55f88d0560cc850d008a7ba7","ref":"","in":"body","required":false,"desc":"Positive amount for a charge, negative amount for a credit. Max 10000000.","default":"","type":"int","name":"unit_amount_in_cents"},{"_id":"55f88d0560cc850d008a7ba6","ref":"","in":"body","required":false,"desc":"Quantity.","default":"1","type":"string","name":"quantity"},{"_id":"55f88d0560cc850d008a7ba5","ref":"","in":"body","required":false,"desc":"Only shows if adjustment is a credit created from another credit.","default":"","type":"string","name":"original_adjustment_uuid"},{"_id":"55f88d0560cc850d008a7ba4","ref":"","in":"body","required":false,"desc":"The discount on the adjustment, in cents.","default":"","type":"int","name":"discount_in_cents"},{"_id":"55f88d0560cc850d008a7ba3","ref":"","in":"body","required":false,"desc":"The tax on the adjustment, in cents.","default":"","type":"int","name":"tax_in_cents"},{"_id":"55f88d0560cc850d008a7ba2","ref":"","in":"body","required":false,"desc":"The total amount of the adjustment, in cents.","default":"","type":"int","name":"total_in_cents"},{"_id":"55f88d0560cc850d008a7ba1","ref":"","in":"body","required":false,"desc":"Currency, 3-letter ISO code.","default":"","type":"string","name":"currency"},{"_id":"55f88d0560cc850d008a7ba0","ref":"","in":"body","required":false,"desc":"`true` if the current adjustment is taxable, `false` if it is not.","default":"","type":"boolean","name":"taxable"},{"_id":"55f88d0560cc850d008a7b9f","ref":"","in":"body","required":false,"desc":"The tax type of the adjustment.","default":"","type":"string","name":"tax_type"},{"_id":"55f88d0560cc850d008a7b9e","ref":"","in":"body","required":false,"desc":"The tax region of the adjustment.","default":"","type":"string","name":"tax_region"},{"_id":"55f88d0560cc850d008a7b9d","ref":"","in":"body","required":false,"desc":"The tax rate of the adjustment.","default":"","type":"string","name":"tax_rate"},{"_id":"55f88d0560cc850d008a7b9c","ref":"","in":"body","required":false,"desc":"`true` exempts tax on the charge, `false` applies tax on the charge. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative adjustments). Credits are always post-tax. Pre-tax discounts should use the Coupons feature.","default":"","type":"boolean","name":"tax_exempt"},{"_id":"55f88d0560cc850d008a7b9b","ref":"","in":"body","required":false,"desc":"The nested address information of the adjustment: `name `, `type`, `tax_rate`, `tax_in_cents`.","default":"","type":"array_mixed","name":"tax_details"},{"_id":"55f88d2bb089b71700a8363c","ref":"","in":"body","required":false,"desc":"Optional field for EU VAT merchants and Avalara AvaTax Pro merchants. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If you have your own AvaTax account configured, you can use Avalara tax codes to assign custom tax rules.","default":"","type":"string","name":"tax_code"},{"_id":"55f88d0560cc850d008a7b9a","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the adjustment began.","default":"Today","type":"datetime","name":"start_date"},{"_id":"55f88d0560cc850d008a7b99","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the adjustment ended.","default":"","type":"datetime","name":"end_date"},{"_id":"55f88d0560cc850d008a7b98","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the adjustment was created.","default":"","type":"datetime","name":"created_at"},{"_id":"58c821b8580c540f00af78a9","ref":"","in":"body","required":false,"desc":"For plan related line items this will be the plan's code, for add-on related line items it will be the add-on's code.","default":"","type":"string","name":"product_code"},{"_id":"5a0df50942e7b1001205708b","ref":"","in":"body","required":false,"desc":"A link to the adjustment’s invoice’s first subscription (if it exists).","default":"","type":"string","name":"subscription"},{"_id":"5a6232b189d027001e2d8c1a","ref":"","in":"body","required":false,"desc":"The proration rate is only present on prorated adjustments. It represents how much the adjustment was prorated to account for a mid cycle subscription change.","default":"","type":"float","name":"proration_rate"}],"url":"/adjustments"},"isReference":true,"order":0,"body":"","excerpt":"The history of your customer's Recurly account can be tracked through adjustments, made up of credits and charges.","slug":"adjustment-object","type":"get","title":"Adjustment Object","__v":2,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getAdjustment Object

The history of your customer's Recurly account can be tracked through adjustments, made up of credits and charges.

Body Params

account:
string
The URL of the account for the specified adjustment.
invoice:
string
The URL of the invoice for the specified adjustment.
type:
string
The type of adjustment to return: `charge` or `credit`.
uuid:
string
The unique identifier of the adjustment.
state:
string
The state of the adjustments to return: `pending` or `invoiced`.
description:
string
Description of the adjustment for the adjustment. Max 255 characters.
accounting_code:
string
Accounting code. Max of 20 characters.
origin:
string
The origin of the adjustment to return: `plan`, `plan_trial`, `setup_fee`, `add_on`, `add_on_trial`, `one_time`, `debit`, `credit`, `coupon`, or `carryforward`.
unit_amount_in_cents:
integer
Positive amount for a charge, negative amount for a credit. Max 10000000.
quantity:
string1
Quantity.
original_adjustment_uuid:
string
Only shows if adjustment is a credit created from another credit.
discount_in_cents:
integer
The discount on the adjustment, in cents.
tax_in_cents:
integer
The tax on the adjustment, in cents.
total_in_cents:
integer
The total amount of the adjustment, in cents.
currency:
string
Currency, 3-letter ISO code.
taxable:
boolean
`true` if the current adjustment is taxable, `false` if it is not.
tax_type:
string
The tax type of the adjustment.
tax_region:
string
The tax region of the adjustment.
tax_rate:
string
The tax rate of the adjustment.
tax_exempt:
boolean
`true` exempts tax on the charge, `false` applies tax on the charge. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative adjustments). Credits are always post-tax. Pre-tax discounts should use the Coupons feature.
tax_details:
array of mixed
The nested address information of the adjustment: `name `, `type`, `tax_rate`, `tax_in_cents`.
tax_code:
string
Optional field for EU VAT merchants and Avalara AvaTax Pro merchants. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If you have your own AvaTax account configured, you can use Avalara tax codes to assign custom tax rules.
start_date:
datetimeToday
A timestamp associated with when the adjustment began.
end_date:
datetime
A timestamp associated with when the adjustment ended.
created_at:
datetime
A timestamp associated with when the adjustment was created.
product_code:
string
For plan related line items this will be the plan's code, for add-on related line items it will be the add-on's code.
subscription:
string
A link to the adjustment’s invoice’s first subscription (if it exists).
proration_rate:
float
The proration rate is only present on prorated adjustments. It represents how much the adjustment was prorated to account for a mid cycle subscription change.

Definition

{{ api_url }}{{ page_api_url }}

Result Format

<adjustment href="https://your-subdomain.recurly.com/v2/adjustments/37bff9dd3ec90471cf62bd4f6f80db3d" type="charge">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <invoice href="https://your-subdomain.recurly.com/v2/invoices/1006"/>
  <subscription href="https://your-subdomain.recurly.com/v2/subscriptions/37bfef7a8e44cfc3817b7a43eba8a6e6"/>
  <uuid>37bff9dd3ec90471cf62bd4f6f80db3d</uuid>
  <state>invoiced</state>
  <description>Refund for Setup fee: Gold plan</description>
  <accounting_code nil="nil"/>
  <product_code>gold</product_code>
  <origin>setup_fee</origin>
  <unit_amount_in_cents type="integer">800</unit_amount_in_cents>
  <quantity type="integer">-1</quantity>
  <quantity_remaining type="integer">0</quantity_remaining>
  <original_adjustment_uuid>37bfef7af3cd23ee89d77a435aa1838d</original_adjustment_uuid>
  <discount_in_cents type="integer">0</discount_in_cents>
  <tax_in_cents type="integer">-70</tax_in_cents>
  <total_in_cents type="integer">-870</total_in_cents>
  <currency>EUR</currency>
  <proration_rate type="float">0.1</proration_rate>
  <taxable type="boolean">false</taxable>
  <tax_type>usst</tax_type>
  <tax_region>CA</tax_region>
  <tax_rate type="float">0.0875</tax_rate>
  <tax_exempt type="boolean">false</tax_exempt>
  <tax_code nil="nil"/>
  <tax_details type="array">
    <tax_detail>
      <name nil="nil"/>
      <type>state</type>
      <tax_rate type="float">0.065</tax_rate>
      <tax_in_cents type="integer">-52</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>county</type>
      <tax_rate type="float">0.01</tax_rate>
      <tax_in_cents type="integer">-8</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>city</type>
      <tax_rate type="float">0.0</tax_rate>
      <tax_in_cents type="integer">0</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>special</type>
      <tax_rate type="float">0.0125</tax_rate>
      <tax_in_cents type="integer">-10</tax_in_cents>
    </tax_detail>
  </tax_details>
  <start_date type="datetime">2016-08-03T16:02:24Z</start_date>
  <end_date nil="nil"/>
  <created_at type="datetime">2016-08-03T16:13:44Z</created_at>
  <updated_at type="datetime">2016-08-03T16:13:44Z</updated_at>
  <revenue_schedule_type>evenly</revenue_schedule_type>
</adjustment>


{"_id":"5a0f610a823e2900127fd28b","category":"5a0f6108823e2900127fd218","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:21:48.674Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"code":"<?php\n\ntry {\n  $adjustments = Recurly_AdjustmentList::get('b6f5783');\n  foreach ($adjustments as $adjustment) {\n    print \"Adjustment: $adjustment\\n\";\n  }\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid account code: $e\";\n}","language":"php","name":""},{"code":"account = Recurly::Account.find('1')\naccount.adjustments.find_each do |adjustment|\n  puts \"Adjustment: #{adjustment.inspect}\"\nend","language":"ruby"},{"language":"python","code":"#client version 2.1.6+\naccount = Account.get('1')\nfor adjustment in account.adjustments():\n    print 'Adjustment: %s' % adjustment\n\n#client version <= 2.1.5\naccount = Account.get('1')\nadjustments = account.adjustments()\nwhile adjustments:\n    for adjustment in adjustments:\n        print 'Adjustment: %s' % adjustment\n    try:\n        adjustments = adjustments.next_page()\n    except PageError:\n        adjustments = ()"},{"code":"using System.Linq;\n\nvar account = Accounts.Get(\"1\");\nvar adjustments = account.GetAdjustments();\nwhile (adjustments.Any())\n{\n\tforeach (var adjustment in adjustments)\n\t\tConsole.WriteLine(\"Adjustment: \" + adjustment);\n\tadjustments = adjustments.Next;\n}","language":"csharp"}]},"method":"get","results":{"codes":[{"name":"","code":"<adjustments type=\"array\">\n  <adjustment href=\"https://your-subdomain.recurly.com/v2/adjustments/37c0038fe1ffc9405019db4a11a99aa8\" type=\"credit\">\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n    <uuid>37c0038fe1ffc9405019db4a11a99aa8</uuid>\n    <state>pending</state>\n    <description>Bonus for being a great customer</description>\n    <accounting_code nil=\"nil\"/>\n    <product_code nil=\"nil\"/>\n    <origin>credit</origin>\n    <unit_amount_in_cents type=\"integer\">-2000</unit_amount_in_cents>\n    <quantity type=\"integer\">1</quantity>\n    <discount_in_cents type=\"integer\">0</discount_in_cents>\n    <tax_in_cents type=\"integer\">0</tax_in_cents>\n    <total_in_cents type=\"integer\">-2000</total_in_cents>\n    <currency>USD</currency>\n    <taxable type=\"boolean\">false</taxable>\n    <tax_exempt type=\"boolean\">false</tax_exempt>\n    <tax_code nil=\"nil\"/>\n    <start_date type=\"datetime\">2016-08-03T16:24:20Z</start_date>\n    <end_date nil=\"nil\"/>\n    <created_at type=\"datetime\">2016-08-03T16:24:20Z</created_at>\n    <updated_at type=\"datetime\">2016-08-03T16:24:20Z</updated_at>\n    <revenue_schedule_type>at_invoice</revenue_schedule_type>\n  </adjustment>\n  <!-- Continued... -->\n</adjustments>","language":"xml","status":200}]},"auth":"required","params":[{"_id":"5783c9a7192dcf0e0099828e","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"578ea67ec93aac0e00ec88a5","ref":"","in":"query","required":false,"desc":"The attribute that will be used to order records: `created_at`, `updated_at`.","default":"created_at","type":"string","name":"sort"},{"_id":"578ea67ec93aac0e00ec88a4","ref":"","in":"query","required":false,"desc":"The order in which products will be returned: `asc` for ascending order, `desc` for descending order.","default":"desc","type":"string","name":"order"},{"_id":"578ea67ec93aac0e00ec88a3","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"begin_time"},{"_id":"578ea67ec93aac0e00ec88a2","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"end_time"},{"_id":"5783c9a7192dcf0e0099828c","ref":"","in":"query","required":false,"desc":"Number of records to return per page, up to a maximum of 200.","default":"50","type":"int","name":"per_page"},{"_id":"5783c9a7192dcf0e0099828d","ref":"","in":"query","required":false,"desc":"Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.","default":"","type":"string","name":"cursor"}],"url":"/accounts/:account_code/adjustments"},"isReference":true,"order":1,"body":"","excerpt":"Returns a list of adjustments for a given account. Results are ordered by the time created, sorted by newest first.","slug":"list-an-accounts-adjustments","type":"get","title":"List Account's Adjustments","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getList Account's Adjustments

Returns a list of adjustments for a given account. Results are ordered by the time created, sorted by newest first.

Path Params

account_code:
required
string
Account's unique code.

Query Params

sort:
stringcreated_at
The attribute that will be used to order records: `created_at`, `updated_at`.
order:
stringdesc
The order in which products will be returned: `asc` for ascending order, `desc` for descending order.
begin_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
end_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
per_page:
integer50
Number of records to return per page, up to a maximum of 200.
cursor:
string
Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $adjustments = Recurly_AdjustmentList::get('b6f5783');
  foreach ($adjustments as $adjustment) {
    print "Adjustment: $adjustment\n";
  }
} catch (Recurly_NotFoundError $e) {
  print "Invalid account code: $e";
}
account = Recurly::Account.find('1')
account.adjustments.find_each do |adjustment|
  puts "Adjustment: #{adjustment.inspect}"
end
#client version 2.1.6+
account = Account.get('1')
for adjustment in account.adjustments():
    print 'Adjustment: %s' % adjustment

#client version <= 2.1.5
account = Account.get('1')
adjustments = account.adjustments()
while adjustments:
    for adjustment in adjustments:
        print 'Adjustment: %s' % adjustment
    try:
        adjustments = adjustments.next_page()
    except PageError:
        adjustments = ()
using System.Linq;

var account = Accounts.Get("1");
var adjustments = account.GetAdjustments();
while (adjustments.Any())
{
	foreach (var adjustment in adjustments)
		Console.WriteLine("Adjustment: " + adjustment);
	adjustments = adjustments.Next;
}

Result Format

<adjustments type="array">
  <adjustment href="https://your-subdomain.recurly.com/v2/adjustments/37c0038fe1ffc9405019db4a11a99aa8" type="credit">
    <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
    <uuid>37c0038fe1ffc9405019db4a11a99aa8</uuid>
    <state>pending</state>
    <description>Bonus for being a great customer</description>
    <accounting_code nil="nil"/>
    <product_code nil="nil"/>
    <origin>credit</origin>
    <unit_amount_in_cents type="integer">-2000</unit_amount_in_cents>
    <quantity type="integer">1</quantity>
    <discount_in_cents type="integer">0</discount_in_cents>
    <tax_in_cents type="integer">0</tax_in_cents>
    <total_in_cents type="integer">-2000</total_in_cents>
    <currency>USD</currency>
    <taxable type="boolean">false</taxable>
    <tax_exempt type="boolean">false</tax_exempt>
    <tax_code nil="nil"/>
    <start_date type="datetime">2016-08-03T16:24:20Z</start_date>
    <end_date nil="nil"/>
    <created_at type="datetime">2016-08-03T16:24:20Z</created_at>
    <updated_at type="datetime">2016-08-03T16:24:20Z</updated_at>
    <revenue_schedule_type>at_invoice</revenue_schedule_type>
  </adjustment>
  <!-- Continued... -->
</adjustments>


{"_id":"5a0f610a823e2900127fd28c","category":"5a0f6108823e2900127fd218","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["55b2f1b5a96deb1900990c6f","565dc7d277f0090d0058196c"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:28:24.162Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $charge = new Recurly_Adjustment();\n  $charge->account_code = 'b6f5783';\n  $charge->description = 'Charge for extra bandwidth';\n  $charge->unit_amount_in_cents = 5000; // $50.00\n  $charge->currency = 'USD';\n  $charge->quantity = 1;\n  $charge->accounting_code = 'bandwidth';\n  $charge->tax_exempt = false;\n  $charge->create();\n\n  print \"Charge: $charge\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Account not found: $e\";\n}","language":"php"},{"code":"account = Recurly::Account.find('1')\naccount.adjustments.create(\n  :description          => 'Charge for extra bandwidth',\n  :unit_amount_in_cents => 50_00,\n  :currency             => 'USD',\n  :quantity             => 1,\n  :accounting_code      => 'bandwidth',\n  :tax_exempt           => false\n)","language":"ruby"},{"code":"account = Account.get('1')\ncharge = Adjustment(\n  description='Charge for extra bandwidth',\n  unit_amount_in_cents=5000,\n  currency='USD',\n  quantity=1,\n  accounting_code='bandwidth',\n  tax_exempt=False\n)\naccount.charge(charge)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar adjustment = account.NewAdjustment(\n\t\"USD\",                        // currency\n\t5000,                         // unit_amount_in_cents\n\t\"Charge for extra bandwidth\", // description\n\t1,                            // quantity\n\t\"bandwidth\",                  // accounting_code\n\tfalse);                       // tax_exempt\nadjustment.Create();","language":"csharp"},{"code":"<adjustment>\n  <description>Charge for extra bandwidth</description>\n  <unit_amount_in_cents>5000</unit_amount_in_cents>\n  <currency>USD</currency>\n  <quantity>1</quantity>\n  <accounting_code>bandwidth</accounting_code>\n  <tax_exempt>false</tax_exempt>\n  <revenue_schedule_type>at_invoice</revenue_schedule_type>\n</adjustment>","language":"xml"}]},"method":"post","results":{"codes":[{"name":"","code":"<adjustment href=\"https://your-subdomain.recurly.com/v2/adjustments/37c0031340577f993ff30b41738f52ff\" type=\"charge\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <uuid>37c0031340577f993ff30b41738f52ff</uuid>\n  <state>pending</state>\n  <description>Charge for extra bandwidth</description>\n  <accounting_code>bandwidth</accounting_code>\n  <product_code nil=\"nil\"/>\n  <origin>debit</origin>\n  <unit_amount_in_cents type=\"integer\">5000</unit_amount_in_cents>\n  <quantity type=\"integer\">1</quantity>\n  <discount_in_cents type=\"integer\">0</discount_in_cents>\n  <tax_in_cents type=\"integer\">0</tax_in_cents>\n  <total_in_cents type=\"integer\">5000</total_in_cents>\n  <currency>USD</currency>\n  <taxable type=\"boolean\">false</taxable>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <tax_code nil=\"nil\"/>\n  <start_date type=\"datetime\">2016-08-03T16:23:48Z</start_date>\n  <end_date nil=\"nil\"/>\n  <created_at type=\"datetime\">2016-08-03T16:23:48Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:23:48Z</updated_at>\n  <revenue_schedule_type>at_invoice</revenue_schedule_type>\n</adjustment>","language":"xml","status":201}]},"settings":"","auth":"required","params":[{"_id":"557f5188eb75d80d00af40a6","ref":"","in":"body","required":true,"desc":"Currency, 3-letter ISO code.","default":"","type":"string","name":"currency"},{"_id":"557f5188eb75d80d00af40a5","ref":"","in":"body","required":true,"desc":"Positive amount for a charge, negative amount for a credit. Max 10000000.","default":"","type":"string","name":"unit_amount_in_cents"},{"_id":"557f5188eb75d80d00af40a7","ref":"","in":"path","required":true,"desc":"Your unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"557f5188eb75d80d00af40a3","ref":"","in":"body","required":false,"desc":"Quantity.","default":"1","type":"int","name":"quantity"},{"_id":"557f5188eb75d80d00af40a4","ref":"","in":"body","required":false,"desc":"Description of the adjustment for the invoice.","default":"","type":"string","name":"description"},{"_id":"557f5188eb75d80d00af40a2","ref":"","in":"body","required":false,"desc":"Accounting code. Max of 20 characters.","default":"","type":"string","name":"accounting_code"},{"_id":"578f782bdbb58b0e00bbdf86","ref":"","in":"body","required":false,"desc":"Optional field for setting a revenue schedule type. This will determine how revenue for the associated Charge should be recognized. Available schedule types are `never`, `at_range_start`, `at_invoice`, and—if `end_date` is set—`evenly` and `at_range_end`.","default":"","type":"string","name":"revenue_schedule_type"},{"_id":"557f5188eb75d80d00af40a1","ref":"","in":"body","required":false,"desc":"`true` exempts tax on the charge, `false` applies tax on the charge. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative adjustments). Credits are always post-tax. Pre-tax discounts should use the Coupons feature.","default":"","type":"boolean","name":"tax_exempt"},{"_id":"557f5188eb75d80d00af40a0","ref":"","in":"body","required":false,"desc":"Optional field for EU VAT merchants and Avalara AvaTax Pro merchants. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If you have your own AvaTax account configured, you can use Avalara tax codes to assign custom tax rules.","default":"","type":"string","name":"tax_code"},{"_id":"55e09fbfa44fae0d0021473e","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the charge began.","default":"now","type":"timestamp","name":"start_date"},{"_id":"55e09fbfa44fae0d0021473d","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the charge ended.","default":"","type":"timestamp","name":"end_date"},{"_id":"58a732d9e13fc22300154cf2","ref":"","in":"body","required":false,"desc":"The product code or SKU of the line item. Max of 50 characters. Useful for later reporting on product purchases.","default":"","type":"string","name":"product_code"}],"url":"/accounts/:account_code/adjustments"},"isReference":true,"order":2,"body":"","excerpt":"Creates a one-time charge on an account. Charges are not invoiced or collected immediately. Non-invoiced charges will automatically be invoices when the account's subscription renews, or you trigger a collection by posting an invoice. Charges may be removed from an account if they have not been invoiced.","slug":"create-a-charge","type":"post","title":"Create Charge","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Charge

Creates a one-time charge on an account. Charges are not invoiced or collected immediately. Non-invoiced charges will automatically be invoices when the account's subscription renews, or you trigger a collection by posting an invoice. Charges may be removed from an account if they have not been invoiced.

Path Params

account_code:
required
string
Your unique account identifier.

Body Params

currency:
required
string
Currency, 3-letter ISO code.
unit_amount_in_cents:
required
string
Positive amount for a charge, negative amount for a credit. Max 10000000.
quantity:
integer1
Quantity.
description:
string
Description of the adjustment for the invoice.
accounting_code:
string
Accounting code. Max of 20 characters.
revenue_schedule_type:
string
Optional field for setting a revenue schedule type. This will determine how revenue for the associated Charge should be recognized. Available schedule types are `never`, `at_range_start`, `at_invoice`, and—if `end_date` is set—`evenly` and `at_range_end`.
tax_exempt:
boolean
`true` exempts tax on the charge, `false` applies tax on the charge. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative adjustments). Credits are always post-tax. Pre-tax discounts should use the Coupons feature.
tax_code:
string
Optional field for EU VAT merchants and Avalara AvaTax Pro merchants. If you are using Recurly's EU VAT feature, you can use values of `unknown`, `physical`, or `digital`. If you have your own AvaTax account configured, you can use Avalara tax codes to assign custom tax rules.
start_date:
timestampnow
A timestamp associated with when the charge began.
end_date:
timestamp
A timestamp associated with when the charge ended.
product_code:
string
The product code or SKU of the line item. Max of 50 characters. Useful for later reporting on product purchases.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $charge = new Recurly_Adjustment();
  $charge->account_code = 'b6f5783';
  $charge->description = 'Charge for extra bandwidth';
  $charge->unit_amount_in_cents = 5000; // $50.00
  $charge->currency = 'USD';
  $charge->quantity = 1;
  $charge->accounting_code = 'bandwidth';
  $charge->tax_exempt = false;
  $charge->create();

  print "Charge: $charge";
} catch (Recurly_NotFoundError $e) {
  print "Account not found: $e";
}
account = Recurly::Account.find('1')
account.adjustments.create(
  :description          => 'Charge for extra bandwidth',
  :unit_amount_in_cents => 50_00,
  :currency             => 'USD',
  :quantity             => 1,
  :accounting_code      => 'bandwidth',
  :tax_exempt           => false
)
account = Account.get('1')
charge = Adjustment(
  description='Charge for extra bandwidth',
  unit_amount_in_cents=5000,
  currency='USD',
  quantity=1,
  accounting_code='bandwidth',
  tax_exempt=False
)
account.charge(charge)
var account = Accounts.Get("1");
var adjustment = account.NewAdjustment(
	"USD",                        // currency
	5000,                         // unit_amount_in_cents
	"Charge for extra bandwidth", // description
	1,                            // quantity
	"bandwidth",                  // accounting_code
	false);                       // tax_exempt
adjustment.Create();
<adjustment>
  <description>Charge for extra bandwidth</description>
  <unit_amount_in_cents>5000</unit_amount_in_cents>
  <currency>USD</currency>
  <quantity>1</quantity>
  <accounting_code>bandwidth</accounting_code>
  <tax_exempt>false</tax_exempt>
  <revenue_schedule_type>at_invoice</revenue_schedule_type>
</adjustment>

Result Format

<adjustment href="https://your-subdomain.recurly.com/v2/adjustments/37c0031340577f993ff30b41738f52ff" type="charge">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <uuid>37c0031340577f993ff30b41738f52ff</uuid>
  <state>pending</state>
  <description>Charge for extra bandwidth</description>
  <accounting_code>bandwidth</accounting_code>
  <product_code nil="nil"/>
  <origin>debit</origin>
  <unit_amount_in_cents type="integer">5000</unit_amount_in_cents>
  <quantity type="integer">1</quantity>
  <discount_in_cents type="integer">0</discount_in_cents>
  <tax_in_cents type="integer">0</tax_in_cents>
  <total_in_cents type="integer">5000</total_in_cents>
  <currency>USD</currency>
  <taxable type="boolean">false</taxable>
  <tax_exempt type="boolean">false</tax_exempt>
  <tax_code nil="nil"/>
  <start_date type="datetime">2016-08-03T16:23:48Z</start_date>
  <end_date nil="nil"/>
  <created_at type="datetime">2016-08-03T16:23:48Z</created_at>
  <updated_at type="datetime">2016-08-03T16:23:48Z</updated_at>
  <revenue_schedule_type>at_invoice</revenue_schedule_type>
</adjustment>


{"_id":"5a0f610a823e2900127fd28d","category":"5a0f6108823e2900127fd218","user":"55648cf93b87582b003ab8b1","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["563ce057913e650d00b65f47"],"next":{"pages":[],"description":""},"createdAt":"2015-08-07T19:15:36.088Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n\n$credit = new Recurly_Adjustment();\n$credit->account_code = '1';\n$credit->description = 'Bonus for being a great customer';\n$credit->unit_amount_in_cents = -2000; // Negative $20.00.\n$credit->currency = 'USD';\n$credit->quantity = 1;\n$credit->create();","name":""},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.adjustments.create(\n  :description          => 'Bonus for being a great customer',\n  :unit_amount_in_cents => -20_00,\n  :currency             => 'USD',\n  :quantity             => 1\n)"},{"language":"python","code":"account = Account.get('1')\ncredit = Adjustment(\n  description='Bonus for being a great customer',\n  unit_amount_in_cents=-2000,\n  currency='USD',\n  quantity=1\n)\naccount.charge(credit)"},{"language":"csharp","code":"var account = Accounts.Get(\"1\");\nvar adjustment = account.NewAdjustment(\n\t\"USD\",                               // currency\n\t-2000,                               // unit_amount_in_cents\n\t\"Bonus for being a great customer\", // description\n\t1);                                  // quantity (default is 1)\nadjustment.Create();"},{"language":"xml","code":"<adjustment>\n  <description>Bonus for being a great customer</description>\n  <unit_amount_in_cents>-2000</unit_amount_in_cents>\n  <currency>USD</currency>\n  <quantity>1</quantity>\n  <revenue_schedule_type>at_invoice</revenue_schedule_type>\n</adjustment>"}]},"method":"post","results":{"codes":[{"status":201,"language":"xml","code":"<adjustment href=\"https://your-subdomain.recurly.com/v2/adjustments/37c0038fe1ffc9405019db4a11a99aa8\" type=\"credit\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <uuid>37c0038fe1ffc9405019db4a11a99aa8</uuid>\n  <state>pending</state>\n  <description>Bonus for being a great customer</description>\n  <accounting_code nil=\"nil\"/>\n  <product_code nil=\"nil\"/>\n  <origin>credit</origin>\n  <unit_amount_in_cents type=\"integer\">-2000</unit_amount_in_cents>\n  <quantity type=\"integer\">1</quantity>\n  <discount_in_cents type=\"integer\">0</discount_in_cents>\n  <tax_in_cents type=\"integer\">0</tax_in_cents>\n  <total_in_cents type=\"integer\">-2000</total_in_cents>\n  <currency>USD</currency>\n  <taxable type=\"boolean\">false</taxable>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <tax_code nil=\"nil\"/>\n  <start_date type=\"datetime\">2016-08-03T16:24:20Z</start_date>\n  <end_date nil=\"nil\"/>\n  <created_at type=\"datetime\">2016-08-03T16:24:20Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:24:20Z</updated_at>\n  <revenue_schedule_type>at_invoice</revenue_schedule_type>\n</adjustment>","name":""}]},"settings":"","auth":"required","params":[{"_id":"557f5188eb75d80d00af40a6","ref":"","in":"body","required":true,"desc":"Currency, 3-letter ISO code.","default":"","type":"string","name":"currency"},{"_id":"557f5188eb75d80d00af40a7","ref":"","in":"path","required":true,"desc":"Your unique account identifier.","default":"","type":"string","name":"account_code"},{"_id":"557f5188eb75d80d00af40a5","ref":"","in":"body","required":true,"desc":"Positive amount for a charge, negative amount for a credit. Max 10000000.","default":"","type":"string","name":"unit_amount_in_cents"},{"_id":"557f5188eb75d80d00af40a3","ref":"","in":"body","required":false,"desc":"Quantity.","default":"1","type":"int","name":"quantity"},{"_id":"557f5188eb75d80d00af40a4","ref":"","in":"body","required":false,"desc":"Description of the adjustment for the invoice.","default":"","type":"string","name":"description"},{"_id":"557f5188eb75d80d00af40a2","ref":"","in":"body","required":false,"desc":"Accounting code. Max of 20 characters.","default":"","type":"string","name":"accounting_code"},{"_id":"578f7836dbb58b0e00bbdf87","ref":"","in":"body","required":false,"desc":"Optional field for setting a revenue schedule type. This will determine how revenue for the associated Credit should be recognized. Available schedule types are `never`, `at_range_start`, `at_invoice`, and—if `end_date` is set—`evenly` and `at_range_end`.","default":"","type":"string","name":"revenue_schedule_type"},{"_id":"55e0dcbda44fae0d0021491f","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the credit began.","default":"now","type":"timestamp","name":"start_date"},{"_id":"55e0dcbda44fae0d0021491e","ref":"","in":"body","required":false,"desc":"A timestamp associated with when the credit ended.","default":"","type":"timestamp","name":"end_date"},{"_id":"57b50abbdc26980e00d04c9c","ref":"","in":"body","required":false,"desc":"Only allowed if the Gift Cards feature is enabled on your site and `unit_amount_in_cents` is negative. Can only have a value of `external_gift_card`. Sets the origin of the credit to `external_gift_card` in order to track gift card credits from external gift cards, like InComm, and triggers the logic to not require billing information from gift credit redeemers.","default":"","type":"string","name":"origin"},{"_id":"58a732f1e29fd525004c9b85","ref":"","in":"body","required":false,"desc":"The product code or SKU of the line item. Max of 50 characters. Useful for later reporting on product purchases.","default":"","type":"string","name":"product_code"}],"url":"/accounts/:account_code/adjustments"},"isReference":true,"order":3,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"No Tax on Custom Credits\",\n  \"body\": \"Custom credit adjustments will not calculate tax. If the credit you want to create reflects a charge previously billed with tax, we recommend that you refund the invoice instead of making a credit.\"\n}\n[/block]","excerpt":"Creates a one-time charge on an account. Charges are not invoiced or collected immediately. Non-invoiced charges will automatically be invoices when the account's subscription renews, or you trigger a collection by posting an invoice. Charges may be removed from an account if they have not been invoiced.","slug":"create-a-credit","type":"post","title":"Create Credit","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Credit

Creates a one-time charge on an account. Charges are not invoiced or collected immediately. Non-invoiced charges will automatically be invoices when the account's subscription renews, or you trigger a collection by posting an invoice. Charges may be removed from an account if they have not been invoiced.

Path Params

account_code:
required
string
Your unique account identifier.

Body Params

currency:
required
string
Currency, 3-letter ISO code.
unit_amount_in_cents:
required
string
Positive amount for a charge, negative amount for a credit. Max 10000000.
quantity:
integer1
Quantity.
description:
string
Description of the adjustment for the invoice.
accounting_code:
string
Accounting code. Max of 20 characters.
revenue_schedule_type:
string
Optional field for setting a revenue schedule type. This will determine how revenue for the associated Credit should be recognized. Available schedule types are `never`, `at_range_start`, `at_invoice`, and—if `end_date` is set—`evenly` and `at_range_end`.
start_date:
timestampnow
A timestamp associated with when the credit began.
end_date:
timestamp
A timestamp associated with when the credit ended.
origin:
string
Only allowed if the Gift Cards feature is enabled on your site and `unit_amount_in_cents` is negative. Can only have a value of `external_gift_card`. Sets the origin of the credit to `external_gift_card` in order to track gift card credits from external gift cards, like InComm, and triggers the logic to not require billing information from gift credit redeemers.
product_code:
string
The product code or SKU of the line item. Max of 50 characters. Useful for later reporting on product purchases.

No Tax on Custom Credits

Custom credit adjustments will not calculate tax. If the credit you want to create reflects a charge previously billed with tax, we recommend that you refund the invoice instead of making a credit.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

$credit = new Recurly_Adjustment();
$credit->account_code = '1';
$credit->description = 'Bonus for being a great customer';
$credit->unit_amount_in_cents = -2000; // Negative $20.00.
$credit->currency = 'USD';
$credit->quantity = 1;
$credit->create();
account = Recurly::Account.find('1')
account.adjustments.create(
  :description          => 'Bonus for being a great customer',
  :unit_amount_in_cents => -20_00,
  :currency             => 'USD',
  :quantity             => 1
)
account = Account.get('1')
credit = Adjustment(
  description='Bonus for being a great customer',
  unit_amount_in_cents=-2000,
  currency='USD',
  quantity=1
)
account.charge(credit)
var account = Accounts.Get("1");
var adjustment = account.NewAdjustment(
	"USD",                               // currency
	-2000,                               // unit_amount_in_cents
	"Bonus for being a great customer", // description
	1);                                  // quantity (default is 1)
adjustment.Create();
<adjustment>
  <description>Bonus for being a great customer</description>
  <unit_amount_in_cents>-2000</unit_amount_in_cents>
  <currency>USD</currency>
  <quantity>1</quantity>
  <revenue_schedule_type>at_invoice</revenue_schedule_type>
</adjustment>

Result Format

<adjustment href="https://your-subdomain.recurly.com/v2/adjustments/37c0038fe1ffc9405019db4a11a99aa8" type="credit">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <uuid>37c0038fe1ffc9405019db4a11a99aa8</uuid>
  <state>pending</state>
  <description>Bonus for being a great customer</description>
  <accounting_code nil="nil"/>
  <product_code nil="nil"/>
  <origin>credit</origin>
  <unit_amount_in_cents type="integer">-2000</unit_amount_in_cents>
  <quantity type="integer">1</quantity>
  <discount_in_cents type="integer">0</discount_in_cents>
  <tax_in_cents type="integer">0</tax_in_cents>
  <total_in_cents type="integer">-2000</total_in_cents>
  <currency>USD</currency>
  <taxable type="boolean">false</taxable>
  <tax_exempt type="boolean">false</tax_exempt>
  <tax_code nil="nil"/>
  <start_date type="datetime">2016-08-03T16:24:20Z</start_date>
  <end_date nil="nil"/>
  <created_at type="datetime">2016-08-03T16:24:20Z</created_at>
  <updated_at type="datetime">2016-08-03T16:24:20Z</updated_at>
  <revenue_schedule_type>at_invoice</revenue_schedule_type>
</adjustment>


{"_id":"5a0f610a823e2900127fd28e","category":"5a0f6108823e2900127fd218","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["55b79c68aea7c8190058b98e"],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T22:24:48.657Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $adjustment = Recurly_Adjustment::get('2fded6a3e36e8b56b37007432f8c1b0d');\n  print \"Adjustment: $adjustment\";\n} catch (Recurly_NotFoundError $e) {\n  print \"Invalid adjustment uuid: $e\";\n}","language":"php"},{"code":"adjustment = Recurly::Adjustment.find('30498bb2d52bb9037b4d62480eb98b8f')\n","language":"ruby"},{"code":"adjustment = Adjustment.get('30498bb2d52bb9037b4d62480eb98b8f')\n","language":"python"},{"code":"var adjustment = Adjustments.Get(\"30498bb2d52bb9037b4d62480eb98b8f\");\nConsole.WriteLine(\"Adjustment: \" + adjustment);","language":"csharp"}]},"method":"get","results":{"codes":[{"name":"","code":"<adjustment href=\"https://your-subdomain.recurly.com/v2/adjustments/37c0057d2bc64f2dd6a1c944dc87fbb5\" type=\"charge\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <invoice href=\"https://your-subdomain.recurly.com/v2/invoices/1007\"/>\n  <subscription href=\"https://your-subdomain.recurly.com/v2/subscriptions/37c0057cb105f67b6b8a1146f7b59c41\"/>\n  <uuid>37c0057d2bc64f2dd6a1c944dc87fbb5</uuid>\n  <state>invoiced</state>\n  <description>Gold plan</description>\n  <accounting_code nil=\"nil\"/>\n  <product_code>gold</product_code>\n  <origin>plan</origin>\n  <unit_amount_in_cents type=\"integer\">4500</unit_amount_in_cents>\n  <quantity type=\"integer\">1</quantity>\n  <discount_in_cents type=\"integer\">450</discount_in_cents>\n  <tax_in_cents type=\"integer\">354</tax_in_cents>\n  <total_in_cents type=\"integer\">4404</total_in_cents>\n  <currency>EUR</currency>\n  <taxable type=\"boolean\">false</taxable>\n  <tax_type>usst</tax_type>\n  <tax_region>CA</tax_region>\n  <tax_rate type=\"float\">0.0875</tax_rate>\n  <tax_exempt type=\"boolean\">false</tax_exempt>\n  <tax_code nil=\"nil\"/>\n  <tax_details type=\"array\">\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>state</type>\n      <tax_rate type=\"float\">0.065</tax_rate>\n      <tax_in_cents type=\"integer\">263</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>county</type>\n      <tax_rate type=\"float\">0.01</tax_rate>\n      <tax_in_cents type=\"integer\">41</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>city</type>\n      <tax_rate type=\"float\">0.0</tax_rate>\n      <tax_in_cents type=\"integer\">0</tax_in_cents>\n    </tax_detail>\n    <tax_detail>\n      <name nil=\"nil\"/>\n      <type>special</type>\n      <tax_rate type=\"float\">0.0125</tax_rate>\n      <tax_in_cents type=\"integer\">51</tax_in_cents>\n    </tax_detail>\n  </tax_details>\n  <start_date type=\"datetime\">2016-08-03T16:26:26Z</start_date>\n  <end_date type=\"datetime\">2016-09-03T16:26:26Z</end_date>\n  <created_at type=\"datetime\">2016-08-03T16:26:26Z</created_at>\n  <updated_at type=\"datetime\">2016-08-03T16:26:26Z</updated_at>\n  <revenue_schedule_type>evenly</revenue_schedule_type>\n</adjustment>","language":"xml","status":200}]},"settings":"","auth":"required","params":[{"_id":"55944f4fccc3052300569883","ref":"","in":"path","required":true,"desc":"The unique identifier for the adjustment","default":"","type":"string","name":"uuid"}],"url":"/adjustments/:uuid"},"isReference":true,"order":4,"body":"","excerpt":"Returns information about a single adjustment.","slug":"get-an-adjustment","type":"get","title":"Lookup Adjustment","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Adjustment

Returns information about a single adjustment.

Path Params

uuid:
required
string
The unique identifier for the adjustment

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $adjustment = Recurly_Adjustment::get('2fded6a3e36e8b56b37007432f8c1b0d');
  print "Adjustment: $adjustment";
} catch (Recurly_NotFoundError $e) {
  print "Invalid adjustment uuid: $e";
}
adjustment = Recurly::Adjustment.find('30498bb2d52bb9037b4d62480eb98b8f')
adjustment = Adjustment.get('30498bb2d52bb9037b4d62480eb98b8f')
var adjustment = Adjustments.Get("30498bb2d52bb9037b4d62480eb98b8f");
Console.WriteLine("Adjustment: " + adjustment);

Result Format

<adjustment href="https://your-subdomain.recurly.com/v2/adjustments/37c0057d2bc64f2dd6a1c944dc87fbb5" type="charge">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <invoice href="https://your-subdomain.recurly.com/v2/invoices/1007"/>
  <subscription href="https://your-subdomain.recurly.com/v2/subscriptions/37c0057cb105f67b6b8a1146f7b59c41"/>
  <uuid>37c0057d2bc64f2dd6a1c944dc87fbb5</uuid>
  <state>invoiced</state>
  <description>Gold plan</description>
  <accounting_code nil="nil"/>
  <product_code>gold</product_code>
  <origin>plan</origin>
  <unit_amount_in_cents type="integer">4500</unit_amount_in_cents>
  <quantity type="integer">1</quantity>
  <discount_in_cents type="integer">450</discount_in_cents>
  <tax_in_cents type="integer">354</tax_in_cents>
  <total_in_cents type="integer">4404</total_in_cents>
  <currency>EUR</currency>
  <taxable type="boolean">false</taxable>
  <tax_type>usst</tax_type>
  <tax_region>CA</tax_region>
  <tax_rate type="float">0.0875</tax_rate>
  <tax_exempt type="boolean">false</tax_exempt>
  <tax_code nil="nil"/>
  <tax_details type="array">
    <tax_detail>
      <name nil="nil"/>
      <type>state</type>
      <tax_rate type="float">0.065</tax_rate>
      <tax_in_cents type="integer">263</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>county</type>
      <tax_rate type="float">0.01</tax_rate>
      <tax_in_cents type="integer">41</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>city</type>
      <tax_rate type="float">0.0</tax_rate>
      <tax_in_cents type="integer">0</tax_in_cents>
    </tax_detail>
    <tax_detail>
      <name nil="nil"/>
      <type>special</type>
      <tax_rate type="float">0.0125</tax_rate>
      <tax_in_cents type="integer">51</tax_in_cents>
    </tax_detail>
  </tax_details>
  <start_date type="datetime">2016-08-03T16:26:26Z</start_date>
  <end_date type="datetime">2016-09-03T16:26:26Z</end_date>
  <created_at type="datetime">2016-08-03T16:26:26Z</created_at>
  <updated_at type="datetime">2016-08-03T16:26:26Z</updated_at>
  <revenue_schedule_type>evenly</revenue_schedule_type>
</adjustment>


{"_id":"5a0f610a823e2900127fd28f","category":"5a0f6108823e2900127fd218","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-15T23:21:38.993Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"code":"Status: 204 No Content","language":"xml","status":204}]},"settings":"","examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $adjustment = Recurly_Adjustment::get('626db120a84102b1809909071c701c60');\n  $adjustment->delete();\n\n  print \"Adjustment: $adjustment\";\n} catch (Recurly_NotFoundError $e) {\n  // NotFoundError if invalid uuid or already deleted\n  print \"Invalid adjustment uuid: $e\";\n}\n","language":"php"},{"language":"ruby","code":"adjustment = Recurly::Adjustment.find('945a4cb9afd64300b97b138407a51aef')\nadjustment.destroy"},{"code":"adjustment = Adjustment.get('945a4cb9afd64300b97b138407a51aef')\nadjustment.delete()","language":"python"},{"code":"var adjustment = Adjustments.Get(\"945a4cb9afd64300b97b138407a51aef\");\nadjustment.Delete(","language":"csharp"}]},"method":"delete","auth":"required","params":[{"_id":"55944f6a0c33bd0d0005964a","ref":"","in":"path","required":true,"desc":"The unique identifier for the adjustment","default":"","type":"string","name":"uuid"}],"url":"/adjustments/:uuid"},"isReference":true,"order":5,"body":"[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Please note\",\n  \"body\": \"An adjustment may only be deleted if it has not been invoiced.\"\n}\n[/block]","excerpt":"Delete an adjustment from an account. Only non-invoiced adjustments can be deleted.","slug":"delete-an-adjustment","type":"delete","title":"Delete Adjustment","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

deleteDelete Adjustment

Delete an adjustment from an account. Only non-invoiced adjustments can be deleted.

Path Params

uuid:
required
string
The unique identifier for the adjustment

Please note

An adjustment may only be deleted if it has not been invoiced.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $adjustment = Recurly_Adjustment::get('626db120a84102b1809909071c701c60');
  $adjustment->delete();

  print "Adjustment: $adjustment";
} catch (Recurly_NotFoundError $e) {
  // NotFoundError if invalid uuid or already deleted
  print "Invalid adjustment uuid: $e";
}
adjustment = Recurly::Adjustment.find('945a4cb9afd64300b97b138407a51aef')
adjustment.destroy
adjustment = Adjustment.get('945a4cb9afd64300b97b138407a51aef')
adjustment.delete()
var adjustment = Adjustments.Get("945a4cb9afd64300b97b138407a51aef");
adjustment.Delete(

Result Format

Status: 204 No Content


{"_id":"5a0f610a823e2900127fd274","category":"5a0f6108823e2900127fd219","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["56799b95239fac0d00c7e019"],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T19:47:32.787Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->token_id = '7z6furn4jvb9'; // From Recurly.js\n  $billing_info->create();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account or token is invalid or expired\n  print \"Not Found: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  token_id: 'TOKEN_ID'\n}\naccount.billing_info.save!"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.token_id = 'TOKEN_ID'\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.TokenId = \"TOKEN_ID\";\ninfo.Create();","language":"csharp"},{"language":"xml","code":"<billing_info>\n  <token_id>TOKEN_ID</token_id>\n</billing_info>"}]},"method":"post","results":{"codes":[{"language":"xml","status":201,"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"></phone>\n  <vat_number>US1234567890</vat_number>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country>US</ip_address_country>\n  <card_type>Visa</card_type>\n  <year type=\"integer\">2019</year>\n  <month type=\"integer\">11</month>\n  <first_six>411111</first_six>\n  <last_four>1111</last_four>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>"},{"status":404,"language":"xml","code":"<error>\n  <symbol>token_invalid</symbol>\n  <description>Token is either invalid or expired</description>\n</error>"}]},"settings":"","auth":"required","params":[{"_id":"55944f99ccc3052300569885","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581ced4a5474a0d00d946a5","ref":"","in":"body","required":true,"desc":"A token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token)","default":"","type":"string","name":"token_id"},{"_id":"56d0e86f40d36e1d00bc14c9","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":0,"body":"","excerpt":"Creates an account's Billing Information using a [token generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token). Returns the account's created Billing Information.","slug":"create-an-accounts-billing-info-token","type":"post","title":"Create Account's Billing Info (Token)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account's Billing Info (Token)

Creates an account's Billing Information using a [token generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token). Returns the account's created Billing Information.

Path Params

account_code:
required
string
Account's unique code.

Body Params

token_id:
required
string
A token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token)
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->token_id = '7z6furn4jvb9'; // From Recurly.js
  $billing_info->create();

  print "Billing Info: $billing_info";
} catch (Recurly_NotFoundError $e) {
  // Could not find account or token is invalid or expired
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  token_id: 'TOKEN_ID'
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.token_id = 'TOKEN_ID'
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.TokenId = "TOKEN_ID";
info.Create();
<billing_info>
  <token_id>TOKEN_ID</token_id>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"></phone>
  <vat_number>US1234567890</vat_number>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country>US</ip_address_country>
  <card_type>Visa</card_type>
  <year type="integer">2019</year>
  <month type="integer">11</month>
  <first_six>411111</first_six>
  <last_four>1111</last_four>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<error>
  <symbol>token_invalid</symbol>
  <description>Token is either invalid or expired</description>
</error>


{"_id":"5a0f610a823e2900127fd275","category":"5a0f6108823e2900127fd219","parentDoc":null,"user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":["55d336260168850d0073f054","562944f61a92870d0002c301","56bb59bae59a312b00a15bac","57ed6ed3c4f64e17004e535d"],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T19:55:06.712Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->first_name = 'Verena';\n  $billing_info->last_name = 'Example';\n  $billing_info->number = '4111-1111-1111-1111';\n  $billing_info->verification_value = '123';\n  $billing_info->month = 11;\n  $billing_info->year = 2017;\n  $billing_info->create();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The data or card are invalid\n  print \"Invalid data or card: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Not Found: $e\";\n}","language":"php","name":""},{"code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  :first_name         => 'Verena',\n  :last_name          => 'Example',\n  :number             => '4111-1111-1111-1111',\n  :verification_value => '123',\n  :month              => 11,\n  :year               => 2015\n}\naccount.billing_info.save!","language":"ruby"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.first_name = 'Verena'\nbilling_info.last_name = 'Example'\nbilling_info.number = '4111-1111-1111-1111'\nbilling_info.verification_value = '123'\nbilling_info.month = 11\nbilling_info.year = 2015\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.FirstName = \"Verana\";\ninfo.LastName = \"Example\";\ninfo.CreditCardNumber = \"4111-1111-1111-1111\";\ninfo.VerificationValue = \"123\";\ninfo.ExpirationMonth = 11;\ninfo.ExpirationYear = 2015;\ninfo.Create();","language":"csharp"},{"code":"<billing_info>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <number>4111-1111-1111-1111</number>\n  <verification_value>123</verification_value>\n  <month>11</month>\n  <year>2019</year>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>","language":"xml"}]},"method":"post","results":{"codes":[{"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"/>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"/>\n  <vat_number nil=\"nil\"/>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country nil=\"nil\"/>\n  <card_type>Visa</card_type>\n  <year type=\"integer\">2019</year>\n  <month type=\"integer\">11</month>\n  <first_six>411111</first_six>\n  <last_four>1111</last_four>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","language":"xml","status":201},{"status":422,"language":"xml","code":"<errors>\n  <transaction_error>\n    <error_code>declined</error_code>\n    <error_category>soft</error_category>\n    <merchant_message>The customer's bank has declined their card. The customer will need to contact their bank to learn the cause.</merchant_message>\n    <customer_message>Your transaction was declined. Please use a different card or contact your bank.</customer_message>\n    <gateway_error_code nil=\"nil\"/>\n  </transaction_error>\n  <error field=\"billing_info.base\" symbol=\"declined\">Your transaction was declined. Please use a different card or contact your bank.</error>\n  <transaction href=\"https://your-subdomain.recurly.com/v2/transactions/3c4293ccd7f7bce494f85e4d48beb22e\" type=\"credit_card\">\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n    <uuid>3c4293ccd7f7bce494f85e4d48beb22e</uuid>\n    <action>verify</action>\n    <amount_in_cents type=\"integer\">0</amount_in_cents>\n    <tax_in_cents type=\"integer\">0</tax_in_cents>\n    <currency>USD</currency>\n    <status>declined</status>\n    <payment_method>credit_card</payment_method>\n    <reference>676848</reference>\n    <source>billing_info</source>\n    <recurring type=\"boolean\">false</recurring>\n    <test type=\"boolean\">true</test>\n    <voidable type=\"boolean\">false</voidable>\n    <refundable type=\"boolean\">false</refundable>\n    <ip_address>127.0.0.1</ip_address>\n    <transaction_error>\n      <error_code>declined</error_code>\n      <error_category>soft</error_category>\n      <merchant_message>The customer's bank has declined their card. The customer will need to contact their bank to learn the cause.</merchant_message>\n      <customer_message>Your transaction was declined. Please use a different card or contact your bank.</customer_message>\n      <gateway_error_code nil=\"nil\"/>\n    </transaction_error>\n    <cvv_result code=\"\" nil=\"nil\"/>\n    <avs_result code=\"\" nil=\"nil\"/>\n    <avs_result_street nil=\"nil\"/>\n    <avs_result_postal nil=\"nil\"/>\n    <created_at type=\"datetime\">2017-03-15T21:03:40Z</created_at>\n    <updated_at type=\"datetime\">2017-03-15T21:03:40Z</updated_at>\n    <details>\n      <account>\n        <account_code>1</account_code>\n        <first_name>Verena</first_name>\n        <last_name>Example</last_name>\n        <company>New Company Name</company>\n        <email>[email protected]</email>\n        <billing_info type=\"credit_card\">\n          <first_name>Verena</first_name>\n          <last_name>Example</last_name>\n          <address1>123 Main St.</address1>\n          <address2 nil=\"nil\"/>\n          <city>San Francisco</city>\n          <state>CA</state>\n          <zip>94105</zip>\n          <country>US</country>\n          <phone nil=\"nil\"/>\n          <vat_number nil=\"nil\"/>\n          <card_type>Visa</card_type>\n          <year type=\"integer\">2019</year>\n          <month type=\"integer\">11</month>\n          <first_six>400000</first_six>\n          <last_four>0002</last_four>\n        </billing_info>\n      </account>\n    </details>\n  </transaction>\n</errors>"}]},"settings":"","auth":"required","params":[{"_id":"55944fab5c9eaa2300a8633c","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d09a8625220d00429e4d","ref":"","in":"body","required":true,"desc":"First name","default":"","type":"string","name":"first_name"},{"_id":"5581d09a8625220d00429e4c","ref":"","in":"body","required":true,"desc":"Last name","default":"","type":"string","name":"last_name"},{"_id":"5581d09a8625220d00429e42","ref":"","in":"body","required":true,"desc":"Credit card number, spaces and dashes are accepted","default":"","type":"string","name":"number"},{"_id":"5581d09a8625220d00429e41","ref":"","in":"body","required":true,"desc":"Expiration month","default":"","type":"string","name":"month"},{"_id":"5581d09a8625220d00429e40","ref":"","in":"body","required":true,"desc":"Expiration year","default":"","type":"string","name":"year"},{"_id":"5581d09a8625220d00429e4b","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation","default":"","type":"string","name":"address1"},{"_id":"5581d09a8625220d00429e4a","ref":"","in":"body","required":false,"desc":"Address line 2.","default":"","type":"string","name":"address2"},{"_id":"5581d09a8625220d00429e49","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5581d09a8625220d00429e48","ref":"","in":"body","required":false,"desc":"State","default":"","type":"string","name":"state"},{"_id":"5581d09a8625220d00429e47","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581d09a8625220d00429e46","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation","default":"","type":"string","name":"zip"},{"_id":"5581d09a8625220d00429e45","ref":"","in":"body","required":false,"desc":"Phone number","default":"","type":"string","name":"phone"},{"_id":"5581d09a8625220d00429e44","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"56c3c1ce70187b17005f4395","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"},{"_id":"5581d09a8625220d00429e3f","ref":"","in":"body","required":false,"desc":"Security code or CVV, 3-4 digits **STRONGLY RECOMMENDED**","default":"","type":"string","name":"verification_value"},{"_id":"5581d09a8625220d00429e43","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":1,"body":"Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.\n\nWhen Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include Billing Information with your request.\n\nThe required address fields will correspond to the **address requirements** configured for your site.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's credit card details.\",\n  \"title\": \"Please note\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.\",\n  \"title\": \"Please note\"\n}\n[/block]","excerpt":"Creates the account's Billing Information.","slug":"create-an-accounts-billing-info-credit-card","type":"post","title":"Create Account's Billing Info (Credit Card)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account's Billing Info (Credit Card)

Creates the account's Billing Information.

Path Params

account_code:
required
string
Account's unique code.

Body Params

first_name:
required
string
First name
last_name:
required
string
Last name
number:
required
string
Credit card number, spaces and dashes are accepted
month:
required
string
Expiration month
year:
required
string
Expiration year
address1:
string
Address line 1, recommended for address validation
address2:
string
Address line 2.
city:
string
City
state:
string
State
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation
phone:
string
Phone number
vat_number:
string
Customer's VAT Number
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.
verification_value:
string
Security code or CVV, 3-4 digits **STRONGLY RECOMMENDED**
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**

Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.

When Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

The required address fields will correspond to the address requirements configured for your site.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's credit card details.

Please note

This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->first_name = 'Verena';
  $billing_info->last_name = 'Example';
  $billing_info->number = '4111-1111-1111-1111';
  $billing_info->verification_value = '123';
  $billing_info->month = 11;
  $billing_info->year = 2017;
  $billing_info->create();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The data or card are invalid
  print "Invalid data or card: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  :first_name         => 'Verena',
  :last_name          => 'Example',
  :number             => '4111-1111-1111-1111',
  :verification_value => '123',
  :month              => 11,
  :year               => 2015
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.first_name = 'Verena'
billing_info.last_name = 'Example'
billing_info.number = '4111-1111-1111-1111'
billing_info.verification_value = '123'
billing_info.month = 11
billing_info.year = 2015
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.FirstName = "Verana";
info.LastName = "Example";
info.CreditCardNumber = "4111-1111-1111-1111";
info.VerificationValue = "123";
info.ExpirationMonth = 11;
info.ExpirationYear = 2015;
info.Create();
<billing_info>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <number>4111-1111-1111-1111</number>
  <verification_value>123</verification_value>
  <month>11</month>
  <year>2019</year>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"/>
  <address1>123 Main St.</address1>
  <address2 nil="nil"/>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"/>
  <vat_number nil="nil"/>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country nil="nil"/>
  <card_type>Visa</card_type>
  <year type="integer">2019</year>
  <month type="integer">11</month>
  <first_six>411111</first_six>
  <last_four>1111</last_four>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<errors>
  <transaction_error>
    <error_code>declined</error_code>
    <error_category>soft</error_category>
    <merchant_message>The customer's bank has declined their card. The customer will need to contact their bank to learn the cause.</merchant_message>
    <customer_message>Your transaction was declined. Please use a different card or contact your bank.</customer_message>
    <gateway_error_code nil="nil"/>
  </transaction_error>
  <error field="billing_info.base" symbol="declined">Your transaction was declined. Please use a different card or contact your bank.</error>
  <transaction href="https://your-subdomain.recurly.com/v2/transactions/3c4293ccd7f7bce494f85e4d48beb22e" type="credit_card">
    <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
    <uuid>3c4293ccd7f7bce494f85e4d48beb22e</uuid>
    <action>verify</action>
    <amount_in_cents type="integer">0</amount_in_cents>
    <tax_in_cents type="integer">0</tax_in_cents>
    <currency>USD</currency>
    <status>declined</status>
    <payment_method>credit_card</payment_method>
    <reference>676848</reference>
    <source>billing_info</source>
    <recurring type="boolean">false</recurring>
    <test type="boolean">true</test>
    <voidable type="boolean">false</voidable>
    <refundable type="boolean">false</refundable>
    <ip_address>127.0.0.1</ip_address>
    <transaction_error>
      <error_code>declined</error_code>
      <error_category>soft</error_category>
      <merchant_message>The customer's bank has declined their card. The customer will need to contact their bank to learn the cause.</merchant_message>
      <customer_message>Your transaction was declined. Please use a different card or contact your bank.</customer_message>
      <gateway_error_code nil="nil"/>
    </transaction_error>
    <cvv_result code="" nil="nil"/>
    <avs_result code="" nil="nil"/>
    <avs_result_street nil="nil"/>
    <avs_result_postal nil="nil"/>
    <created_at type="datetime">2017-03-15T21:03:40Z</created_at>
    <updated_at type="datetime">2017-03-15T21:03:40Z</updated_at>
    <details>
      <account>
        <account_code>1</account_code>
        <first_name>Verena</first_name>
        <last_name>Example</last_name>
        <company>New Company Name</company>
        <email>[email protected]</email>
        <billing_info type="credit_card">
          <first_name>Verena</first_name>
          <last_name>Example</last_name>
          <address1>123 Main St.</address1>
          <address2 nil="nil"/>
          <city>San Francisco</city>
          <state>CA</state>
          <zip>94105</zip>
          <country>US</country>
          <phone nil="nil"/>
          <vat_number nil="nil"/>
          <card_type>Visa</card_type>
          <year type="integer">2019</year>
          <month type="integer">11</month>
          <first_six>400000</first_six>
          <last_four>0002</last_four>
        </billing_info>
      </account>
    </details>
  </transaction>
</errors>


{"_id":"5a0f610a823e2900127fd276","category":"5a0f6108823e2900127fd219","user":"55648cf93b87582b003ab8b1","project":"555fbba928249c1900618a82","parentDoc":null,"version":"5a0f6108823e2900127fd210","updates":["56ec2580df213e1700f77836"],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T20:00:48.689Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->name_on_account = 'Acme Inc.';\n  $billing_info->routing_number = '065400137';\n  $billing_info->account_number = '4444000000005555';\n  $billing_info->account_type = 'checking';\n  $billing_info->address1 = '123 Main St.';\n  $billing_info->city = 'San Francisco';\n  $billing_info->state ='CA';\n  $billing_info->country = 'US';\n  $billing_info->zip = '94105';\n  $billing_info->create();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The data or bank account are invalid\n  print \"Invalid data or card: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Account Not Found: $e\";\n}","name":""},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  name_on_account: 'Acme, Inc.',\n  routing_number: '065400137',\n  account_number: '4444000000005555',\n  address1: '123 Main St.',\n  city: 'San Francisco',\n  state: 'CA',\n  country: 'US',\n  zip: '94105'\n}\naccount.billing_info.save!"},{"language":"python","code":"account = Account.get('1')\nbilling_info = recurly.BillingInfo(\n  name_on_account = 'Acme, Inc.',\n  routing_number = '065400137',\n  account_number = '4444000000005555',\n  account_type = 'checking',\n  address1 = '123 Main St.',\n  city = 'San Francisco',\n  state ='CA',\n  country = 'US',\n  zip = '94105'\n  )\naccount.update_billing_info(billing_info)"},{"language":"csharp","code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.NameOnAccount = \"Acme, Inc.\";\ninfo.RoutingNumber = \"065400137\";\ninfo.AccountNumber = \"4444000000005555\";\ninfo.AccountType = BillingInfo.BankAccountType.Checking;\ninfo.Address1 = \"123 Main St.\";\ninfo.City = \"San Francisco\";\ninfo.State = \"CA\";\ninfo.Country = \"US\";\ninfo.PostalCode = \"94105\";\ninfo.Create();"},{"language":"xml","code":"<billing_info>\n  <name_on_account>Acme, Inc.</name_on_account>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <routing_number>065400137</routing_number>\n  <account_number>4444000000005555</account_number>\n  <account_type>checking</account_type>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>"}]},"method":"post","results":{"codes":[{"code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"bank_account\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <name_on_account>Acme, Inc.</name_on_account>\n  <first_name nil=\"nil\"></first_name>\n  <last_name nil=\"nil\"></last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone></phone>\n  <vat_number></vat_number>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country>US</ip_address_country>\n  <account_type>checking</account_type>\n  <last_four>5555</last_four>\n  <routing_number>065400137</routing_number>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","name":"","status":201,"language":"xml"},{"status":422,"language":"xml","code":"<errors>\n  <error field=\"billing_info.routing_number\" symbol=\"invalid\">is invalid</error>\n</errors>"}]},"settings":"","auth":"required","params":[{"_id":"55944fbb0c33bd0d0005964b","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d1f08625220d00429e6d","ref":"","in":"body","required":true,"desc":"The name associated with the account. This may be a person's full name or a business name. This field must be 1 to 50 characters and can include: letters digits space . ' & , -","default":"","type":"string","name":"name_on_account"},{"_id":"5581d1f08625220d00429e63","ref":"","in":"body","required":true,"desc":"Must be a real U.S. bank account routing number. All routing numbers are 9 digits.","default":"","type":"int","name":"routing_number"},{"_id":"5581d1f08625220d00429e62","ref":"","in":"body","required":true,"desc":"Bank account number between 4 and 17 digits. We do not validate this number until the first transaction, so we recommend you have the customer confirm their account number.","default":"","type":"int","name":"account_number"},{"_id":"5581d1f08625220d00429e61","ref":"","in":"body","required":true,"desc":"Either 'checking' or 'savings'","default":"","type":"string","name":"account_type"},{"_id":"5581d1f08625220d00429e6c","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation. This field has a 50 character max and can include: letters digits space . # / , -","default":"","type":"string","name":"address1"},{"_id":"5581d1f08625220d00429e6b","ref":"","in":"body","required":false,"desc":"Address line 2, this field has a 50 character max and can include: letters digits space . # / , -","default":"","type":"string","name":"address2"},{"_id":"5581d1f08625220d00429e6a","ref":"","in":"body","required":false,"desc":"City, this field has a 50 character max and can include: letters digits space . , -","default":"","type":"string","name":"city"},{"_id":"5581d1f08625220d00429e69","ref":"","in":"body","required":false,"desc":"State, this field has a 2 character max and can be lowercase or uppercase.","default":"","type":"string","name":"state"},{"_id":"5581d1f08625220d00429e68","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements). **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581d1f08625220d00429e67","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation. This field can be just 5 digits or can have an optional additional 4 digits separated by a hyphen (e.g. 12345-6789).","default":"","type":"string","name":"zip"},{"_id":"5581d1f08625220d00429e66","ref":"","in":"body","required":false,"desc":"Phone number, this field can be 10 digits.","default":"","type":"string","name":"phone"},{"_id":"5581d1f08625220d00429e65","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"5581d1f08625220d00429e64","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":2,"body":"Instead of using a token generated by Recurly.js, you can instead submit full bank account and address information when creating Billing Information.\n\nWhen Billing Information is submitted, it is only saved if the required fields are provided and they meet the field validation requirements. If the account has a past due invoice, the outstanding balance will be collected when the Billing Information is updated.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include Billing Information with your request.\n\nThe required address fields will correspond to the **address requirements** configured for your site.\nIf you need to set a back dated subscription authorziation date for the NACHA three year re-authorization rule, do so on the Create Subscription call using the \"bank_account_authorized_at\" attribute.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Please note\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's bank account details.\"\n}\n[/block]","excerpt":"Creates the account's Billing Information with Bank Account details. You will need to have the ACH feature on your site for this call to work.","slug":"create-an-accounts-billing-info-bank-account","type":"post","title":"Create Account's Billing Info (Bank Account)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account's Billing Info (Bank Account)

Creates the account's Billing Information with Bank Account details. You will need to have the ACH feature on your site for this call to work.

Path Params

account_code:
required
string
Account's unique code.

Body Params

name_on_account:
required
string
The name associated with the account. This may be a person's full name or a business name. This field must be 1 to 50 characters and can include: letters digits space . ' & , -
routing_number:
required
integer
Must be a real U.S. bank account routing number. All routing numbers are 9 digits.
account_number:
required
integer
Bank account number between 4 and 17 digits. We do not validate this number until the first transaction, so we recommend you have the customer confirm their account number.
account_type:
required
string
Either 'checking' or 'savings'
address1:
string
Address line 1, recommended for address validation. This field has a 50 character max and can include: letters digits space . # / , -
address2:
string
Address line 2, this field has a 50 character max and can include: letters digits space . # / , -
city:
string
City, this field has a 50 character max and can include: letters digits space . , -
state:
string
State, this field has a 2 character max and can be lowercase or uppercase.
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements). **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation. This field can be just 5 digits or can have an optional additional 4 digits separated by a hyphen (e.g. 12345-6789).
phone:
string
Phone number, this field can be 10 digits.
vat_number:
string
Customer's VAT Number
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**

Instead of using a token generated by Recurly.js, you can instead submit full bank account and address information when creating Billing Information.

When Billing Information is submitted, it is only saved if the required fields are provided and they meet the field validation requirements. If the account has a past due invoice, the outstanding balance will be collected when the Billing Information is updated.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

The required address fields will correspond to the address requirements configured for your site.
If you need to set a back dated subscription authorziation date for the NACHA three year re-authorization rule, do so on the Create Subscription call using the "bank_account_authorized_at" attribute.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's bank account details.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->name_on_account = 'Acme Inc.';
  $billing_info->routing_number = '065400137';
  $billing_info->account_number = '4444000000005555';
  $billing_info->account_type = 'checking';
  $billing_info->address1 = '123 Main St.';
  $billing_info->city = 'San Francisco';
  $billing_info->state ='CA';
  $billing_info->country = 'US';
  $billing_info->zip = '94105';
  $billing_info->create();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The data or bank account are invalid
  print "Invalid data or card: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Account Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  name_on_account: 'Acme, Inc.',
  routing_number: '065400137',
  account_number: '4444000000005555',
  address1: '123 Main St.',
  city: 'San Francisco',
  state: 'CA',
  country: 'US',
  zip: '94105'
}
account.billing_info.save!
account = Account.get('1')
billing_info = recurly.BillingInfo(
  name_on_account = 'Acme, Inc.',
  routing_number = '065400137',
  account_number = '4444000000005555',
  account_type = 'checking',
  address1 = '123 Main St.',
  city = 'San Francisco',
  state ='CA',
  country = 'US',
  zip = '94105'
  )
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.NameOnAccount = "Acme, Inc.";
info.RoutingNumber = "065400137";
info.AccountNumber = "4444000000005555";
info.AccountType = BillingInfo.BankAccountType.Checking;
info.Address1 = "123 Main St.";
info.City = "San Francisco";
info.State = "CA";
info.Country = "US";
info.PostalCode = "94105";
info.Create();
<billing_info>
  <name_on_account>Acme, Inc.</name_on_account>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <routing_number>065400137</routing_number>
  <account_number>4444000000005555</account_number>
  <account_type>checking</account_type>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="bank_account">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <name_on_account>Acme, Inc.</name_on_account>
  <first_name nil="nil"></first_name>
  <last_name nil="nil"></last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone></phone>
  <vat_number></vat_number>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country>US</ip_address_country>
  <account_type>checking</account_type>
  <last_four>5555</last_four>
  <routing_number>065400137</routing_number>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<errors>
  <error field="billing_info.routing_number" symbol="invalid">is invalid</error>
</errors>


{"_id":"5a0f610a823e2900127fd277","category":"5a0f6108823e2900127fd219","user":"56c3c01334df460d00c2beb3","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-29T21:58:10.697Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->first_name = 'Verena';\n  $billing_info->last_name = 'Example';\n  $billing_info->paypal_billing_agreement_id = 'BA-0HS87238YB688345C';\n  $billing_info->create();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The paypal billing agreement provided is invalid\n  print \"Invalid paypal billing agreement: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Not Found: $e\";\n}","language":"php"},{"code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  :first_name         => 'Verena',\n  :last_name          => 'Example',\n  :paypal_billing_agreement_id             => 'BA-0HS87238YB688345C'\n}\naccount.billing_info.save!","language":"ruby"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.first_name = 'Verena'\nbilling_info.last_name = 'Example'\nbilling_info.paypal_billing_agreement_id = 'BA-0HS87238YB688345C'\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.FirstName = \"Verana\";\ninfo.LastName = \"Example\";\ninfo.PaypalBillingAgreementId = \"BA-0HS87238YB688345C\";\ninfo.Create();","language":"csharp"},{"code":"<billing_info>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>","language":"xml"}]},"method":"post","results":{"codes":[{"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"></phone>\n  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","language":"xml","status":201}]},"settings":"","auth":"required","params":[{"_id":"55944fab5c9eaa2300a8633c","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d09a8625220d00429e4d","ref":"","in":"body","required":true,"desc":"First name","default":"","type":"string","name":"first_name"},{"_id":"5581d09a8625220d00429e4c","ref":"","in":"body","required":false,"desc":"Last name","default":"","type":"string","name":"last_name"},{"_id":"5581d09a8625220d00429e4b","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation","default":"","type":"string","name":"address1"},{"_id":"5581d09a8625220d00429e4a","ref":"","in":"body","required":false,"desc":"Address line 2.","default":"","type":"string","name":"address2"},{"_id":"5581d09a8625220d00429e49","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5581d09a8625220d00429e48","ref":"","in":"body","required":false,"desc":"State","default":"","type":"string","name":"state"},{"_id":"5581d09a8625220d00429e47","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581d09a8625220d00429e46","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation","default":"","type":"string","name":"zip"},{"_id":"5581d09a8625220d00429e45","ref":"","in":"body","required":false,"desc":"Phone number","default":"","type":"string","name":"phone"},{"_id":"58ac88c71909810f00fda9a2","ref":"","in":"body","required":false,"desc":"Amazon's billing agreement","default":"","type":"string","name":"amazon_billing_agreement_id"},{"_id":"58b4adc1ed60c11900989b38","ref":"","in":"body","required":false,"desc":"Braintree's payment method nonce representing the Paypal billing agreement id. This is required when processing Paypal transactions through Braintree.","default":"","type":"string","name":"braintree_payment_nonce"},{"_id":"5723d8f2110e570e00486c2f","ref":"","in":"body","required":false,"desc":"Paypal's billing agreement","default":"","type":"string","name":"paypal_billing_agreement_id"},{"_id":"585886cd59b00a0f007f1b44","ref":"","in":"body","required":false,"desc":"Roku's CIB if billing through Roku","default":"","type":"string","name":"roku_billing_agreement_id"},{"_id":"5581d09a8625220d00429e44","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"56c3c1ce70187b17005f4395","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"},{"_id":"5581d09a8625220d00429e43","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":3,"body":"Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.\n\nWhen Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include Billing Information with your request.\n\nThe required address fields will correspond to the **address requirements** configured for your site.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's credit card details.\",\n  \"title\": \"Please note\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.\",\n  \"title\": \"Please note\"\n}\n[/block]","excerpt":"Creates the account's Billing Information using external token for example: Paypal billing agreement","slug":"create-an-accounts-billing-info-using-external-token","type":"post","title":"Create Account's Billing Info (External Token)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate Account's Billing Info (External Token)

Creates the account's Billing Information using external token for example: Paypal billing agreement

Path Params

account_code:
required
string
Account's unique code.

Body Params

first_name:
required
string
First name
last_name:
string
Last name
address1:
string
Address line 1, recommended for address validation
address2:
string
Address line 2.
city:
string
City
state:
string
State
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation
phone:
string
Phone number
amazon_billing_agreement_id:
string
Amazon's billing agreement
braintree_payment_nonce:
string
Braintree's payment method nonce representing the Paypal billing agreement id. This is required when processing Paypal transactions through Braintree.
paypal_billing_agreement_id:
string
Paypal's billing agreement
roku_billing_agreement_id:
string
Roku's CIB if billing through Roku
vat_number:
string
Customer's VAT Number
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**

Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.

When Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

The required address fields will correspond to the address requirements configured for your site.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's credit card details.

Please note

This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->first_name = 'Verena';
  $billing_info->last_name = 'Example';
  $billing_info->paypal_billing_agreement_id = 'BA-0HS87238YB688345C';
  $billing_info->create();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The paypal billing agreement provided is invalid
  print "Invalid paypal billing agreement: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  :first_name         => 'Verena',
  :last_name          => 'Example',
  :paypal_billing_agreement_id             => 'BA-0HS87238YB688345C'
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.first_name = 'Verena'
billing_info.last_name = 'Example'
billing_info.paypal_billing_agreement_id = 'BA-0HS87238YB688345C'
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.FirstName = "Verana";
info.LastName = "Example";
info.PaypalBillingAgreementId = "BA-0HS87238YB688345C";
info.Create();
<billing_info>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"></phone>
  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>


{"_id":"5a0f610a823e2900127fd278","category":"5a0f6108823e2900127fd219","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T19:44:14.605Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = Recurly_BillingInfo::get('b6f5783');\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account or account\n  // doesn't have billing info\n  print \"Not found: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\nbilling_info = account.billing_info"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = account.BillingInfo;","language":"csharp"}]},"method":"get","results":{"codes":[{"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"/>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"/>\n  <vat_number nil=\"nil\"/>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country nil=\"nil\"/>\n  <card_type>Visa</card_type>\n  <year type=\"integer\">2019</year>\n  <month type=\"integer\">11</month>\n  <first_six>411111</first_six>\n  <last_four>1111</last_four>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","language":"xml","status":200},{"status":404,"language":"xml","code":"<error>\n  <symbol>not_found</symbol>\n  <description lang=\"en-US\">Couldn't find BillingInfo with account_code = 1</description>\n</error>"}]},"settings":"","auth":"required","params":[{"_id":"55944f815c9eaa2300a8633a","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581ce0ea5474a0d00d946a1","ref":"","in":"body","required":false,"desc":"First name","default":"","type":"string","name":"first_name"},{"_id":"5581ce0ea5474a0d00d946a0","ref":"","in":"body","required":false,"desc":"Last name","default":"","type":"string","name":"last_name"},{"_id":"5646783bc7687d0d00739f3f","ref":"","in":"body","required":false,"desc":"Company name","default":"","type":"string","name":"company"},{"_id":"5581ce0ea5474a0d00d9469f","ref":"","in":"body","required":false,"desc":"Address line 1","default":"","type":"string","name":"address1"},{"_id":"5581ce0ea5474a0d00d9469e","ref":"","in":"body","required":false,"desc":"Address line 2","default":"","type":"string","name":"address2"},{"_id":"5581ce0ea5474a0d00d9469d","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5581ce0ea5474a0d00d94695","ref":"","in":"body","required":false,"desc":"Credit card number, last four digits","default":"","type":"int","name":"last_four"},{"_id":"5581ce0ea5474a0d00d9469c","ref":"","in":"body","required":false,"desc":"State","default":"","type":"string","name":"state"},{"_id":"5581ce0ea5474a0d00d9469b","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements)","default":"","type":"string","name":"country"},{"_id":"5581ce0ea5474a0d00d9469a","ref":"","in":"body","required":false,"desc":"Zip or postal code","default":"","type":"string","name":"zip"},{"_id":"5581ce0ea5474a0d00d94699","ref":"","in":"body","required":false,"desc":"Customer's VAT number","default":"","type":"string","name":"vat_number"},{"_id":"5581ce0ea5474a0d00d94698","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their billing information","default":"","type":"string","name":"ip_address"},{"_id":"5581ce0ea5474a0d00d94697","ref":"","in":"body","required":false,"desc":"Country of IP address, if known by Recurly","default":"","type":"string","name":"ip_address_country"},{"_id":"5581ce0ea5474a0d00d94696","ref":"","in":"body","required":false,"desc":"Credit card number, first six digits","default":"","type":"int","name":"first_six"},{"_id":"5581ce0ea5474a0d00d94694","ref":"","in":"body","required":false,"desc":"Visa, MasterCard, American Express, Discover, JCB, etc","default":"","type":"string","name":"card_type"},{"_id":"5581ce0ea5474a0d00d94693","ref":"","in":"body","required":false,"desc":"Expiration month","default":"","type":"int","name":"month"},{"_id":"5581ce0ea5474a0d00d94692","ref":"","in":"body","required":false,"desc":"Expiration year","default":"","type":"int","name":"year"},{"_id":"5581ce0ea5474a0d00d94690","ref":"","in":"body","required":false,"desc":"Amazon Billing Agreement ID","default":"","type":"string","name":"amazon_billing_agreement_id"},{"_id":"58b5b5b36bf3a42500583bc5","ref":"","in":"body","required":false,"desc":"Braintree's payment method nonce representing the payment method.","default":"","type":"string","name":"braintree_payment_nonce"},{"_id":"5581ce0ea5474a0d00d94691","ref":"","in":"body","required":false,"desc":"PayPal Billing Agreement ID","default":"","type":"string","name":"paypal_billing_agreement_id"},{"_id":"58b5b5b36bf3a42500583bc4","ref":"","in":"body","required":false,"desc":"Roku's CIB if billing through Roku","default":"","type":"string","name":"roku_billing_agreement_id"},{"_id":"5581ce0ea5474a0d00d9468f","ref":"","in":"body","required":false,"desc":"The name associated with the account. This may be a person's full name or a business name. name_on_account is used instead of first_name and last_name if the payment method is Bank Account.","default":"","type":"string","name":"name_on_account"},{"_id":"5581ce0ea5474a0d00d9468e","ref":"","in":"body","required":false,"desc":"U.S. bank account routing number","default":"","type":"int","name":"routing_number"},{"_id":"5581ce0ea5474a0d00d9468d","ref":"","in":"body","required":false,"desc":"Bank account number","default":"","type":"int","name":"account_number"},{"_id":"5581ce0ea5474a0d00d9468c","ref":"","in":"body","required":false,"desc":"Either 'checking' or 'savings'","default":"","type":"string","name":"account_type"},{"_id":"58c82f966dc7140f003c4052","ref":"","in":"body","required":false,"desc":"Timestamp representing the last update of this billing info","default":"","type":"datetime","name":"updated_at"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":4,"body":"","excerpt":"Returns only the account's current billing information.","slug":"lookup-an-accounts-billing-info","type":"get","title":"Lookup Account's Billing Info","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getLookup Account's Billing Info

Returns only the account's current billing information.

Path Params

account_code:
required
string
Account's unique code.

Body Params

first_name:
string
First name
last_name:
string
Last name
company:
string
Company name
address1:
string
Address line 1
address2:
string
Address line 2
city:
string
City
last_four:
integer
Credit card number, last four digits
state:
string
State
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements)
zip:
string
Zip or postal code
vat_number:
string
Customer's VAT number
ip_address:
string
Customer's IPv4 address when updating their billing information
ip_address_country:
string
Country of IP address, if known by Recurly
first_six:
integer
Credit card number, first six digits
card_type:
string
Visa, MasterCard, American Express, Discover, JCB, etc
month:
integer
Expiration month
year:
integer
Expiration year
amazon_billing_agreement_id:
string
Amazon Billing Agreement ID
braintree_payment_nonce:
string
Braintree's payment method nonce representing the payment method.
paypal_billing_agreement_id:
string
PayPal Billing Agreement ID
roku_billing_agreement_id:
string
Roku's CIB if billing through Roku
name_on_account:
string
The name associated with the account. This may be a person's full name or a business name. name_on_account is used instead of first_name and last_name if the payment method is Bank Account.
routing_number:
integer
U.S. bank account routing number
account_number:
integer
Bank account number
account_type:
string
Either 'checking' or 'savings'
updated_at:
datetime
Timestamp representing the last update of this billing info

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = Recurly_BillingInfo::get('b6f5783');
  print "Billing Info: $billing_info";
} catch (Recurly_NotFoundError $e) {
  // Could not find account or account
  // doesn't have billing info
  print "Not found: $e";
}
account = Recurly::Account.find('1')
billing_info = account.billing_info
account = Account.get('1')
billing_info = account.billing_info
var account = Accounts.Get("1");
var info = account.BillingInfo;

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"/>
  <address1>123 Main St.</address1>
  <address2 nil="nil"/>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"/>
  <vat_number nil="nil"/>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country nil="nil"/>
  <card_type>Visa</card_type>
  <year type="integer">2019</year>
  <month type="integer">11</month>
  <first_six>411111</first_six>
  <last_four>1111</last_four>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<error>
  <symbol>not_found</symbol>
  <description lang="en-US">Couldn't find BillingInfo with account_code = 1</description>
</error>


{"_id":"5a0f610a823e2900127fd279","category":"5a0f6108823e2900127fd219","project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","parentDoc":null,"version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T20:05:12.621Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"put","results":{"codes":[{"language":"xml","status":200,"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"></phone>\n  <card_type>Visa</card_type>\n  <year type=\"integer\">2019</year>\n  <month type=\"integer\">11</month>\n  <first_six>411111</first_six>\n  <last_four>1111</last_four>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>"},{"status":404,"language":"xml","code":"<error>\n  <symbol>token_invalid</symbol>\n  <description>Token is either invalid or expired</description>\n</error>"}]},"settings":"","examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->token_id = '7z6furn4jvb9'; // From Recurly.js\n  $billing_info->update();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account or token is invalid or expired\n  print \"Not Found: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.billing_info.token_id = 'TOKEN_ID'\naccount.billing_info.save!"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.token_id = 'TOKEN_ID'\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.TokenId = \"TOKEN_ID\";\ninfo.Update();","language":"csharp"},{"code":"<billing_info>\n  <token_id>TOKEN_ID</token_id>\n</billing_info>","language":"xml"}]},"auth":"required","params":[{"_id":"55944fca5c9eaa2300a8633e","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d2f8a5474a0d00d946bc","ref":"","in":"body","required":true,"desc":"A token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token).","default":"","type":"string","name":"token_id"},{"_id":"56d0e7b07c2e100b000afa25","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":5,"body":"[Recurly.js](https://js.recurly.com/) allows you to collect customer Billing Information and tokenize it, preventing your servers from having to handle credit card information. When you send these tokens to Recurly through our API, we unpack the token and update Billing Information accordingly.\n\nWhen Billing Information is updated, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include billing info with your request.","excerpt":"Updates an account's Billing Information using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token). Returns the account's current Billing Information.","slug":"update-an-accounts-billing-info-token","type":"put","title":"Update Account's Billing Info (Token)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account's Billing Info (Token)

Updates an account's Billing Information using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token). Returns the account's current Billing Information.

Path Params

account_code:
required
string
Account's unique code.

Body Params

token_id:
required
string
A token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token).
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.

Recurly.js allows you to collect customer Billing Information and tokenize it, preventing your servers from having to handle credit card information. When you send these tokens to Recurly through our API, we unpack the token and update Billing Information accordingly.

When Billing Information is updated, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.

If you want to create an account at the same time, you should use the Account API end-point instead and include billing info with your request.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->token_id = '7z6furn4jvb9'; // From Recurly.js
  $billing_info->update();

  print "Billing Info: $billing_info";
} catch (Recurly_NotFoundError $e) {
  // Could not find account or token is invalid or expired
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info.token_id = 'TOKEN_ID'
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.token_id = 'TOKEN_ID'
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.TokenId = "TOKEN_ID";
info.Update();
<billing_info>
  <token_id>TOKEN_ID</token_id>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"></phone>
  <card_type>Visa</card_type>
  <year type="integer">2019</year>
  <month type="integer">11</month>
  <first_six>411111</first_six>
  <last_four>1111</last_four>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<error>
  <symbol>token_invalid</symbol>
  <description>Token is either invalid or expired</description>
</error>


{"_id":"5a0f610a823e2900127fd27a","category":"5a0f6108823e2900127fd219","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["55d337a4f77e6d0d00b1afab","562945ab1a92870d0002c302"],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T20:11:27.639Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->first_name = 'Verena';\n  $billing_info->last_name = 'Example';\n  $billing_info->number = '4111-1111-1111-1111';\n  $billing_info->verification_value = '123';\n  $billing_info->month = 11;\n  $billing_info->year = 2017;\n  $billing_info->update();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The data or card are invalid\n  print \"Invalid data or card: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Not Found: $e\";\n}","language":"php"},{"code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  :first_name         => 'Verena',\n  :last_name          => 'Example',\n  :number             => '4111-1111-1111-1111',\n  :verification_value => '123',\n  :month              => 11,\n  :year               => 2015\n}\naccount.billing_info.save!","language":"ruby"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.first_name = 'Verena'\nbilling_info.last_name = 'Example'\nbilling_info.number = '4111-1111-1111-1111'\nbilling_info.verification_value = '123'\nbilling_info.month = 11\nbilling_info.year = 2015\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.FirstName = \"Verana\";\ninfo.LastName = \"Example\";\ninfo.CreditCardNumber = \"4111-111-1111-1111\";\ninfo.VerificationValue = \"123\";\ninfo.ExpirationMonth = 11;\ninfo.ExpirationYear = 2015;\ninfo.Update();","language":"csharp"},{"language":"xml","code":"<billing_info>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <number>4111-1111-1111-1111</number>\n  <verification_value>123</verification_value>\n  <month>11</month>\n  <year>2019</year>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>"}]},"method":"put","results":{"codes":[{"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"/>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"/>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"/>\n  <vat_number nil=\"nil\"/>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country nil=\"nil\"/>\n  <card_type>Visa</card_type>\n  <year type=\"integer\">2019</year>\n  <month type=\"integer\">11</month>\n  <first_six>411111</first_six>\n  <last_four>1111</last_four>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","language":"xml","status":200},{"language":"xml","code":"<errors>\n  <transaction_error>\n    <error_code>declined_saveable</error_code>\n    <error_category>soft</error_category>\n    <merchant_message>The transaction was declined without specific information.  Please contact your payment gateway for more details or ask the customer to contact their bank.</merchant_message>\n    <customer_message>The transaction was declined. Please use a different card or contact your bank.</customer_message>\n    <gateway_error_code nil=\"nil\"/>\n  </transaction_error>\n  <error field=\"billing_info.base\" symbol=\"declined_saveable\">The transaction was declined. Please use a different card or contact your bank.</error>\n  <transaction href=\"https://your-subdomain.recurly.com/v2/transactions/3c429fe1aa71076aaf41524634816d53\" type=\"credit_card\">\n    <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n    <uuid>3c429fe1aa71076aaf41524634816d53</uuid>\n    <action>verify</action>\n    <amount_in_cents type=\"integer\">0</amount_in_cents>\n    <tax_in_cents type=\"integer\">0</tax_in_cents>\n    <currency>USD</currency>\n    <status>declined</status>\n    <payment_method>credit_card</payment_method>\n    <reference>6445370</reference>\n    <source>billing_info</source>\n    <recurring type=\"boolean\">false</recurring>\n    <test type=\"boolean\">true</test>\n    <voidable type=\"boolean\">false</voidable>\n    <refundable type=\"boolean\">false</refundable>\n    <ip_address>127.0.0.1</ip_address>\n    <transaction_error>\n      <error_code>declined_saveable</error_code>\n      <error_category>soft</error_category>\n      <merchant_message>The transaction was declined without specific information.  Please contact your payment gateway for more details or ask the customer to contact their bank.</merchant_message>\n      <customer_message>The transaction was declined. Please use a different card or contact your bank.</customer_message>\n      <gateway_error_code nil=\"nil\"/>\n    </transaction_error>\n    <cvv_result code=\"\" nil=\"nil\"/>\n    <avs_result code=\"\" nil=\"nil\"/>\n    <avs_result_street nil=\"nil\"/>\n    <avs_result_postal nil=\"nil\"/>\n    <created_at type=\"datetime\">2017-03-15T21:16:52Z</created_at>\n    <updated_at type=\"datetime\">2017-03-15T21:16:52Z</updated_at>\n    <details>\n      <account>\n        <account_code>1</account_code>\n        <first_name>Verena</first_name>\n        <last_name>Example</last_name>\n        <company>New Company Name</company>\n        <email>[email protected]</email>\n        <billing_info type=\"credit_card\">\n          <first_name>Verena</first_name>\n          <last_name>Example</last_name>\n          <address1>123 Main St.</address1>\n          <address2 nil=\"nil\"/>\n          <city>San Francisco</city>\n          <state>CA</state>\n          <zip>94105</zip>\n          <country>US</country>\n          <phone nil=\"nil\"/>\n          <vat_number nil=\"nil\"/>\n          <card_type>Visa</card_type>\n          <year type=\"integer\">2019</year>\n          <month type=\"integer\">11</month>\n          <first_six>400000</first_six>\n          <last_four>0341</last_four>\n        </billing_info>\n      </account>\n    </details>\n  </transaction>\n</errors>","status":422}]},"auth":"required","params":[{"_id":"55944fdb5c9eaa2300a8633f","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d46f8625220d00429e81","ref":"","in":"body","required":false,"desc":"First name","default":"","type":"string","name":"first_name"},{"_id":"5581d46f8625220d00429e80","ref":"","in":"body","required":false,"desc":"Last name","default":"","type":"string","name":"last_name"},{"_id":"59de5191debd1200240f6618","ref":"","in":"body","required":false,"desc":"Company name","default":"","type":"string","name":"company"},{"_id":"5581d46f8625220d00429e7f","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation","default":"","type":"string","name":"address1"},{"_id":"5581d46f8625220d00429e7e","ref":"","in":"body","required":false,"desc":"Address line 2","default":"","type":"string","name":"address2"},{"_id":"5581d46f8625220d00429e7d","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5581d46f8625220d00429e7c","ref":"","in":"body","required":false,"desc":"State","default":"","type":"string","name":"state"},{"_id":"5581d46f8625220d00429e7b","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581d46f8625220d00429e7a","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation","default":"","type":"string","name":"zip"},{"_id":"5581d46f8625220d00429e79","ref":"","in":"body","required":false,"desc":"Phone number","default":"","type":"string","name":"phone"},{"_id":"5581d46f8625220d00429e78","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"5581d46f8625220d00429e76","ref":"","in":"body","required":false,"desc":"Credit card number, spaces and dashes are accepted","default":"","type":"string","name":"number"},{"_id":"5581d46f8625220d00429e75","ref":"","in":"body","required":false,"desc":"Expiration month","default":"","type":"string","name":"month"},{"_id":"5581d46f8625220d00429e74","ref":"","in":"body","required":false,"desc":"Expiration year","default":"","type":"string","name":"year"},{"_id":"5581d46f8625220d00429e73","ref":"","in":"body","required":false,"desc":"Security code or CVV, 3-4 digits **STRONGLY RECOMMENDED**","default":"","type":"string","name":"verification_value"},{"_id":"5581d46f8625220d00429e77","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"},{"_id":"56c3c273c0c4630d004e86a8","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":6,"body":"Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when updating Billing Information. Non PCI sensitive billing info can be updated by api without re-submitting the token. This can be done in two ways: 1)Through the billing info api (docs. link: https://docs.recurly.com/api/billing-info#update-billing-info-credit-card ) whereby you submit only the information that needs to be updated. In that way, all other information remains unchanged on the account. 2) Providing the end user a unique url link to their billing info page, where they can update their own billing info securly. This link can be found in the configuration window of the subscriber's account. https://SUBDOMAIN.recurly.com/accounts/:account_code/edit. You will see a hosted billing information URL that takes the user to their billing site hosted by Recurly.\n\nWhen Billing Information is updated, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.\n\nIf you want to create an account at the same time, you should use the [Account API](https://docs.recurly.com/api/accounts#create-account) end-point instead and include Billing Information with your request.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Please note\",\n  \"body\": \"This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's credit card details. You can, however, use this API call to update the billing address associated with an account.\",\n  \"title\": \"Please note\"\n}\n[/block]","excerpt":"Returns the account's updated Billing Information.","slug":"update-an-accounts-billing-info-credit-card","type":"put","title":"Update Account's Billing Info (Credit Card)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account's Billing Info (Credit Card)

Returns the account's updated Billing Information.

Path Params

account_code:
required
string
Account's unique code.

Body Params

first_name:
string
First name
last_name:
string
Last name
company:
string
Company name
address1:
string
Address line 1, recommended for address validation
address2:
string
Address line 2
city:
string
City
state:
string
State
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation
phone:
string
Phone number
vat_number:
string
Customer's VAT Number
number:
string
Credit card number, spaces and dashes are accepted
month:
string
Expiration month
year:
string
Expiration year
verification_value:
string
Security code or CVV, 3-4 digits **STRONGLY RECOMMENDED**
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.

Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when updating Billing Information. Non PCI sensitive billing info can be updated by api without re-submitting the token. This can be done in two ways: 1)Through the billing info api (docs. link: https://docs.recurly.com/api/billing-info#update-billing-info-credit-card ) whereby you submit only the information that needs to be updated. In that way, all other information remains unchanged on the account. 2) Providing the end user a unique url link to their billing info page, where they can update their own billing info securly. This link can be found in the configuration window of the subscriber's account. https://SUBDOMAIN.recurly.com/accounts/:account_code/edit. You will see a hosted billing information URL that takes the user to their billing site hosted by Recurly.

When Billing Information is updated, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

Please note

This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's credit card details. You can, however, use this API call to update the billing address associated with an account.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->first_name = 'Verena';
  $billing_info->last_name = 'Example';
  $billing_info->number = '4111-1111-1111-1111';
  $billing_info->verification_value = '123';
  $billing_info->month = 11;
  $billing_info->year = 2017;
  $billing_info->update();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The data or card are invalid
  print "Invalid data or card: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  :first_name         => 'Verena',
  :last_name          => 'Example',
  :number             => '4111-1111-1111-1111',
  :verification_value => '123',
  :month              => 11,
  :year               => 2015
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.first_name = 'Verena'
billing_info.last_name = 'Example'
billing_info.number = '4111-1111-1111-1111'
billing_info.verification_value = '123'
billing_info.month = 11
billing_info.year = 2015
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.FirstName = "Verana";
info.LastName = "Example";
info.CreditCardNumber = "4111-111-1111-1111";
info.VerificationValue = "123";
info.ExpirationMonth = 11;
info.ExpirationYear = 2015;
info.Update();
<billing_info>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <number>4111-1111-1111-1111</number>
  <verification_value>123</verification_value>
  <month>11</month>
  <year>2019</year>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"/>
  <address1>123 Main St.</address1>
  <address2 nil="nil"/>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"/>
  <vat_number nil="nil"/>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country nil="nil"/>
  <card_type>Visa</card_type>
  <year type="integer">2019</year>
  <month type="integer">11</month>
  <first_six>411111</first_six>
  <last_four>1111</last_four>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>
<errors>
  <transaction_error>
    <error_code>declined_saveable</error_code>
    <error_category>soft</error_category>
    <merchant_message>The transaction was declined without specific information.  Please contact your payment gateway for more details or ask the customer to contact their bank.</merchant_message>
    <customer_message>The transaction was declined. Please use a different card or contact your bank.</customer_message>
    <gateway_error_code nil="nil"/>
  </transaction_error>
  <error field="billing_info.base" symbol="declined_saveable">The transaction was declined. Please use a different card or contact your bank.</error>
  <transaction href="https://your-subdomain.recurly.com/v2/transactions/3c429fe1aa71076aaf41524634816d53" type="credit_card">
    <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
    <uuid>3c429fe1aa71076aaf41524634816d53</uuid>
    <action>verify</action>
    <amount_in_cents type="integer">0</amount_in_cents>
    <tax_in_cents type="integer">0</tax_in_cents>
    <currency>USD</currency>
    <status>declined</status>
    <payment_method>credit_card</payment_method>
    <reference>6445370</reference>
    <source>billing_info</source>
    <recurring type="boolean">false</recurring>
    <test type="boolean">true</test>
    <voidable type="boolean">false</voidable>
    <refundable type="boolean">false</refundable>
    <ip_address>127.0.0.1</ip_address>
    <transaction_error>
      <error_code>declined_saveable</error_code>
      <error_category>soft</error_category>
      <merchant_message>The transaction was declined without specific information.  Please contact your payment gateway for more details or ask the customer to contact their bank.</merchant_message>
      <customer_message>The transaction was declined. Please use a different card or contact your bank.</customer_message>
      <gateway_error_code nil="nil"/>
    </transaction_error>
    <cvv_result code="" nil="nil"/>
    <avs_result code="" nil="nil"/>
    <avs_result_street nil="nil"/>
    <avs_result_postal nil="nil"/>
    <created_at type="datetime">2017-03-15T21:16:52Z</created_at>
    <updated_at type="datetime">2017-03-15T21:16:52Z</updated_at>
    <details>
      <account>
        <account_code>1</account_code>
        <first_name>Verena</first_name>
        <last_name>Example</last_name>
        <company>New Company Name</company>
        <email>[email protected]</email>
        <billing_info type="credit_card">
          <first_name>Verena</first_name>
          <last_name>Example</last_name>
          <address1>123 Main St.</address1>
          <address2 nil="nil"/>
          <city>San Francisco</city>
          <state>CA</state>
          <zip>94105</zip>
          <country>US</country>
          <phone nil="nil"/>
          <vat_number nil="nil"/>
          <card_type>Visa</card_type>
          <year type="integer">2019</year>
          <month type="integer">11</month>
          <first_six>400000</first_six>
          <last_four>0341</last_four>
        </billing_info>
      </account>
    </details>
  </transaction>
</errors>


{"_id":"5a0f610a823e2900127fd27b","category":"5a0f6108823e2900127fd219","parentDoc":null,"project":"555fbba928249c1900618a82","user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":["55d336d80168850d0073f056","55d33926f77e6d0d00b1afb5"],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T20:39:25.270Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->name_on_account = 'Acme Inc.';\n  $billing_info->routing_number = '065400137';\n  $billing_info->account_number = '4444000000005555';\n  $billing_info->account_type = 'checking';\n  $billing_info->address1 = '123 Main St.';\n  $billing_info->city = 'San Francisco';\n  $billing_info->state ='CA';\n  $billing_info->country = 'US';\n  $billing_info->zip = '94105';\n  $billing_info->update();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The data or bank account are invalid\n  print \"Invalid data or card: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Account Not Found: $e\";\n}","language":"php"},{"code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  name_on_account: 'Acme, Inc.',\n  routing_number: '065400137',\n  account_number: '4444000000005555',\n  address1: '123 Main St.',\n  city: 'San Francisco',\n  state: 'CA',\n  country: 'US',\n  zip: '94105'\n}\naccount.billing_info.save!","language":"ruby"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.name_on_account = 'Acme, Inc.'\nbilling_info.routing_number = '065400137'\nbilling_info.account_number = '4444000000005555'\nbilling_info.account_type = 'checking'\nbilling_info.address1 = '123 Main St.'\nbilling_info.city = 'San Francisco'\nbilling_info.state ='CA'\nbilling_info.country = 'US'\nbilling_info.zip = '94105'\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = account.BillingInfo;\ninfo.NameOnAccount = \"Acme, Inc.\";\ninfo.RoutingNumber = \"065400137\";\ninfo.AccountNumber = \"4444000000005555\";\ninfo.AccountType = BillingInfo.BankAccountType.Checking;\ninfo.Address1 = \"123 Main St.\";\ninfo.City = \"San Francisco\";\ninfo.State = \"CA\";\ninfo.Country = \"US\";\ninfo.PostalCode = \"94105\";\ninfo.Update();","language":"csharp"},{"code":"<billing_info>\n  <name_on_account>Acme, Inc.</name_on_account>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <routing_number>065400137</routing_number>\n  <account_number>4444000000005555</account_number>\n  <account_type>checking</account_type>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>","language":"xml"}]},"method":"put","results":{"codes":[{"status":200,"language":"xml","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"bank_account\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <name_on_account>Acme, Inc.</name_on_account>\n  <first_name nil=\"nil\"></first_name>\n  <last_name nil=\"nil\"></last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone></phone>\n  <vat_number></vat_number>\n  <ip_address>127.0.0.1</ip_address>\n  <ip_address_country>US</ip_address_country>\n  <account_type>checking</account_type>\n  <last_four>5555</last_four>\n  <routing_number>065400137</routing_number>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","name":""}]},"settings":"","auth":"required","params":[{"_id":"55944ff05c9eaa2300a86341","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581dafd8625220d00429ea7","ref":"","in":"body","required":true,"desc":"The name associated with the account. This may be a person's full name or a business name. This field must be 1 to 50 characters and can include: letters digits space . ' & , -","default":"","type":"string","name":"name_on_account"},{"_id":"5581dafd8625220d00429e9d","ref":"","in":"body","required":true,"desc":"Must be a real U.S. bank account routing number. All routing numbers are 9 digits.","default":"","type":"int","name":"routing_number"},{"_id":"5581dafd8625220d00429e9c","ref":"","in":"body","required":true,"desc":"Bank account number between 4 and 17 digits. We do not validate this number until the first transaction, so we recommend you have the customer confirm their account number.","default":"","type":"int","name":"account_number"},{"_id":"5581dafd8625220d00429e9b","ref":"","in":"body","required":true,"desc":"Either 'checking' or 'savings'","default":"","type":"int","name":"account_type"},{"_id":"59de51abdebd1200240f6619","ref":"","in":"body","required":false,"desc":"Company name","default":"","type":"string","name":"company"},{"_id":"5581dafd8625220d00429ea6","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation. This field has a 50 character max and can include: letters digits space . # / , -","default":"","type":"string","name":"address1"},{"_id":"5581dafd8625220d00429ea5","ref":"","in":"body","required":false,"desc":"Address line 2, this field has a 50 character max and can include: letters digits space . # / , -","default":"","type":"string","name":"address2"},{"_id":"5581dafd8625220d00429ea4","ref":"","in":"body","required":false,"desc":"City, this field has a 50 character max and can include: letters digits space . , -","default":"","type":"string","name":"city"},{"_id":"5581dafd8625220d00429ea3","ref":"","in":"body","required":false,"desc":"State, this field has a 2 character max and can be lowercase or uppercase.","default":"","type":"string","name":"state"},{"_id":"5581dafd8625220d00429ea2","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements). **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581dafd8625220d00429ea1","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation. This field can be just 5 digits or can have an optional additional 4 digits separated by a hyphen (e.g. 12345-6789).","default":"","type":"string","name":"zip"},{"_id":"5581dafd8625220d00429ea0","ref":"","in":"body","required":false,"desc":"Phone number, this field can be 10 digits.","default":"","type":"string","name":"phone"},{"_id":"5581dafd8625220d00429e9f","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"5581dafd8625220d00429e9e","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":7,"body":"Instead of using a token generated by Recurly.js, you can instead submit full bank account and address information when updating Billing Information.\n\nWhen Billing Information is updated, it is only saved if the required fields are provided and they meet the field validation requirements. If the account has a past due invoice, the outstanding balance will be collected when the Billing Information is updated.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include Billing Information with your request.\n\nIf you need to set a back dated subscription authorization date for the NACHA three year re-authorization rule, do so on the Create Subscription call using the \"bank_account_authorized_at\" attribute.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's bank account details. You can, however, use this API call to update the billing address associated with an account.\",\n  \"title\": \"Please note\"\n}\n[/block]","excerpt":"Returns the account's updated Billing Information. You will need to have the ACH feature on your site for this call to work.","slug":"update-an-accounts-billing-info-bank-account","type":"put","title":"Update Account's Billing Info (Bank Account)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account's Billing Info (Bank Account)

Returns the account's updated Billing Information. You will need to have the ACH feature on your site for this call to work.

Path Params

account_code:
required
string
Account's unique code.

Body Params

name_on_account:
required
string
The name associated with the account. This may be a person's full name or a business name. This field must be 1 to 50 characters and can include: letters digits space . ' & , -
routing_number:
required
integer
Must be a real U.S. bank account routing number. All routing numbers are 9 digits.
account_number:
required
integer
Bank account number between 4 and 17 digits. We do not validate this number until the first transaction, so we recommend you have the customer confirm their account number.
account_type:
required
integer
Either 'checking' or 'savings'
company:
string
Company name
address1:
string
Address line 1, recommended for address validation. This field has a 50 character max and can include: letters digits space . # / , -
address2:
string
Address line 2, this field has a 50 character max and can include: letters digits space . # / , -
city:
string
City, this field has a 50 character max and can include: letters digits space . , -
state:
string
State, this field has a 2 character max and can be lowercase or uppercase.
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements). **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation. This field can be just 5 digits or can have an optional additional 4 digits separated by a hyphen (e.g. 12345-6789).
phone:
string
Phone number, this field can be 10 digits.
vat_number:
string
Customer's VAT Number
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**

Instead of using a token generated by Recurly.js, you can instead submit full bank account and address information when updating Billing Information.

When Billing Information is updated, it is only saved if the required fields are provided and they meet the field validation requirements. If the account has a past due invoice, the outstanding balance will be collected when the Billing Information is updated.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

If you need to set a back dated subscription authorization date for the NACHA three year re-authorization rule, do so on the Create Subscription call using the "bank_account_authorized_at" attribute.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's bank account details. You can, however, use this API call to update the billing address associated with an account.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->name_on_account = 'Acme Inc.';
  $billing_info->routing_number = '065400137';
  $billing_info->account_number = '4444000000005555';
  $billing_info->account_type = 'checking';
  $billing_info->address1 = '123 Main St.';
  $billing_info->city = 'San Francisco';
  $billing_info->state ='CA';
  $billing_info->country = 'US';
  $billing_info->zip = '94105';
  $billing_info->update();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The data or bank account are invalid
  print "Invalid data or card: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Account Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  name_on_account: 'Acme, Inc.',
  routing_number: '065400137',
  account_number: '4444000000005555',
  address1: '123 Main St.',
  city: 'San Francisco',
  state: 'CA',
  country: 'US',
  zip: '94105'
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.name_on_account = 'Acme, Inc.'
billing_info.routing_number = '065400137'
billing_info.account_number = '4444000000005555'
billing_info.account_type = 'checking'
billing_info.address1 = '123 Main St.'
billing_info.city = 'San Francisco'
billing_info.state ='CA'
billing_info.country = 'US'
billing_info.zip = '94105'
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = account.BillingInfo;
info.NameOnAccount = "Acme, Inc.";
info.RoutingNumber = "065400137";
info.AccountNumber = "4444000000005555";
info.AccountType = BillingInfo.BankAccountType.Checking;
info.Address1 = "123 Main St.";
info.City = "San Francisco";
info.State = "CA";
info.Country = "US";
info.PostalCode = "94105";
info.Update();
<billing_info>
  <name_on_account>Acme, Inc.</name_on_account>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <routing_number>065400137</routing_number>
  <account_number>4444000000005555</account_number>
  <account_type>checking</account_type>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="bank_account">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <name_on_account>Acme, Inc.</name_on_account>
  <first_name nil="nil"></first_name>
  <last_name nil="nil"></last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone></phone>
  <vat_number></vat_number>
  <ip_address>127.0.0.1</ip_address>
  <ip_address_country>US</ip_address_country>
  <account_type>checking</account_type>
  <last_four>5555</last_four>
  <routing_number>065400137</routing_number>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>


{"_id":"5a0f610a823e2900127fd27c","category":"5a0f6108823e2900127fd219","user":"56c3c01334df460d00c2beb3","parentDoc":null,"project":"555fbba928249c1900618a82","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-29T21:59:52.047Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = new Recurly_BillingInfo();\n  $billing_info->account_code = 'b6f5783';\n  $billing_info->first_name = 'Verena';\n  $billing_info->last_name = 'Example';\n  $billing_info->paypal_billing_agreement_id = 'BA-0HS87238YB688345C';\n  $billing_info->create();\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_ValidationError $e) {\n  // The paypal billing agreement provided is invalid\n  print \"Invalid paypal billing agreement: $e\";\n} catch (Recurly_NotFoundError $e) {\n  // Could not find account\n  print \"Not Found: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\naccount.billing_info = {\n  :first_name         => 'Verena',\n  :last_name          => 'Example',\n  :paypal_billing_agreement_id             => 'BA-0HS87238YB688345C'\n}\naccount.billing_info.save!"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nbilling_info.first_name = 'Verena'\nbilling_info.last_name = 'Example'\nbilling_info.paypal_billing_agreement_id = 'BA-0HS87238YB688345C'\naccount.update_billing_info(billing_info)","language":"python"},{"code":"var account = Accounts.Get(\"1\");\nvar info = new BillingInfo(account);\ninfo.FirstName = \"Verana\";\ninfo.LastName = \"Example\";\ninfo.PaypalBillingAgreementId = \"BA-0HS87238YB688345C\";\ninfo.Create();","language":"csharp"},{"code":"<billing_info>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>\n  <ip_address>127.0.0.1</ip_address>\n</billing_info>","language":"xml"}]},"method":"put","results":{"codes":[{"name":"","code":"<billing_info href=\"https://your-subdomain.recurly.com/v2/accounts/1/billing_info\" type=\"credit_card\">\n  <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n  <first_name>Verena</first_name>\n  <last_name>Example</last_name>\n  <company nil=\"nil\"></company>\n  <address1>123 Main St.</address1>\n  <address2 nil=\"nil\"></address2>\n  <city>San Francisco</city>\n  <state>CA</state>\n  <zip>94105</zip>\n  <country>US</country>\n  <phone nil=\"nil\"></phone>\n  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>\n  <updated_at type=\"datetime\">2017-02-17T15:38:53Z</updated_at>\n</billing_info>","language":"xml","status":201}]},"settings":"","auth":"required","params":[{"_id":"55944fab5c9eaa2300a8633c","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"},{"_id":"5581d09a8625220d00429e4d","ref":"","in":"body","required":true,"desc":"First name","default":"","type":"string","name":"first_name"},{"_id":"5581d09a8625220d00429e4c","ref":"","in":"body","required":false,"desc":"Last name","default":"","type":"string","name":"last_name"},{"_id":"5581d09a8625220d00429e4b","ref":"","in":"body","required":false,"desc":"Address line 1, recommended for address validation","default":"","type":"string","name":"address1"},{"_id":"5581d09a8625220d00429e4a","ref":"","in":"body","required":false,"desc":"Address line 2.","default":"","type":"string","name":"address2"},{"_id":"5581d09a8625220d00429e49","ref":"","in":"body","required":false,"desc":"City","default":"","type":"string","name":"city"},{"_id":"5581d09a8625220d00429e48","ref":"","in":"body","required":false,"desc":"State","default":"","type":"string","name":"state"},{"_id":"5581d09a8625220d00429e47","ref":"","in":"body","required":false,"desc":"Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**","default":"","type":"string","name":"country"},{"_id":"5581d09a8625220d00429e46","ref":"","in":"body","required":false,"desc":"Zip or postal code, recommended for address validation","default":"","type":"string","name":"zip"},{"_id":"5581d09a8625220d00429e45","ref":"","in":"body","required":false,"desc":"Phone number","default":"","type":"string","name":"phone"},{"_id":"58ac88e0a7906a2f0076ab21","ref":"","in":"body","required":false,"desc":"Amazon's billing agreement","default":"","type":"string","name":"amazon_billing_agreement_id"},{"_id":"58b5b5296caa320f00470931","ref":"","in":"body","required":false,"desc":"Braintree's payment method nonce representing the Paypal billing agreement id. This is required when processing Paypal transactions through Braintree.","default":"","type":"string","name":"braintree_payment_nonce"},{"_id":"5723d8f2110e570e00486c2f","ref":"","in":"body","required":false,"desc":"Paypal's billing agreement","default":"","type":"string","name":"paypal_billing_agreement_id"},{"_id":"58b5b564b3bd052f009c61a0","ref":"","in":"body","required":false,"desc":"Roku's CIB if billing through Roku","default":"","type":"string","name":"roku_billing_agreement_id"},{"_id":"5581d09a8625220d00429e44","ref":"","in":"body","required":false,"desc":"Customer's VAT Number","default":"","type":"string","name":"vat_number"},{"_id":"56c3c1ce70187b17005f4395","ref":"","in":"body","required":false,"desc":"Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.","default":"","type":"string","name":"currency"},{"_id":"5581d09a8625220d00429e43","ref":"","in":"body","required":false,"desc":"Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**","default":"","type":"string","name":"ip_address"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":8,"body":"Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.\n\nWhen Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.\n\nIf you want to create an account at the same time, you should use the [Account API end-point](https://docs.recurly.com/api/accounts#create-account) instead and include Billing Information with your request.\n\nThe required address fields will correspond to the **address requirements** configured for your site.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Recurly strongly recommends using a token [generated by Recurly.js](https://docs.recurly.com/js/#getting-a-token) rather than directly handling your customer's credit card details.\",\n  \"title\": \"Please note\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.\",\n  \"title\": \"Please note\"\n}\n[/block]","excerpt":"Updates the account's Billing Information using external token for example: Paypal billing agreement","slug":"update-an-accounts-billing-info-using-external-token","type":"put","title":"Update Account's Billing Info (using external token)","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

putUpdate Account's Billing Info (using external token)

Updates the account's Billing Information using external token for example: Paypal billing agreement

Path Params

account_code:
required
string
Account's unique code.

Body Params

first_name:
required
string
First name
last_name:
string
Last name
address1:
string
Address line 1, recommended for address validation
address2:
string
Address line 2.
city:
string
City
state:
string
State
country:
string
Country, [2-letter ISO code](http://www.iso.org/iso/country_names_and_code_elements) **STRONGLY RECOMMENDED**
zip:
string
Zip or postal code, recommended for address validation
phone:
string
Phone number
amazon_billing_agreement_id:
string
Amazon's billing agreement
braintree_payment_nonce:
string
Braintree's payment method nonce representing the Paypal billing agreement id. This is required when processing Paypal transactions through Braintree.
paypal_billing_agreement_id:
string
Paypal's billing agreement
roku_billing_agreement_id:
string
Roku's CIB if billing through Roku
vat_number:
string
Customer's VAT Number
currency:
string
Currency in which invoices will be posted. Only applicable if this account is enrolled in a plan has a different currency than your site's default.
ip_address:
string
Customer's IPv4 address when updating their Billing Information **STRONGLY RECOMMENDED**

Instead of using a token generated by Recurly.js, you can instead submit full credit card and address information when creating Billing Information.

When Billing Information is submitted, it is only saved if valid. If the account has a past due invoice, the outstanding balance will be collected to validate the Billing Information.

If you want to create an account at the same time, you should use the Account API end-point instead and include Billing Information with your request.

The required address fields will correspond to the address requirements configured for your site.

Please note

Recurly strongly recommends using a token generated by Recurly.js rather than directly handling your customer's credit card details.

Please note

This API end-point may be used to import Billing Information without security codes (CVV). Recurly recommends requiring CVV from your customers when collecting new or updated Billing Information.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = new Recurly_BillingInfo();
  $billing_info->account_code = 'b6f5783';
  $billing_info->first_name = 'Verena';
  $billing_info->last_name = 'Example';
  $billing_info->paypal_billing_agreement_id = 'BA-0HS87238YB688345C';
  $billing_info->create();

  print "Billing Info: $billing_info";
} catch (Recurly_ValidationError $e) {
  // The paypal billing agreement provided is invalid
  print "Invalid paypal billing agreement: $e";
} catch (Recurly_NotFoundError $e) {
  // Could not find account
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
account.billing_info = {
  :first_name         => 'Verena',
  :last_name          => 'Example',
  :paypal_billing_agreement_id             => 'BA-0HS87238YB688345C'
}
account.billing_info.save!
account = Account.get('1')
billing_info = account.billing_info
billing_info.first_name = 'Verena'
billing_info.last_name = 'Example'
billing_info.paypal_billing_agreement_id = 'BA-0HS87238YB688345C'
account.update_billing_info(billing_info)
var account = Accounts.Get("1");
var info = new BillingInfo(account);
info.FirstName = "Verana";
info.LastName = "Example";
info.PaypalBillingAgreementId = "BA-0HS87238YB688345C";
info.Create();
<billing_info>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>
  <ip_address>127.0.0.1</ip_address>
</billing_info>

Result Format

<billing_info href="https://your-subdomain.recurly.com/v2/accounts/1/billing_info" type="credit_card">
  <account href="https://your-subdomain.recurly.com/v2/accounts/1"/>
  <first_name>Verena</first_name>
  <last_name>Example</last_name>
  <company nil="nil"></company>
  <address1>123 Main St.</address1>
  <address2 nil="nil"></address2>
  <city>San Francisco</city>
  <state>CA</state>
  <zip>94105</zip>
  <country>US</country>
  <phone nil="nil"></phone>
  <paypal_billing_agreement_id>BA-0HS87238YB688345C</paypal_billing_agreement_id>
  <updated_at type="datetime">2017-02-17T15:38:53Z</updated_at>
</billing_info>


{"_id":"5a0f610a823e2900127fd27d","category":"5a0f6108823e2900127fd219","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T20:40:02.831Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\ntry {\n  $billing_info = Recurly_BillingInfo::get('b6f5783');\n  $billing_info->delete();\n\n  // Or, in a single API request:\n  // Recurly_BillingInfo::deleteForAccount('b6f5783');\n\n  print \"Billing Info: $billing_info\";\n} catch (Recurly_NotFoundError $e) {\n  // Account not found or account does not have billing info\n  print \"Not Found: $e\";\n}","language":"php"},{"language":"ruby","code":"account = Recurly::Account.find('1')\nif billing_info = account.billing_info\n  billing_info.destroy\nend"},{"code":"account = Account.get('1')\nbilling_info = account.billing_info\nif billing_info\n  billing_info.delete()","language":"python"},{"code":"var account = Accounts.Get(\"1\");\naccount.DeleteBillingInfo();","language":"csharp"}]},"method":"delete","results":{"codes":[{"language":"json","status":204,"name":"","code":"Status: 204 No Content"}]},"settings":"","auth":"required","params":[{"_id":"55944ffb0c33bd0d0005964c","ref":"","in":"path","required":true,"desc":"Account's unique code.","default":"","type":"string","name":"account_code"}],"url":"/accounts/:account_code/billing_info"},"isReference":true,"order":9,"body":"","excerpt":"You may remove any stored billing information for an account. If the account has a subscription, the renewal will go into past due unless you update the billing info before the renewal occurs.","slug":"clear-an-accounts-billing-info","type":"delete","title":"Clear Account's Billing Info","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

deleteClear Account's Billing Info

You may remove any stored billing information for an account. If the account has a subscription, the renewal will go into past due unless you update the billing info before the renewal occurs.

Path Params

account_code:
required
string
Account's unique code.

Definition

{{ api_url }}{{ page_api_url }}

Examples

<?php

try {
  $billing_info = Recurly_BillingInfo::get('b6f5783');
  $billing_info->delete();

  // Or, in a single API request:
  // Recurly_BillingInfo::deleteForAccount('b6f5783');

  print "Billing Info: $billing_info";
} catch (Recurly_NotFoundError $e) {
  // Account not found or account does not have billing info
  print "Not Found: $e";
}
account = Recurly::Account.find('1')
if billing_info = account.billing_info
  billing_info.destroy
end
account = Account.get('1')
billing_info = account.billing_info
if billing_info
  billing_info.delete()
var account = Accounts.Get("1");
account.DeleteBillingInfo();

Result Format

Status: 204 No Content


{"_id":"5a0f6109823e2900127fd258","category":"5a0f6108823e2900127fd21a","project":"555fbba928249c1900618a82","parentDoc":null,"user":"55648cf93b87582b003ab8b1","version":"5a0f6108823e2900127fd210","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-17T22:25:07.292Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"<?php\n\n$coupons = Recurly_CouponList::get();\nforeach ($coupons as $coupon) {\n  print \"Coupon: $coupon\\n\";\n}","language":"php"},{"code":"Recurly::Coupon.find_each do |coupon|\n  puts \"Coupon: #{coupon.inspect}\"\nend","language":"ruby"},{"code":"#client version 2.1.6+\nfor coupon in Coupon.all():\n    print 'Coupon: %s' % coupon\n\n#client version <= 2.1.5\ncoupons = Coupon.all()\nwhile coupons:\n    for coupon in coupons:\n        print 'Coupon: %s' % coupon\n    try:\n        coupons = coupons.next_page()\n    except PageError:\n        coupons = ()\n","language":"python"},{"language":"csharp","code":"using System.Linq;\n\nvar coupons = Coupons.List();\nwhile (coupons.Any())\n{\n\tforeach (var coupon in coupons)\n\t\tConsole.WriteLine(\"Coupon: \" + coupon);\n\tcoupons = coupons.Next;\n}"}]},"method":"get","results":{"codes":[{"language":"xml","status":200,"name":"","code":"<coupons type=\"array\">\n  <coupon href=\"https://your-subdomain.recurly.com/v2/coupons/special\">\n    <redemptions href=\"https://your-subdomain.recurly.com/v2/coupons/special/redemptions\"/>\n    <id type=\"integer\">2151093486799579392</id>\n    <coupon_code>special</coupon_code>\n    <name>Special 10% off</name>\n    <state>redeemable</state>\n    <description nil=\"nil\"/>\n    <discount_type>percent</discount_type>\n    <discount_percent type=\"integer\">10</discount_percent>\n    <invoice_description nil=\"nil\"/>\n    <redeem_by_date type=\"datetime\">2017-12-31T00:00:00Z</redeem_by_date>\n    <single_use type=\"boolean\">true</single_use>\n    <applies_for_months nil=\"nil\"/>\n    <max_redemptions type=\"integer\">200</max_redemptions>\n    <applies_to_all_plans type=\"boolean\">false</applies_to_all_plans>\n    <created_at type=\"datetime\">2016-07-11T18:50:17Z</created_at>\n    <updated_at type=\"datetime\">2016-07-11T18:50:17Z</updated_at>\n    <deleted_at nil=\"nil\"/>\n    <duration>single_use</duration>\n    <temporal_unit nil=\"nil\"/>\n    <temporal_amount nil=\"nil\"/>\n    <applies_to_non_plan_charges type=\"boolean\">false</applies_to_non_plan_charges>\n    <redemption_resource>account</redemption_resource>\n    <max_redemptions_per_account nil=\"nil\"/>\n    <coupon_type>single_code</coupon_type>\n    <plan_codes type=\"array\">\n      <plan_code>gold</plan_code>\n      <plan_code>platinum</plan_code>\n    </plan_codes>\n    <a name=\"redeem\" href=\"https://your-subdomain.recurly.com/v2/coupons/special/redeem\" method=\"post\"/>\n  </coupon>\n  <!-- Continued... -->\n</coupons>"}]},"settings":"","auth":"required","params":[{"_id":"5581f3c38625220d00429ee7","ref":"","in":"query","required":false,"desc":"The state of coupons to return: `redeemable`, `expired`, `maxed_out`, or `inactive`.","default":"all","type":"string","name":"state"},{"_id":"578eaf697d6eeb0e004fb85e","ref":"","in":"query","required":false,"desc":"The attribute that will be used to order records: `created_at`, `updated_at`.","default":"created_at","type":"string","name":"sort"},{"_id":"578eaf697d6eeb0e004fb85d","ref":"","in":"query","required":false,"desc":"The order in which products will be returned: `asc` for ascending order, `desc` for descending order.","default":"desc","type":"string","name":"order"},{"_id":"578eaf85902f512200bd3f9f","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"begin_time"},{"_id":"578eafa27d6eeb0e004fb85f","ref":"","in":"query","required":false,"desc":"Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes less than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.","default":"","type":"datetime","name":"end_time"},{"_id":"5581f3c38625220d00429ee5","ref":"","in":"query","required":false,"desc":"Number of records to return per page, up to a maximum of 200.","default":"50","type":"int","name":"per_page"},{"_id":"5581f3c38625220d00429ee6","ref":"","in":"query","required":false,"desc":"Splits records across pages. Leave blank to return the first page. Follow the URI in the first page's Link header to fetch the next page.","default":"","type":"string","name":"cursor"}],"url":"/coupons"},"isReference":true,"order":1,"body":"","excerpt":"Returns a list of all the coupons.","slug":"list-active-coupons","type":"get","title":"List Coupons","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getList Coupons

Returns a list of all the coupons.

Query Params

state:
stringall
The state of coupons to return: `redeemable`, `expired`, `maxed_out`, or `inactive`.
sort:
stringcreated_at
The attribute that will be used to order records: `created_at`, `updated_at`.
order:
stringdesc
The order in which products will be returned: `asc` for ascending order, `desc` for descending order.
begin_time:
datetime
Operates on the attribute specified by the sort parameter. Filters records to only include those with datetimes greater than or equal to the supplied datetime. Accepts an ISO 8601 date or date and time.
end_time<