openapi/api.yaml in recurly-3.3.0 vs openapi/api.yaml in recurly-3.3.1
- old
+ new
@@ -140,553 +140,11 @@
header contains an integer value representing the time, measured in
seconds since the UNIX Epoch, at which the request count will be reset.
## Change Log
- ### v2019-10-10
-
- Added support for item-backed AddOns:
- * `PlanCreate` request:
- * Added `add_ons.item_code`, when the `Catalog: Item Add-Ons` feature is enabled
- * Added `add_ons.item_id`, when the `Catalog: Item Add-Ons` feature is enabled
- * The following parameters are no longer acceptable if `item_code`/`item_id` is present:
- * `add_ons.code`
- * `add_ons.name`
- * `add_ons.accounting_code`
- * `add_ons.tax_code`
- * `AddOnCreate` request:
- * Added `item_code`, when the `Catalog: Item Add-Ons` feature is enabled
- * Added `item_id`, when the `Catalog: Item Add-Ons` feature is enabled
- * The following parameters are no longer acceptable if `item_code`/`item_id` is present:
- * `code`
- * `name`
- * `accounting_code`
- * `tax_code`
- * `AddOnUpdate` request:
- * The following parameters are no longer acceptable if an AddOn is item-backed:
- * `name`
- * `accounting_code`
- * `tax_code`
- * `AddOn` response format updates:
- * Added `item`:
- * Added `item.id`
- * Added `item.object`
- * Added `item.state`
- * Added `item.name`
- * Added `item.description`
- * Added `external_sku`
- * `Subscription` response format updates:
- * Added `add_ons.add_on.item_id`
- * Added `add_ons.add_on.external_sku`
-
- Support for `optional` in AddOn
- * `AddOn` response format:
- * Added `optional`
-
- Create convert trial endpoint for immediately converting trial subscription to fully active
- * Added `PUT /sites/:site_id/subscriptions/:id/convert_trial`.
-
- Support `gateway_token` and `gateway_code` for Billing Infos
- * `BillingInfoCreate` request format:
- * Added `gateway_token`
- * Added `gateway_code`
- * `PaymentMethod` response format:
- * Added `gateway_token`
- * Added `gateway_code`
-
- Adding fields to the `Account` schema to view `Subscription` and `Invoice` statuses without making multiple requests:
- * Subscription status fields:
- * `has_live_subscription`
- * `has_active_subscription`
- * `has_future_subscription`
- * `has_canceled_subscription`
- * `has_paused_subscription`
- * Invoice status fields:
- * `has_past_due_invoice`
-
- Support `external_gift_card` origins for Line Items
- * Changed LineItemCreate request format:
- * Added `origin`.
-
- Starting to add support for .pdf routes
- * Added `GET /sites/:site_id/invoices/{invoice_id}.pdf`.
- * Added BinaryFile schema
-
- Improving the ability to work with Custom Field Definitions.
- * Added a `related_type` filter to the listing end point.
-
- Added support for the Revenue Recognition feature to LineItem, when the `Revenue Recognition` feature is enabled
- * Changed LineItemCreate request format:
- * Added `revenue_schedule_type`.
- * `LineItem` response format:
- * Added `revenue_schedule_type`.
-
- Added support for the Revenue Recognition feature to Purchase, when the `Revenue Recognition` feature is enabled
- * Changed PurchaseCreate request format:
- * Added `line_items.revenue_schedule_type`.
- * Changed Purchase response format:
- * Added `line_items.revenue_schedule_type`.
-
- Added support for Items, when the Catalog feature is enabled:
- * Added `GET /sites/:site_id/items`.
- * Added `POST /sites/:site_id/items`.
- * Added `GET /sites/:site_id/items/:id`.
- * Added `PUT /sites/:site_id/items/:id`.
- * Added `PUT /sites/:site_id/items/:id/reactivate`.
- * Added `DELETE /sites/:site_id/items/:id`.
-
- Added support for `Item` to `LineItem`, when the Catalog feature is enabled
- * `LineItem` request format updates
- * Added `item_code`.
- * Added `item_id`.
- * The following parameters are no longer acceptable if `item_code`/`item_id` is present
- * `product_code`
- * `accounting_code`
- * `tax_exempt`
- * `tax_code`
- * `description`
-
- * The following parameters can be passed in if `item_code`/`item_id` are present, to override the values on the referenced `Item`.
- * `currency` - if there are multiple currencies defined on the site. The site's default will be used otherwise.
- * `unit_amount` - can be used to override the default `unit_amount` on the `Item`.
- * `revenue_schedule_type` - can be used to override the default `revenue_schedule_type` on the `Item`.
-
- * `LineItem` response format updates
- * Added `item_code`.
- * Added `item_id`.
- * Added `external_sku`.
- * `product_code` will be populated with `item_code` of the `Item` when an `item_code` or `item_id` is passed in the request.
-
- Added support for Items in Purchases, when the Catalog feature is enabled
- * Changed PurchaseCreate request format:
- * Added `line_items.item_code`/`line_items.item_id`.
- * The following parameters are no longer acceptable if `line_items.item_code`/`line_items.item_id` is present
- * `line_items.product_code`
- * `line_items.accounting_code`
- * `line_items.tax_exempt`
- * `line_items.tax_code`
- * `line_items.description`
-
- * If `line_items.item_code`/`line_items.item_id` is present, the following parameters can be passed in to override the values on the referenced Item:
- * `line_items.currency` - if there are multiple currencies defined on the site. The site's default will be used otherwise.
- * `line_items.unit_amount` - can be used to override the default `unit_amount` on the Item.
- * `line_items.revenue_schedule_type` - can be used to override the default `revenue_schedule_type` on the Item.
-
- * Changed Purchase response format:
- * Added `line_items.item_code`.
- * Added `line_items.item_id`.
- * Added `line_items.external_sku`.
- * `line_items.product_code` will be populated with the `item_code` of the Item when an `item_code` or `item_id` is passed in the request.
-
- Starting to improve support for shipping:
- * Added `GET /sites/:site_id/shipping_methods/`.
- * Added `GET /sites/:site_id/shipping_methods/:id/`.
- * Changes Invoice and LineItem response formats:
- * Added `shipping_address`.
- * Changes PurchaseCreate request format:
- * Added `shipping.fees`.
- * Removed `shipping_address`. Use `shipping.address` instead.
- * Removed `shipping_address_id`. Use `shipping.address_id` instead.
- * Changes Subscription request format:
- * Added `shipping.address`, `shipping.address_id`, `shipping.method_id`,
- `shipping.method_code`, and `shipping.amount`.
- * Removed `shipping_address`. Use `shipping.address` instead.
- * Removed `shipping_address_id`. Use `shipping.address_id` instead.
- * Changes SubscriptionUpdate request format:
- * Added `shipping.address` and `shipping.address_id`.
- * Removed `shipping_address`. Use `shipping.address` instead.
- * Removed `shipping_address_id`. Use `shipping.address_id` instead.
- * Changes Subscription response format:
- * Added `shipping.address`, `shipping.method`, and `shipping.amount`.
- * Removed `shipping_address`. Use `shipping.address` instead.
- * Changes SubscriptionChange request format:
- * Added `plan_id`.
- * Added `shipping.amount`, `shipping.method_id`, and `shipping.method_code`.
- * Changes SubscriptionChange response format:
- * Added `shipping.address`, `shipping.method`, `shipping.amount`.
-
- Allow specifying when subscription cancellation takes effect:
- * Changes SubscriptionCancel request format:
- * Added new body parameter `timeframe`.
-
- Accept bill_date and term_end timeframe options in subscription change requests:
- * Changes SubscriptionChangeCreate request format:
- * Changed `timeframe` to accept `bill_date` and `term_end` in addition to `now`.
-
- A breaking change on the `Coupon` object:
- * Changed `Coupon`
- * Changed `plans` to now be `nil` instead of `"all"` in the case where `applies_to_all_plans` is `true`.
-
- Fixes an inconsistency in the handling of tax codes for EU VAT merchants.
- Now the values passed in when assigning a `tax_code` will be reflected in
- the output and match the previously documented behavior:
- * Changes AddOn, LineItem and Plan response formats:
- * Changed `tax_code` values to return `physical` and `digital` and match the input values.
-
- A breaking change with bank account info
- * Changes Transaction response format:
- * Changed `object` value from "ach" to "bank_account_info" for all bank account payment methods.
-
- Allow searching for accounts by their email address:
- * Added `email` as a filter to the account listing operations (`list_accounts` and `list_child_accounts`).
-
- Support PSD2 checks and specifying Mail Order & Telephone Order transactions:
- * Changes SubscriptionCreate request format:
- * Added `transaction_type`.
- * Changes SubscriptionChangeCreate request format:
- * Added `transaction_type`.
- * Changes InvoiceCollect request format:
- * Added `three_d_secure_action_result_token_id`.
- * Added `transaction_type`.
- * Changes AccountCreate request format:
- * Added `transaction_type`.
- * Changes AccountUpdate request format:
- * Added `transaction_type`.
- * Changes PurchaseCreate request format:
- * Added `transaction_type`.
- * Changes BillingInfoCreate request format:
- * Added `transaction_type`.
- * Added `three_d_secure_action_result_token_id`.
- * Changes the TransactionError response format:
- * Added `three_d_secure_action_token_id` to indicate an SCA flow is required to complete the transaction.
-
- Support IBAN bank account fields
- * Changes BillingInfo response format:
- * Added `last_two` for IBAN bank account types.
-
- ### v2018-08-09
-
- Added support for Purchases
- * Added `POST /sites/:site_id/purchases`
- * Added `POST /sites/:site_id/purchases/preview`
-
- For merchants using the Vertex tax provider:
- * Changed Account request and response format:
- * Added `exemption_certificate`.
-
- Listing Transactions
- * Added `authorization`, `capture`, `payment` and `verify` as options for the `type` filter.
-
- Account objects have the new `bill_to` attribute to indicate billing behavior:
- * Added `bill_to` to Account object requests and responses.
- * Added `bill_to` and `parent_account_id` to AccountMini objects.
-
- SubscriptionChange request format has changed:
- * Added `plan_id`.
-
- There is now an endpoint to fetch coupon redemptions on a subscription.
- Redemptions are still be embedded on the subscription as well.
- * Added `GET /sites/{site_id}/subscriptions/{subscription_id}/coupon_redemptions`.
-
- Site responses now have their Public API Key available:
- * Added `public_api_key`.
-
- * Changes Account object on Account Acquisition, Balance, Coupon Redemption, Credit Payment,
- Invoice, Line Item, Transaction, and Subscription response formats:
- * Added `company`.
-
- Invoices can now be edited, if the `Edit Invoice` feature flag is enabled:
- * Added `PUT /sites/:site_id/invoices/:id`
- * Changed Invoice response format:
- * Added `name_on_account`, `first_name`, `last_name`, and `company` to an
- invoice's `address`.
-
- SubscriptionAddOns on the SubscriptionChange can now be referenced by `id`. Sending only the
- id keeps the add-on and does not change any fields.
- * Changes SubscriptionChange create request format:
- * Added `subscription_add_ons[].id`.
-
- Accounts have the ability to be linked via a parent-child relationship:
- * There is now an endpoint to list child accounts:
- * Added `GET /sites/{site_id}/accounts/{account_id}/accounts`
- * Changed Account request format:
- * Added `parent_account_code`.
- * Added `parent_account_id`.
- * Changed Account response format:
- * Added `parent_account_id`.
-
- A product code can now be set when creating line items:
- * Changed LineItemCreate request format:
- * Added `product_code`.
-
- ### v2018-06-06
- Plans and Subscriptions have now changed to support the transition to subscription terms.
- * Changes Subscription create request format:
- * Added `auto_renew`.
- * Added `renewal_billing_cycles`.
- * Added `next_bill_date`.
- * Removed `first_renewal_date`. Use `next_bill_date` instead.
- * Changed Subscription update request format:
- * Added `next_bill_date`.
- * Removed `next_renewal_at`. Use `next_bill_date` instead.
- * Changes Subscription response format:
- * Added `auto_renew`.
- * Added `renewal_billing_cycles`.
- * Added `current_term_started_at`.
- * Added `current_term_ends_at`.
- * Added `total_billing_cycles`.
- * Changed Plan `POST` and `GET` request and response format:
- * Added `auto_renew`.
- * Changed Plan `PUT` request:
- * `interval_unit` and `interval_length` can no longer be updated.
-
- Accounts and Subscriptions can now have custom fields:
- * Changed Account request and response format:
- * Added `custom_fields`.
- * Changed Subscription request and response format:
- * Added `custom_fields`.
-
- The Custom Field Definitions can now be read via the API:
- * Added `GET /sites/{site_id}/custom_field_definitions`
- * Added `GET /sites/{site_id}/custom_field_definitions/{custom_field_definition_id}`
-
- ### v2018-05-10
- Subscriptions can now be paused and resumed:
- * Added `PUT /sites/{site_id}/subscriptions/{subscription_id}/pause`
- * Added `PUT /sites/{site_id}/subscriptions/{subscription_id}/resume`
- * Changed Subscription response formats:
- * Added `paused_at`. This is the date the subscription was paused.
- * Added `remaining_pause_cycles`. The number of billing cycles remaining
- for a paused subscription.
-
- ### v2018-01-24
- * Changed Line Item response format:
- * Added `tax_info` hash. Includes type, region, and rate.
- We recommend using this over invoice level `tax_info` since
- different line items may be shipped to different addresses
- and have different taxes applied.
- * Changed Site response format:
- * Added `features` array. Allows you to see if credit memos and other
- features are enabled on a site.
- * Changed Account request and response formats:
- * Added `preferred_locale`.
- * Changed Invoice response format:
- * Added `balance`.
- * Removed `due`.
- * Changed Credit Payment response format:
- * Added `original_credit_payment`.
- * Added `refund_transaction`.
- * Changed Transaction response format:
- * Added `voided_by_invoice`.
- * Changed Line Item response format:
- * Added `original_line_item_invoice_id` (reverting change in v2017-09-30).
-
- ### v2017-09-30
- #### Accounts
- Changed Account Address request format:
- * Validates address fields for length.
- * When `postal_code` is present it must be a valid postal code for the country.
-
- #### Invoices
- We've made many changes to Invoices to support the Credit Memos feature.
- Invoices created prior to the feature being enabled are considered legacy
- invoices.
-
- The contents of the `type` in previous versions have moved to the `origin`
- field. The new `type` field indicates if the invoice is a charge, credit or
- legacy invoice.
-
- Credit and charge invoices will only have line items of a single type so the
- `line_items` format has changed from an object to a simple array. The old
- object keys have moved into the line items's `legacy_category` field.
-
- Changed Create and Preview Invoice request format:
- * Added `charge_customer_notes`.
- * Added `credit_customer_notes`.
- * Removed `customer_notes`. Use `charge_customer_notes` instead.
-
- Changed Create and Preview Invoice response format:
- * Changed `invoice` from a single object to an `invoice_collection` object
- with a `charge_invoice` and array of `credit_invoices`. You'll need to
- prefix any existing references to the response object with `charge_invoice.`.
-
- Changed Invoice response format:
- * Previous `type` field is now `origin`.
- * Added a new `type` field to support upcoming credit invoices. Existing
- invoices are `type=legacy`.
- * Changed `line_items` from an object with multiple arrays to a single array.
- Object keys have moved into the `legacy_category` field of the line items
- for invoices with `type=legacy`.
- * Added `refundable_amount`.
- * Added `credit_payments`.
- * Added `subscription_ids`.
- * Removed `subscription_id`. Use `subscription_ids[0]` instead.
-
- Changed InvoiceRefund request format:
- * Added `external_refund` object for refunds settled outside Recurly.
- * Added `credit_customer_notes`.
- * Added `all_credit` and `all_transaction` to the `refund_method` enum's options.
-
- Listing Invoices
- * Added `type` filter to Invoice listing.
- * Added `GET /sites/{site_id}/invoices/{invoice_id}/related_invoices`
- * Added `POST /sites/{site_id}/invoices/{invoice_id}/refund`
-
- Credit invoices can be voided with the void_invoice endpoint:
- * Added `PUT /sites/{site_id}/invoices/{invoice_id}/void`.
-
- #### Line Items
- Changed Line Item request format:
- * Added `credit_reason_code`.
- * Changed the `type` to now be required.
-
- Changed Line Item response format:
- * Added `legacy_category`.
- * Added `credit_reason_code`.
- * Added `proration_rate`.
- * Removed `original_line_item_id`.
- * ~~Removed `original_line_item_invoice_id`.~~ (change reverted)
-
- #### Credit Payments
- Added `CreditPayment` object to model credit invoices being applied to a
- charge invoice.
-
- There are new endpoints to fetch credit payments:
- * `GET /sites/{site_id}/credit_payments`
- * `GET /sites/{site_id}/accounts/{account_id}/credit_payments`
- * `GET /sites/{site_id}/credit_payments/{credit_payment_id}`
-
- #### Transactions
- One transaction can now pay for multiple subscriptions.
-
- Changed Transaction response format:
- * Added `id` and `type` to the nested `invoice` object.
- * Removed `invoice_id`. Use `invoice.id` instead.
- * Added `subscription_ids`.
- * Removed `subscription_id`. Use `subscription_ids[0]` instead.
- * Added `collection_method`.
- * Added more supported values for `payment_method`.
-
- #### Subscriptions
- Changed Subscription create request format:
- * Added `credit_customer_notes`.
-
- #### Miscellaneous
- Changed Address and Shipping Address request formats:
- * When `country` is present it must be a valid 2 letter ISO 3166 country code.
-
- Removed `BooleanResponse` – The following end points now return `204` with
- no content instead of `200` with BooleanResponse:
- * `DELETE /sites/{site_id}/accounts/{account_id}/billing_info`
- * `DELETE /sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}`
- * `DELETE /sites/{site_id}/subscriptions/{subscription_id}/change`
- * `DELETE /sites/{site_id}/line_items/{id}`
-
- ### v2017-01-12
- * Added new `ids` pagination parameter.
- * Changed Site response format:
- * Added `settings`.
- * Changed Account response format:
- * Billing info is no longer wrapped in an array.
- * Changed allowed parameters on `POST /sites/{site_id}/accounts`:
- * Added `shipping_addresses`.
- * Changed allowed parameters on `POST /sites/{site_id}/subscriptions`:
- * Added `shipping_address`.
- * Added `shipping_address_id`.
- * Changed allowed parameters on `PUT /sites/{site_id}/subscriptions/{subscription_id}`:
- * Added `shipping_address`.
- * Added `shipping_address_id`.
- * Changed Coupon request format:
- * Removed `description`, use `hosted_description` instead.
- * Changed Subscription response format:
- * Added `expiration_reason`.
-
- ### v2016-12-15
- * Changed pagination parameters:
- * Added `begin_time`.
- * Added `end_time`.
- * Removed `date`.
- * Removed `seen_id` parameter.
- * Removed `id` value for the `sort` parameter; use `created_at` instead.
- * Changed default value of the `sort` parameter to `created_at`.
- * Changed parameters on `POST /sites/{site_id}/subscriptions`:
- * Added `total_billing_cycles`.
- * Removed `billing_cycles`.
- * Changed parameters on `PUT /sites/{site_id}/subscriptions/{subscription_id}`:
- * Added `remaining_billing_cycles`.
- * Removed `billing_cycles`.
- * Changed parameters on `PUT /sites/{site_id}/accounts/{account_id}/billing_info`:
- * Added `currency`.
- * Changed Unique Coupon Code response format:
- * Added `updated_at`.
- * Changed Shipping Address response format:
- * Added `created_at`.
- * Added `updated_at`.
- * Changed Account response format:
- * Added `shipping_addresses`.
- * Changed Subscription response format:
- * Added `shipping_address`.
- * Changed Line Item response format:
- * Added `credit_applied`.
- * Added `original_line_item_invoice_id`.
- * Added `subtotal`.
- * Changed Subscription response format:
- * Added `remaining_billing_cycles`.
-
- ### v2016-07-27
- * Changed Line Item response format:
- * Added `uuid`.
- * Changed Coupon response format:
- * Added `unique_code_template`.
- * Removed `currencies` list.
- * Changed format of `discount` object.
- * Added `PUT /sites/{site_id}/coupons/{coupon_id}` to update a coupon.
- * Permitted additional parameters on `POST /sites/{site_id}/coupons`:
- * Added `applies_to_non_plan_charges`.
- * Added `redemption_resource`.
- * Added `coupon_type`.
- * Added `unique_code_template`.
- * Changed allowed parameters on `POST /sites/{site_id}/coupons`:
- * Added `free_trial_unit`.
- * Added `free_trial_amount`.
- * Added `POST /sites/:site_id/coupons/:id/generate`.
- * Added `GET /site/:site_id/coupon/:coupon_id/unique_coupon_codes`.
- * Added `GET /site/:site_id/unique_coupon_codes/:unique_coupon_code_id`.
- * Added `DELETE /site/:site_id/unique_coupon_codes/:unique_coupon_code_id`.
- * Added `PUT /site/:site_id/unique_coupon_codes/:unique_coupon_code_id/restore`.
- * Changed Subscription response format:
- * Added `subtotal`.
- * Added `terms_and_conditions`.
- * Added `customer_notes`.
- * Added `bank_account_authorized_at`.
- * Removed `total`, `tax` and `tax_info`. Use the pre-tax `subtotal` instead.
- * Added `GET /sites/:site_id/accounts/:account_id/acquisition`.
- * Added `PUT /sites/:site_id/accounts/:account_id/acquisition`.
- * Added `DELETE /sites/:site_id/accounts/:account_id/acquisition`.
- * Added `GET /sites/:site_id/acquisitions`.
- * Changed Transaction response format:
- * Added `original_transaction_id`.
- * Added `GET /sites/:site_id/accounts/:account_id/shipping_addresses`.
- * Added `POST /sites/:site_id/accounts/:account_id/shipping_addresses`.
- * Added `PUT /sites/:site_id/accounts/:account_id/shipping_addresses/:shipping_address_id`.
- * Added `DELETE /sites/:site_id/accounts/:account_id/shipping_addresses/:shipping_address_id`.
-
- ### v2016-07-05 (Removed)
- * Changed Subscription response format:
- * Added `coupon_redemptions` list.
- * Changed Coupon Redemption response format:
- * Removed `expired_at`. Use `removed_at` instead.
-
- ### v2016-04-27
- * Changed Invoice, Transaction, Subscription response formats:
- * Added `account` object.
- * Removed `account_id`. Use `account.id` instead.
- * Changed Line Item response format:
- * Added `account` object.
- * Removed `account_id` and `account_code`. Use `account.id` and `account.code` instead.
-
- ### v2016-03-01
- * Added `PUT /sites/{site_id}/subscriptions/{subscription_id}/cancel` to cancel a subscription.
- * Added `PUT /sites/{site_id}/subscriptions/{subscription_id}/reactivate` to reactivate a canceled subscription.
- * Changed `PUT /sites/{site_id}/subscriptions/{subscription_id}` to no longer allow `state` parameter changes. Use the new `cancel` or `reactivate` methods instead.
- * Changed `DELETE /sites/{site_id}/subscriptions/{subscription_id}` to accept a `refund` parameter.
- * Changed Line Item response format: added `account_code`.
- * Changed Subscription response format: added `pending_change` object.
-
- ### v2016-01-01 (Removed)
-
- ### v2014-06-22 (Removed)
+ A list of changes for this version can be found [in the changelog](https://developers.recurly.com/api/changelog.html#v2019-10-10).
version: v2019-10-10
security:
- api_key: []
x-tagGroups:
- name: Customers
@@ -728,11 +186,11 @@
- name: item
x-displayName: Item
description: |-
For merchants who sell the same things to many customers, documenting those offerings in a catalog allows for faster charge creation, easier management of offerings, and analytics about your offerings across all sales channels. Because your offerings can be physical, digital, or service-oriented, Recurly collectively calls these offerings "Items".
- Recurly's item catalog is currently in the beta testing phase. If you're interested in participating in the beta, please contact Recurly Support to enable this feature on your site.
+ Recurly's item catalog requires the Credit Invoices and Subscription Billing Terms features to be enabled.
- name: plan
x-displayName: Plan
description: A plan tells Recurly how often and how much to charge your customers.
Plans can be created with free trials, optional products (called add-ons), setup
fees, and more.
@@ -844,38 +302,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var sites = client.ListSites(limit: 200);
+ foreach(Site site in sites)
+ {
+ Console.WriteLine(site.Subdomain);
+ }
+ - lang: Node.js
+ source: |
+ const sites = client.listSites({ limit: 200 })
+
+ for await (const site of sites.each()) {
+ console.log(site.subdomain)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Site> sites = client.listSites(params);
for (Site site : sites) {
System.out.println(site.getSubdomain());
}
- - lang: ".NET"
- source: |
- var sites = client.ListSites(limit: 200);
- foreach(Site site in sites)
- {
- Console.WriteLine(site.Subdomain);
- }
- lang: Ruby
source: |
sites = @client.list_sites(limit: 200)
sites.each do |site|
puts "Site: #{site.subdomain}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const sites = client.listSites({ limit: 200 })
+ $params = ['limit' => 200];
+ $sites = $client->listSites($params);
- for await (const site of sites.each()) {
- console.log(site.subdomain)
+ foreach($sites as $site) {
+ echo 'Site: ' . $site->getSubdomain() . PHP_EOL;
}
- lang: Python
source: |
sites = client.list_sites(limit=200).items()
for site in sites:
@@ -905,11 +371,27 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $site = $client->getSite($site_id);
+
+ echo 'Got Site:' . PHP_EOL;
+ var_dump($site);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
"/sites/{site_id}/accounts":
get:
tags:
- account
operationId: list_accounts
@@ -949,38 +431,48 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var accounts = client.ListAccounts(limit: 200);
+ foreach(Account account in accounts)
+ {
+ Console.WriteLine(account.Code);
+ }
+ - lang: Node.js
+ source: |
+ const accounts = client.listAccounts({ limit: 200 })
+
+ for await (const account of accounts.each()) {
+ console.log(account.code)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
Pager<Account> accounts = client.listAccounts(params);
for (Account acct : accounts) {
System.out.println(acct.getCode());
}
- - lang: ".NET"
- source: |
- var accounts = client.ListAccounts(limit: 200);
- foreach(Account account in accounts)
- {
- Console.WriteLine(account.Code);
- }
- lang: Ruby
source: |
accounts = @client.list_accounts(limit: 200)
accounts.each do |account|
puts "Account: #{account.code}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const accounts = client.listAccounts({ limit: 200 })
+ $params = [
+ 'limit' => 200,
+ ];
+ $accounts = $client->listAccounts($params);
- for await (const account of accounts.each()) {
- console.log(account.code)
+ foreach($accounts as $account) {
+ echo 'Account code: ' . $account->getCode() . PHP_EOL;
}
- lang: Python
source: |
accounts = client.list_accounts(limit=200).items()
for account in accounts:
@@ -1029,38 +521,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- AccountCreate accountReq = new AccountCreate();
- Address address = new Address();
-
- accountReq.setCode(accountCode);
- accountReq.setFirstName("Aaron");
- accountReq.setLastName("Du Monde");
-
- address.setStreet1("900 Camp St.");
- address.setCity("New Orleans");
- address.setRegion("LA");
- address.setCountry("US");
- address.setPostalCode("70115");
-
- accountReq.setAddress(address);
-
- Account account = client.createAccount(accountReq);
- System.out.println("Created account " + account.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var accountReq = new AccountCreate()
@@ -1089,10 +553,66 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const accountCreate = {
+ code: accountCode,
+ firstName: 'Benjamin',
+ lastName: 'Du Monde',
+ address: {
+ street1: '900 Camp St',
+ city: 'New Orleans',
+ region: 'LA',
+ postalCode: '70115',
+ country: 'US'
+ }
+ }
+ const account = await client.createAccount(accountCreate)
+ console.log('Created Account: ', account.code)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ AccountCreate accountReq = new AccountCreate();
+ Address address = new Address();
+
+ accountReq.setCode(accountCode);
+ accountReq.setFirstName("Aaron");
+ accountReq.setLastName("Du Monde");
+
+ address.setStreet1("900 Camp St.");
+ address.setCity("New Orleans");
+ address.setRegion("LA");
+ address.setCountry("US");
+ address.setPostalCode("70115");
+
+ accountReq.setAddress(address);
+
+ Account account = client.createAccount(accountReq);
+ System.out.println("Created account " + account.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
account_create = {
code: account_code,
@@ -1125,37 +645,42 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const accountCreate = {
- code: accountCode,
- firstName: 'Benjamin',
- lastName: 'Du Monde',
- address: {
- street1: '900 Camp St',
- city: 'New Orleans',
- region: 'LA',
- postalCode: '70115',
- country: 'US'
- }
- }
- const account = await client.createAccount(accountCreate)
- console.log('Created Account: ', account.code)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $account_create = array(
+ "code" => $account_code,
+ "first_name" => "Douglas",
+ "last_name" => "DuMonde",
+ "shipping_addresses" => [
+ [
+ "first_name" => "Douglas",
+ "last_name" => "DuMonde",
+ "nickname" => "nola",
+ "street1" => "1 Tchoupitoulas",
+ "city" => "New Orleans",
+ "postal_code" => "70130",
+ "country" => "US"
+ ]
+ ]
+ );
+
+ $account = $client->createAccount($account_create);
+
+ echo 'Created Account:' . PHP_EOL;
+ var_dump($account);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
account_create = {
@@ -1209,23 +734,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Account account = client.getAccount(accountId);
- System.out.println("Fetched account: " + account.getCode());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Account account = client.GetAccount(accountId);
@@ -1240,20 +752,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- account = @client.get_account(account_id: account_id)
- puts "Got Account #{account}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const account = await client.getAccount(accountId)
console.log('Fetched account: ', account.code)
@@ -1266,10 +768,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Account account = client.getAccount(accountId);
+ System.out.println("Fetched account: " + account.getCode());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ account = @client.get_account(account_id: account_id)
+ puts "Got Account #{account}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $account = $client->getAccount($account_id);
+
+ echo 'Got Account:' . PHP_EOL;
+ var_dump($account);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
account = client.get_account(account_id)
print("Got Account %s" % account)
@@ -1319,29 +860,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AccountUpdate accountUpdate = new AccountUpdate();
- accountUpdate.setFirstName("Aaron");
- accountUpdate.setLastName("Du Monde");
-
- final Account account = client.updateAccount(accountId, accountUpdate);
- System.out.println("Updated account: " + account.getCode());
- System.out.println(account.getFirstName());
- System.out.println(account.getLastName());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var accountReq = new AccountUpdate() {
@@ -1361,10 +883,49 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const accountUpdate = {
+ firstName: 'Aaron',
+ lastName: 'Du Monde'
+ }
+ const account = await client.updateAccount(accountId, accountUpdate)
+ console.log('Updated account: ', account)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final AccountUpdate accountUpdate = new AccountUpdate();
+ accountUpdate.setFirstName("Aaron");
+ accountUpdate.setLastName("Du Monde");
+
+ final Account account = client.updateAccount(accountId, accountUpdate);
+ System.out.println("Updated account: " + account.getCode());
+ System.out.println(account.getFirstName());
+ System.out.println(account.getLastName());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
account_update = {
first_name: "Aaron",
@@ -1378,29 +939,30 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const accountUpdate = {
- firstName: 'Aaron',
- lastName: 'Du Monde'
- }
- const account = await client.updateAccount(accountId, accountUpdate)
- console.log('Updated account: ', account)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $account_update = array(
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde",
+ );
+
+ $account = $client->updateAccount($account_id, $account_update);
+
+ echo 'Updated Account:' . PHP_EOL;
+ var_dump($account);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
account_update = {"first_name": "Aaron", "last_name": "Du Monde"}
@@ -1438,23 +1000,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- Account account = client.deactivateAccount(accountId);
- System.out.println("deactivated account " + account.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Account account = client.DeactivateAccount(accountId);
@@ -1469,20 +1018,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- account = @client.deactivate_account(account_id: account_id)
- puts "Deactivated Account #{account}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const account = await client.deactivateAccount(accountId)
console.log('Deleted account: ', account.code)
@@ -1494,10 +1033,49 @@
}
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
throw err
}
+ - lang: Java
+ source: |
+ try {
+ Account account = client.deactivateAccount(accountId);
+ System.out.println("deactivated account " + account.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ account = @client.deactivate_account(account_id: account_id)
+ puts "Deactivated Account #{account}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $account = $client->deactivateAccount($account_id);
+
+ echo 'Deactivated Account:' . PHP_EOL;
+ var_dump($account);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
account = client.deactivate_account(account_id)
print("Deactivated Account %s" % account)
@@ -1528,23 +1106,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AccountAcquisition acquisition = client.getAccountAcquisition(accountId);
- System.out.println("Fetched account acquisition " + acquisition.getId());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
AccountAcquisition acquisition = client.GetAccountAcquisition(accountId);
@@ -1559,20 +1124,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- @client.get_account_acquisition(account_id: account_id)
- puts "Got AccountAcquisition"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const acquisition = await client.getAccountAcquisition(accountId)
console.log('Fetched account acquisition: ', acquisition.id)
@@ -1585,10 +1140,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final AccountAcquisition acquisition = client.getAccountAcquisition(accountId);
+ System.out.println("Fetched account acquisition " + acquisition.getId());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ @client.get_account_acquisition(account_id: account_id)
+ puts "Got AccountAcquisition"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $acquisition = $client->getAccountAcquisition($account_id);
+
+ echo 'Got Account Acquisition:' . PHP_EOL;
+ var_dump($acquisition);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
acquisition = client.get_account_acquisition(account_id)
print("Got AccountAcquisition %s" % acquisition)
@@ -1632,28 +1226,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AccountAcquisitionUpdatable acqUpdate = new AccountAcquisitionUpdatable();
- acqUpdate.setCampaign("big-event-campaign");
- acqUpdate.setChannel("social_media");
- acqUpdate.setSubchannel("twitter");
-
- final AccountAcquisition accountAcquisition = client.updateAccountAcquisition(accountId, acqUpdate);
- System.out.println(accountAcquisition);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var acquisitionReq = new AccountAcquisitionUpdatable()
@@ -1695,10 +1271,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final AccountAcquisitionUpdatable acqUpdate = new AccountAcquisitionUpdatable();
+ acqUpdate.setCampaign("big-event-campaign");
+ acqUpdate.setChannel("social_media");
+ acqUpdate.setSubchannel("twitter");
+
+ final AccountAcquisition accountAcquisition = client.updateAccountAcquisition(accountId, acqUpdate);
+ System.out.println(accountAcquisition);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Php
+ source: |
+ try {
+ $acquisition_update = array(
+ "campaign" => "big-event-campaign",
+ "channel" => "social_media",
+ "subchannel" => "twitter"
+ );
+ $acquisition = $client->updateAccountAcquisition($account_id, $acquisition_update);
+
+ echo 'Updated AccountAcquisition:' . PHP_EOL;
+ var_dump($acquisition);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
acquisition_update = {
"campaign": "podcast-marketing",
@@ -1727,23 +1342,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- client.removeAccountAcquisition(accountId);
- System.out.println("Removed account acquisition from account " + accountId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
client.RemoveAccountAcquisition(accountId);
@@ -1758,20 +1360,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- acquisition = @client.remove_account_acquisition(account_id: account_id)
- puts "Removed AccountAcqusition #{acquisition}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
await client.removeAccountAcquisition(accountId)
console.log('Removed account acquisition from account: ', accountId)
@@ -1784,10 +1376,47 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ client.removeAccountAcquisition(accountId);
+ System.out.println("Removed account acquisition from account " + accountId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ acquisition = @client.remove_account_acquisition(account_id: account_id)
+ puts "Removed AccountAcqusition #{acquisition}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |-
+ try {
+ $client->removeAccountAcquisition($account_id);
+ echo "Removed Account Acquisition:" . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
client.remove_account_acquisition(account_id)
print("Removed AccountAcquisition for Account id=%s" % account_id)
@@ -1830,23 +1459,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Account account = client.reactivateAccount(accountId);
- System.out.println("Reactivated account: " + account.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Account account = client.ReactivateAccount(accountId);
@@ -1861,20 +1477,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- account = @client.reactivate_account(account_id: account_id)
- puts "Reactivated account #{account}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const account = await client.reactivateAccount(accountId)
console.log('Reactivated account: ', account.code)
@@ -1886,10 +1492,49 @@
}
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
throw err
}
+ - lang: Java
+ source: |
+ try {
+ final Account account = client.reactivateAccount(accountId);
+ System.out.println("Reactivated account: " + account.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ account = @client.reactivate_account(account_id: account_id)
+ puts "Reactivated account #{account}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $account = $client->reactivateAccount($account_id);
+
+ echo 'Reactivated Account:' . PHP_EOL;
+ var_dump($account);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
account = client.reactivate_account(account_id)
print("Reactivated Account %s" % account)
@@ -1924,23 +1569,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AccountBalance balance = client.getAccountBalance(accountId);
- System.out.println("Fetched account balance " + balance.getBalances());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
AccountBalance balance = client.GetAccountBalance(accountId);
@@ -1955,20 +1587,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- balance = @client.get_account_balance(account_id: account_id)
- puts "Got AccountBalance #{balance}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const balance = await client.getAccountBalance(accountId)
console.log('Fetched account balance: ', balance.balances)
@@ -1981,10 +1603,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final AccountBalance balance = client.getAccountBalance(accountId);
+ System.out.println("Fetched account balance " + balance.getBalances());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ balance = @client.get_account_balance(account_id: account_id)
+ puts "Got AccountBalance #{balance}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $balance = $client->getAccountBalance($account_id);
+
+ echo 'Got Account Balance:' . PHP_EOL;
+ var_dump($balance);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
balance = client.get_account_balance(account_id)
print("Got AccountBalance %s" % balance)
@@ -2021,23 +1682,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final BillingInfo billingInfo = client.getBillingInfo(accountId);
- System.out.println("Fetched billing info " + billingInfo.getId());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
BillingInfo billingInfo = client.GetBillingInfo(accountId);
@@ -2052,20 +1700,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- billing = @client.get_billing_info(account_id: account_id)
- puts "Got BillingInfo #{billing}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const billingInfo = await client.getBillingInfo(accountId)
console.log('Fetched Billing Info: ', billingInfo.id)
@@ -2078,10 +1716,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final BillingInfo billingInfo = client.getBillingInfo(accountId);
+ System.out.println("Fetched billing info " + billingInfo.getId());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ billing = @client.get_billing_info(account_id: account_id)
+ puts "Got BillingInfo #{billing}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $binfo = $client->getBillingInfo($account_id);
+
+ echo 'Got BillingInfo:' . PHP_EOL;
+ var_dump($binfo);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
binfo = client.get_billing_info(account_id)
print("Got BillingInfo %s" % binfo)
@@ -2094,21 +1771,23 @@
- account
- billing_info
operationId: update_billing_info
summary: Set an account's billing information
description: |
- If you're using Recurly.js to securely submit data from webforms without sending it through your server, you can associate the billing information with an account by passing in the `token_id`.
+ If you're using Recurly.js to securely submit data from webforms without sending it through your server,
+ you can associate the billing information with an account by passing in the `token_id`. Be sure to only
+ set this field.
For credit card payments you'll need the following required fields:
- first_name
- last_name
- number
- month
- year
- For tokenized payments you'll need the following required fields:
+ For external (not Recurly.js) tokenized payments you'll need the following required fields:
- first_name
- last_name
- gateway_token
- gateway_code
@@ -2146,27 +1825,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/ErrorMayHaveTransaction"
x-code-samples:
- - lang: Java
- source: |
- try {
- final BillingInfoCreate billingUpdate = new BillingInfoCreate();
- billingUpdate.setFirstName("Aaron");
- billingUpdate.setLastName("Du Monde");
-
- final BillingInfo billingInfo = client.updateBillingInfo(accountId, billingUpdate);
- System.out.println("Updated billing info " + billingInfo.getId());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var billingReq = new BillingInfoCreate() {
@@ -2185,10 +1847,47 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const billingInfoUpdate = {
+ firstName: 'Aaron',
+ lastName: 'Du Monde',
+ }
+ const billingInfo = await client.updateBillingInfo(accountId, billingInfoUpdate)
+ console.log('Updated billing info: ', billingInfo.id)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final BillingInfoCreate billingUpdate = new BillingInfoCreate();
+ billingUpdate.setFirstName("Aaron");
+ billingUpdate.setLastName("Du Monde");
+
+ final BillingInfo billingInfo = client.updateBillingInfo(accountId, billingUpdate);
+ System.out.println("Updated billing info " + billingInfo.getId());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
billing_update = {
first_name: "Aaron",
@@ -2202,29 +1901,29 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const billingInfoUpdate = {
- firstName: 'Aaron',
- lastName: 'Du Monde',
- }
- const billingInfo = await client.updateBillingInfo(accountId, billingInfoUpdate)
- console.log('Updated billing info: ', billingInfo.id)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $binfo_update = array(
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde",
+ );
+ $binfo = $client->updateBillingInfo($account_id, $binfo_update);
+
+ echo 'Updated BillingInfo:' . PHP_EOL;
+ var_dump($binfo);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
billing_update = {"first_name": "Aaron", "last_name": "Du Monde"}
@@ -2256,23 +1955,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- client.removeBillingInfo(accountId);
- System.out.println("Removed billing info from account " + accountId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
client.RemoveBillingInfo(accountId);
@@ -2287,20 +1973,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- @client.remove_billing_info(account_id: account_id)
- puts "Removed BillingInfo #{account_id}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
client.removeBillingInfo(accountId)
console.log('Removed billing info from account: ', accountId)
@@ -2313,10 +1989,47 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ client.removeBillingInfo(accountId);
+ System.out.println("Removed billing info from account " + accountId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ @client.remove_billing_info(account_id: account_id)
+ puts "Removed BillingInfo #{account_id}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |-
+ try {
+ $client->removeBillingInfo($account_id);
+ echo "Removed Billing Info: " . $account_id . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
client.remove_billing_info(account_id)
print("Removed BillingInfo for Account id=%s" % account_id)
@@ -2374,10 +2087,18 @@
limit: 200
)
redemptions.each do |redemption|
puts "CouponRedemption: #{redemption.id}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $account_coupon_redemptions = $client->listAccountCouponRedemptions($account->getId(), $params);
+
+ foreach($account_coupon_redemptions as $coupon_redemption) {
+ echo 'Coupon redemption: ' . $coupon_redemption->getId() . PHP_EOL;
+ }
- lang: Python
source: |
redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items()
for redemption in redemptions:
print(redemption.id)
@@ -2409,23 +2130,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final CouponRedemption redemption = client.getActiveCouponRedemption(accountId);
- System.out.println("Fetched coupon redemption " + redemption.getId());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
CouponRedemption redemption = client.GetActiveCouponRedemption(accountId);
@@ -2440,20 +2148,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- redemption = @client.get_active_coupon_redemption(account_id: account_id)
- puts "Got CouponRedemption #{redemption}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const redemption = await client.getActiveCouponRedemption(accountId)
console.log('Fetched coupon redemption: ', redemption.id)
@@ -2466,10 +2164,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final CouponRedemption redemption = client.getActiveCouponRedemption(accountId);
+ System.out.println("Fetched coupon redemption " + redemption.getId());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ redemption = @client.get_active_coupon_redemption(account_id: account_id)
+ puts "Got CouponRedemption #{redemption}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $redemption = $client->getActiveCouponRedemption($account_id);
+
+ echo 'Got Redemption:' . PHP_EOL;
+ var_dump($redemption);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
redemption = client.get_active_coupon_redemption(account_id)
print("Got Redemption %s" % redemption)
@@ -2549,10 +2286,29 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
+ - lang: Php
+ source: |-
+ try {
+ $redemption_create = array(
+ "currency" => "USD",
+ "coupon_id" => "code-$coupon_code"
+ );
+ $redemption = $client->createCouponRedemption($account_id, $redemption_create);
+ echo "Created Redemption:" . PHP_EOL;
+ var_dump($redemption);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
redemption_create = {"currency": "USD", "coupon_id": coupon_id}
redemption = client.create_coupon_redemption(account_id, redemption_create)
@@ -2612,10 +2368,25 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
+ - lang: Php
+ source: |-
+ try {
+ $redemption = $client->removeCouponRedemption($account_id);
+ echo "Removed Active Coupon Redemption:" . PHP_EOL;
+ var_dump($redemption);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
client.remove_coupon_redemption(account_id)
print("Removed Redemption from Account id=%s" % account_id)
@@ -2662,41 +2433,49 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var payments = client.ListAccountCreditPayments(accountId, limit: 200);
+ foreach(CreditPayment payment in payments)
+ {
+ Console.WriteLine(payment.Uuid);
+ }
+ - lang: Node.js
+ source: |
+ const payments = client.listAccountCreditPayments(accountId, { limit: 200 })
+
+ for await (const payment of payments.each()) {
+ console.log(payment.uuid)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
Pager<CreditPayment> payments = client.listAccountCreditPayments(accountId, params);
for (CreditPayment payment : payments) {
System.out.println(payment.getUuid());
}
- - lang: ".NET"
- source: |
- var payments = client.ListAccountCreditPayments(accountId, limit: 200);
- foreach(CreditPayment payment in payments)
- {
- Console.WriteLine(payment.Uuid);
- }
- lang: Ruby
source: |
payments = @client.list_account_credit_payments(
account_id: account_id,
limit: 200
)
payments.each do |payment|
puts "CreditPayment: #{payment.id}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const payments = client.listAccountCreditPayments(accountId, { limit: 200 })
+ $params = ['limit' => 200];
+ $credit_payments = $client->listAccountCreditPayments($account->getId(), $params);
- for await (const payment of payments.each()) {
- console.log(payment.uuid)
+ foreach($credit_payments as $payment) {
+ echo 'Credit Payment: ' . $payment->getId() . PHP_EOL;
}
- lang: Python
source: |
payments = client.list_account_credit_payments(account_id, limit=200).items()
for payment in payments:
@@ -2760,10 +2539,17 @@
limit: 200
)
invoices.each do |invoice|
puts "Invoice: #{invoice.number}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 10];
+ $invoices = $client->listAccountInvoices($account->getId(), $params);
+ foreach($invoices as $invoice) {
+ echo 'Account invoice: ' . $invoice->getNumber() . PHP_EOL;
+ }
- lang: Python
source: |
invoices = client.list_account_invoices(account_id, limit=200).items()
for invoice in invoices:
print(invoice.number)
@@ -2813,29 +2599,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- InvoiceCreate invoiceCreate = new InvoiceCreate();
- invoiceCreate.setCurrency("USD");
- invoiceCreate.setCollectionMethod("automatic");
-
- InvoiceCollection collection = client.createInvoice(accountId, invoiceCreate);
- System.out.println("Created Invoice");
- System.out.println(collection.getChargeInvoice());
- System.out.println(collection.getCreditInvoices());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
// creates an invoice based on pending charges or credits on account
@@ -2857,10 +2624,51 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let invoiceCreate = {
+ currency: 'USD',
+ collectionMethod: 'automatic'
+ }
+ let invoiceCollection = await client.createInvoice(accountId, invoiceCreate)
+ console.log('Created Invoice')
+ console.log('Charge Invoice: ', invoiceCollection.chargeInvoice)
+ console.log('Credit Invoices: ', invoiceCollection.creditInvoices)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ InvoiceCreate invoiceCreate = new InvoiceCreate();
+ invoiceCreate.setCurrency("USD");
+ invoiceCreate.setCollectionMethod("automatic");
+
+ InvoiceCollection collection = client.createInvoice(accountId, invoiceCreate);
+ System.out.println("Created Invoice");
+ System.out.println(collection.getChargeInvoice());
+ System.out.println(collection.getCreditInvoices());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
invoice_create = {
currency: 'USD',
@@ -2874,31 +2682,31 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
- source: |
+ - lang: Php
+ source: |-
try {
- let invoiceCreate = {
- currency: 'USD',
- collectionMethod: 'automatic'
- }
- let invoiceCollection = await client.createInvoice(accountId, invoiceCreate)
- console.log('Created Invoice')
- console.log('Charge Invoice: ', invoiceCollection.chargeInvoice)
- console.log('Credit Invoices: ', invoiceCollection.creditInvoices)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $invoice_create = array(
+ "currency" => "USD",
+ "collection_method" => "automatic"
+ );
+ $invoice_collection = $client->createInvoice(
+ $account_id,
+ $invoice_create
+ );
+ echo "Created Invoice:" . PHP_EOL;
+ var_dump($invoice_collection);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
invoice_create = {"currency": "USD", "collection_method": "automatic"}
@@ -2955,29 +2763,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- InvoiceCreate invoiceCreate = new InvoiceCreate();
- invoiceCreate.setCurrency("USD");
- invoiceCreate.setCollectionMethod("automatic");
-
- InvoiceCollection collection = client.previewInvoice(accountId, invoiceCreate);
- System.out.println("Previewed Invoice due at " + collection.getChargeInvoice().getDueAt());
- System.out.println(collection.getChargeInvoice());
- System.out.println(collection.getCreditInvoices());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
// creates a preview invoice based on pending charges or credits on account
@@ -2999,10 +2788,51 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const collection = await client.previewInvoice(accountId, {
+ currency: "USD",
+ collectionMethod: "automatic"
+ })
+ console.log(`Previewed invoice due at ${collection.chargeInvoice.dueAt}`)
+ console.log(collection.chargeInvoice)
+ console.log(collection.creditInvoices)
+ } catch(err) {
+
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ InvoiceCreate invoiceCreate = new InvoiceCreate();
+ invoiceCreate.setCurrency("USD");
+ invoiceCreate.setCollectionMethod("automatic");
+
+ InvoiceCollection collection = client.previewInvoice(accountId, invoiceCreate);
+ System.out.println("Previewed Invoice due at " + collection.getChargeInvoice().getDueAt());
+ System.out.println(collection.getChargeInvoice());
+ System.out.println(collection.getCreditInvoices());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
invoice_preview = {
currency: "USD",
@@ -3016,31 +2846,31 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
- source: |
+ - lang: Php
+ source: |-
try {
- const collection = await client.previewInvoice(accountId, {
- currency: "USD",
- collectionMethod: "automatic"
- })
- console.log(`Previewed invoice due at ${collection.chargeInvoice.dueAt}`)
- console.log(collection.chargeInvoice)
- console.log(collection.creditInvoices)
- } catch(err) {
-
- if (err instanceof recurly.errors.ValidationError) {
+ $invoice_preview = array(
+ "currency" => "USD",
+ "collection_method" => "automatic"
+ );
+ $invoice_collection = $client->previewInvoice(
+ $account_id,
+ $invoice_preview
+ );
+ echo "Previewed Invoice:" . PHP_EOL;
+ var_dump($invoice_collection);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
invoice_preview = {"currency": "USD", "collection_method": "automatic"}
@@ -3112,10 +2942,18 @@
limit: 200
)
line_items.each do |line_item|
puts "LineItem: #{line_item.id}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $account_line_items = $client->listAccountLineItems($account_id, $params);
+
+ foreach($account_line_items as $line_item) {
+ echo 'Account line item: ' . $line_item->getId() . PHP_EOL;
+ }
- lang: Python
source: |
line_items = client.list_account_line_items(account_id, limit=200).items()
for line_item in line_items:
print(line_item.id)
@@ -3158,28 +2996,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- LineItemCreate lineItemCreate = new LineItemCreate();
- lineItemCreate.setCurrency("USD");
- lineItemCreate.setUnitAmount(1000.0f);
- lineItemCreate.setType("charge"); // choose "credit" for a credit
-
- LineItem lineItem = client.createLineItem(accountId, lineItemCreate);
- System.out.println("Created line item " + lineItem.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
// creates a pending charge or credit on the account
@@ -3201,10 +3021,49 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let lineItemReq = {
+ currency: 'USD',
+ unitAmount: 1000,
+ type: 'charge' // choose "credit" for a credit
+ }
+ let lineItem = await client.createLineItem(accountId, lineItemReq)
+ console.log('Created Line Item: ', lineItem.uuid)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ LineItemCreate lineItemCreate = new LineItemCreate();
+ lineItemCreate.setCurrency("USD");
+ lineItemCreate.setUnitAmount(1000.0f);
+ lineItemCreate.setType("charge"); // choose "credit" for a credit
+
+ LineItem lineItem = client.createLineItem(accountId, lineItemCreate);
+ System.out.println("Created line item " + lineItem.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
line_item_create = {
currency: 'USD',
@@ -3219,30 +3078,32 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
- source: |
+ - lang: Php
+ source: |-
try {
- let lineItemReq = {
- currency: 'USD',
- unitAmount: 1000,
- type: 'charge' // choose "credit" for a credit
- }
- let lineItem = await client.createLineItem(accountId, lineItemReq)
- console.log('Created Line Item: ', lineItem.uuid)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $line_item_create = [
+ 'currency' => 'USD',
+ 'unit_amount' => 1000,
+ 'type' => 'charge'
+ ];
+ $line_item = $client->createLineItem(
+ $account->getId(),
+ $line_item_create
+ );
+ echo 'Created Line Item:' . PHP_EOL;
+ var_dump($line_item);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
line_item_create = {
@@ -3286,38 +3147,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var notes = client.ListAccountNotes(accountId);
+ foreach(AccountNote note in notes)
+ {
+ Console.WriteLine(note.Message);
+ }
+ - lang: Node.js
+ source: |
+ const notes = client.listAccountNotes(accountId, { limit: 200 })
+
+ for await (const note of notes.each()) {
+ console.log(note.message)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<AccountNote> notes = client.listAccountNotes(accountId, params);
for (AccountNote note : notes) {
System.out.println(note.getMessage());
}
- - lang: ".NET"
- source: |
- var notes = client.ListAccountNotes(accountId);
- foreach(AccountNote note in notes)
- {
- Console.WriteLine(note.Message);
- }
- lang: Ruby
source: |
account_notes = @client.list_account_notes(account_id: account_id, limit: 200)
account_notes.each do |note|
puts "AccountNote: #{note.message}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const notes = client.listAccountNotes(accountId, { limit: 200 })
+ $params = ['limit' => 200];
+ $account_notes = $client->listAccountNotes($account_id, $params);
- for await (const note of notes.each()) {
- console.log(note.message)
+ foreach($account_notes as $note) {
+ echo 'Account note: ' . $note->getMessage() . PHP_EOL;
}
- lang: Python
source: |
line_items = client.list_account_line_items(account_id, limit=200).items()
for line_item in line_items:
@@ -3356,23 +3225,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AccountNote note = client.getAccountNote(accountId, accountNoteId);
- System.out.println("Fetched account note: " + note.getMessage());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
AccountNote note = client.GetAccountNote(accountId, accountNoteId);
@@ -3387,23 +3243,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- note = @client.get_account_note(
- account_id: account_id,
- account_note_id: note_id
- )
- puts "Got AccountNote #{note}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
console.log(accountId)
const note = await client.getAccountNote(accountId, accountNoteId)
@@ -3417,10 +3260,52 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final AccountNote note = client.getAccountNote(accountId, accountNoteId);
+ System.out.println("Fetched account note: " + note.getMessage());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ note = @client.get_account_note(
+ account_id: account_id,
+ account_note_id: note_id
+ )
+ puts "Got AccountNote #{note}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $note = $client->getAccountNote($account_id, $account_node_id);
+
+ echo 'Got Account Note:' . PHP_EOL;
+ var_dump($note);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
note = client.get_account_note(account_id, note_id)
print("Got AccountNote %s" % note)
@@ -3462,42 +3347,42 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var addresses = client.ListShippingAddresses(accountId);
+ foreach(ShippingAddress address in addresses)
+ {
+ Console.WriteLine(address.Street1);
+ }
+ - lang: Node.js
+ source: |
+ const addresses = client.listShippingAddresses(accountId, { limit: 200 })
+
+ for await (const address of addresses.each()) {
+ console.log(address.street1)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<ShippingAddress> addresses = client.listShippingAddresses(accountId, params);
for (ShippingAddress address : addresses) {
System.out.println(address.getStreet1());
}
- - lang: ".NET"
- source: |
- var addresses = client.ListShippingAddresses(accountId);
- foreach(ShippingAddress address in addresses)
- {
- Console.WriteLine(address.Street1);
- }
- lang: Ruby
source: |
shipping_addresses = @client.list_shipping_addresses(
account_id: account_id,
limit: 200
)
shipping_addresses.each do |addr|
puts "ShippingAddress: #{addr.nickname} - #{addr.street1}"
end
- - lang: Node.js
- source: |
- const addresses = client.listShippingAddresses(accountId, { limit: 200 })
-
- for await (const address of addresses.each()) {
- console.log(address.street1)
- }
- lang: Python
source: |
shipping_addresses = client.list_shipping_addresses(account_id).items()
for shipping_address in shipping_addresses:
print(shipping_address.id)
@@ -3540,32 +3425,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- ShippingAddressCreate shippingAddressCreate = new ShippingAddressCreate();
- shippingAddressCreate.setFirstName("Aaron");
- shippingAddressCreate.setLastName("Du Monde");
- shippingAddressCreate.setStreet1("900 Camp St");
- shippingAddressCreate.setCity("New Orleans");
- shippingAddressCreate.setRegion("LA");
- shippingAddressCreate.setPostalCode("70115");
- shippingAddressCreate.setCountry("US");
-
- ShippingAddress shippingAddress = client.createShippingAddress(accountId, shippingAddressCreate);
- System.out.println("Created shipping address " + shippingAddress.getStreet1());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var addrReq = new ShippingAddressCreate()
@@ -3615,10 +3478,58 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ ShippingAddressCreate shippingAddressCreate = new ShippingAddressCreate();
+ shippingAddressCreate.setFirstName("Aaron");
+ shippingAddressCreate.setLastName("Du Monde");
+ shippingAddressCreate.setStreet1("900 Camp St");
+ shippingAddressCreate.setCity("New Orleans");
+ shippingAddressCreate.setRegion("LA");
+ shippingAddressCreate.setPostalCode("70115");
+ shippingAddressCreate.setCountry("US");
+
+ ShippingAddress shippingAddress = client.createShippingAddress(accountId, shippingAddressCreate);
+ System.out.println("Created shipping address " + shippingAddress.getStreet1());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Php
+ source: |
+ try {
+ $address_create = array(
+ "nickname" => "Work",
+ "street1" => "900 Camp St",
+ "city" => "New Orleans",
+ "region" => "LA",
+ "country" => "US",
+ "postal_code" => "70115",
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde"
+ );
+ $shipping_address = $client->createShippingAddress($account_id, $address_create);
+
+ echo "Created Shpping Address:" . PHP_EOL;
+ var_dump($shipping_address);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don"t know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
shipping_addr_create = {
"first_name": "Aaron",
@@ -3664,23 +3575,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final ShippingAddress address = client.getShippingAddress(accountId, shippingAddressId);
- System.out.println("Fetched shipping address " + address.getId());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
ShippingAddress address = client.GetShippingAddress(accountId, shippingAddressId);
@@ -3695,23 +3593,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- address = @client.get_shipping_address(
- account_id: account_id,
- shipping_address_id: shipping_address_id
- )
- puts "Got ShippingAddress #{address}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const address = await client.getShippingAddress(accountId, shippingAddressId)
console.log('Fetched shipping address: ', address.street1)
@@ -3724,10 +3609,52 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final ShippingAddress address = client.getShippingAddress(accountId, shippingAddressId);
+ System.out.println("Fetched shipping address " + address.getId());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ address = @client.get_shipping_address(
+ account_id: account_id,
+ shipping_address_id: shipping_address_id
+ )
+ puts "Got ShippingAddress #{address}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $shipping_address = $client->getShippingAddress($account_id, $shipping_address_id);
+
+ echo 'Got Shipping Address:' . PHP_EOL;
+ var_dump($shipping_address);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
subscription = client.get_subscription(subscription_id)
print("Got Subscription %s" % subscription)
@@ -3781,27 +3708,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final ShippingAddressUpdate shadUpdate = new ShippingAddressUpdate();
- shadUpdate.setFirstName("Aaron");
- shadUpdate.setLastName("Du Monde");
-
- final ShippingAddress address = client.updateShippingAddress(accountId, shippingAddressId, shadUpdate);
- System.out.println("Updated shipping address " + address.getStreet1());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var shadReq = new ShippingAddressUpdate()
@@ -3821,10 +3731,47 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const shadUpdate = {
+ firstName: "Benjamin",
+ lastName: "Du Monde"
+ }
+ const address = await client.updateShippingAddress(accountId, shippingAddressId, shadUpdate)
+ console.log('Updated shipping address: ', address.street1)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final ShippingAddressUpdate shadUpdate = new ShippingAddressUpdate();
+ shadUpdate.setFirstName("Aaron");
+ shadUpdate.setLastName("Du Monde");
+
+ final ShippingAddress address = client.updateShippingAddress(accountId, shippingAddressId, shadUpdate);
+ System.out.println("Updated shipping address " + address.getStreet1());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
address_update = {
first_name: "Aaron",
@@ -3840,29 +3787,29 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const shadUpdate = {
- firstName: "Benjamin",
- lastName: "Du Monde"
- }
- const address = await client.updateShippingAddress(accountId, shippingAddressId, shadUpdate)
- console.log('Updated shipping address: ', address.street1)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $shad_update = array(
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde",
+ );
+ $shad = $client->updateShippingAddress($account_id, $shipping_address_id, $shad_update);
+
+ echo 'Updated Shipping Address:' . PHP_EOL;
+ var_dump($shad);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
address_update = {
@@ -3897,23 +3844,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- client.removeShippingAddress(accountId, shippingAddressId);
- System.out.println("Removed shipping address " + shippingAddressId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
client.RemoveShippingAddress(accountId, shippingAddressId);
@@ -3928,10 +3862,39 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ await client.removeShippingAddress(accountId, shippingAddress.id)
+ console.log('Removed shipping address: ', shippingAddress.street1)
+ } catch (err) {
+ if (err instanceof recurly.errors.NotFoundError) {
+ // If the request was not found, you may want to alert the user or
+ // just return null
+ console.log('Resource Not Found')
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ client.removeShippingAddress(accountId, shippingAddressId);
+ System.out.println("Removed shipping address " + shippingAddressId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
@client.remove_shipping_address(
account_id: account_id,
@@ -3941,25 +3904,23 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
- source: |
+ - lang: Php
+ source: |-
try {
- await client.removeShippingAddress(accountId, shippingAddress.id)
- console.log('Removed shipping address: ', shippingAddress.street1)
- } catch (err) {
- if (err instanceof recurly.errors.NotFoundError) {
- // If the request was not found, you may want to alert the user or
- // just return null
- console.log('Resource Not Found')
- } else {
+ $client->removeShippingAddress($account_id, $shipping_address_id);
+ echo "Removed Shipping Address:" . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
client.remove_shipping_address(account_id, shipping_address_id)
@@ -4027,10 +3988,18 @@
limit: 200
)
subscriptions.each do |subscription|
puts "Subscription: #{subscription.uuid}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $account_subscriptions = $client->listAccountSubscriptions($account_id, $params);
+
+ foreach($account_subscriptions as $sub) {
+ echo 'Account subscription: ' . $sub->getUuid() . PHP_EOL;
+ }
"/sites/{site_id}/accounts/{account_id}/transactions":
get:
tags:
- account
- transaction
@@ -4089,10 +4058,18 @@
limit: 200
)
transactions.each do |transaction|
puts "Transaction: #{transaction.uuid}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $account_transactions = $client->listAccountTransactions($account_id, $params);
+
+ foreach($account_transactions as $transaction) {
+ echo 'Account transactions: ' . $transaction->getUuid() . PHP_EOL;
+ }
"/sites/{site_id}/accounts/{account_id}/accounts":
get:
tags:
- account
operationId: list_child_accounts
@@ -4142,10 +4119,18 @@
limit: 200
)
child_accounts.each do |child|
puts "Account: #{child.code}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $child_accounts = $client->listChildAccounts($account_id, $params);
+
+ foreach($child_accounts as $child_account) {
+ echo 'Child Account: ' . $child_account->getId() . PHP_EOL;
+ }
"/sites/{site_id}/acquisitions":
get:
tags:
- account_acquisition
operationId: list_account_acquisition
@@ -4188,10 +4173,18 @@
source: |
acquisitions = @client.list_account_acquisition(limit: 200)
acquisitions.each do |acquisition|
puts "AccountAcquisition: #{acquisition.cost}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $account_acquisition = $client->listAccountAcquisition($params);
+
+ foreach($account_acquisition as $aa) {
+ echo 'Account acquisition: ' . $aa->getId() . PHP_EOL;
+ }
- lang: Python
source: |
acquisitions = client.list_account_acquisition(limit=200).items()
for acquisition in acquisitions:
print(acquisition.id)
@@ -4233,38 +4226,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var coupons = client.ListCoupons(limit: 200);
+ foreach(Coupon coupon in coupons)
+ {
+ Console.WriteLine(coupon.Code);
+ }
+ - lang: Node.js
+ source: |
+ const coupons = client.listCoupons({ limit: 200 })
+
+ for await (const coupon of coupons.each()) {
+ console.log(coupon.code)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Coupon> coupons = client.listCoupons(params);
for (Coupon coupon : coupons) {
System.out.println(coupon.getCode());
}
- - lang: ".NET"
- source: |
- var coupons = client.ListCoupons(limit: 200);
- foreach(Coupon coupon in coupons)
- {
- Console.WriteLine(coupon.Code);
- }
- lang: Ruby
source: |
coupons = @client.list_coupons(limit: 200)
coupons.each do |coupon|
puts "coupon: #{coupon.code}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const coupons = client.listCoupons({ limit: 200 })
+ $params = ['limit' => 200];
+ $coupons = $client->listCoupons($params);
- for await (const coupon of coupons.each()) {
- console.log(coupon.code)
+ foreach($coupons as $coupon) {
+ echo 'Coupon: ' . $coupon->getCode() . PHP_EOL;
}
- lang: Python
source: |
coupons = client.list_coupons(limit=200).items()
for coupon in coupons:
@@ -4361,10 +4362,36 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
+ - lang: Php
+ source: |
+ try {
+ $coupon_create = array(
+ "name" => "Promotional Coupon",
+ "code" => $coupon_code,
+ "discount_type" => "fixed",
+ "currencies" => [
+ "currency" => "USD",
+ "discount" => 10
+ ]
+ );
+
+ $coupon = $client->createCoupon($coupon_create);
+
+ echo 'Created Coupon:' . PHP_EOL;
+ var_dump($coupon);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
coupon_create = {
"name": "Promotional Coupon",
@@ -4406,23 +4433,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Coupon coupon = client.getCoupon(couponId);
- System.out.println("Fetched coupon " + coupon.getCode());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Coupon coupon = client.GetCoupon(couponId);
@@ -4437,20 +4451,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- coupon = @client.get_coupon(coupon_id: coupon_id)
- puts "Got Coupon #{coupon}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const coupon = await client.getCoupon(couponId)
console.log('Fetched coupon: ', coupon.code)
@@ -4463,10 +4467,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Coupon coupon = client.getCoupon(couponId);
+ System.out.println("Fetched coupon " + coupon.getCode());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ coupon = @client.get_coupon(coupon_id: coupon_id)
+ puts "Got Coupon #{coupon}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $coupon = $client->getCoupon($coupon_id);
+
+ echo 'Got Coupon:' . PHP_EOL;
+ var_dump($coupon);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
coupon = client.get_coupon(coupon_id)
print("Got Coupon %s" % coupon)
@@ -4517,11 +4560,30 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $coupon_update = array(
+ "name" => "New Coupon Name"
+ );
+ $coupon = $client->updateCoupon($coupon_id, $coupon_update);
+
+ echo 'Updated Coupon:' . PHP_EOL;
+ var_dump($coupon);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
"/sites/{site_id}/coupons/{coupon_id}/generate":
post:
tags:
- coupon
- unique_coupon_code
@@ -4637,38 +4699,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var payments = client.ListCreditPayments(limit: 200);
+ foreach(CreditPayment payment in payments)
+ {
+ Console.WriteLine(payment.Uuid);
+ }
+ - lang: Node.js
+ source: |
+ const payments = client.listCreditPayments({ limit: 200 })
+
+ for await (const payment of payments.each()) {
+ console.log(payment.uuid)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<CreditPayment> payments = client.listCreditPayments(params);
for (CreditPayment payment : payments) {
System.out.println(payment.getUuid());
}
- - lang: ".NET"
- source: |
- var payments = client.ListCreditPayments(limit: 200);
- foreach(CreditPayment payment in payments)
- {
- Console.WriteLine(payment.Uuid);
- }
- lang: Ruby
source: |
payments = @client.list_credit_payments(limit: 200)
payments.each do |payment|
puts "CreditPayment: #{payment.id}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const payments = client.listCreditPayments({ limit: 200 })
+ $params = ['limit' => 200];
+ $credit_payments = $client->listCreditPayments($params);
- for await (const payment of payments.each()) {
- console.log(payment.uuid)
+ foreach($credit_payments as $payment) {
+ echo 'Credit Payment: ' . $payment->getId() . PHP_EOL;
}
"/sites/{site_id}/credit_payments/{credit_payment_id}":
get:
tags:
- credit_payment
@@ -4744,38 +4814,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var fields = client.ListCustomFieldDefinitions(limit: 200);
+ foreach(CustomFieldDefinition def in fields)
+ {
+ Console.WriteLine(def.DisplayName);
+ }
+ - lang: Node.js
+ source: |
+ const definitions = client.listCustomFieldDefinitions({ limit: 200 })
+
+ for await (const definition of definitions.each()) {
+ console.log(definition.displayName)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<CustomFieldDefinition> fields = client.listCustomFieldDefinitions(params);
for (CustomFieldDefinition field : fields) {
System.out.println(field.getDisplayName());
}
- - lang: ".NET"
- source: |
- var fields = client.ListCustomFieldDefinitions(limit: 200);
- foreach(CustomFieldDefinition def in fields)
- {
- Console.WriteLine(def.DisplayName);
- }
- lang: Ruby
source: |
custom_fields = @client.list_custom_field_definitions(limit: 200)
custom_fields.each do |field|
puts "CustomFieldDefinition: #{field.name}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const definitions = client.listCustomFieldDefinitions({ limit: 200 })
+ $params = ['limit' => 200];
+ $custom_field_definitions = $client->listCustomFieldDefinitions($params);
- for await (const definition of definitions.each()) {
- console.log(definition.displayName)
+ foreach($custom_field_definitions as $definition) {
+ echo 'Custom Field Definition: ' . $definition->getName() . PHP_EOL;
}
- lang: Python
source: |
custom_fields = client.list_custom_field_definitions(limit=200).items()
for custom_field in custom_fields:
@@ -4807,23 +4885,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final CustomFieldDefinition definition = client.getCustomFieldDefinition(definitionId);
- System.out.println("Fetched custom field definition " + definition.getDisplayName());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
CustomFieldDefinition definition = client.GetCustomFieldDefinition(definitionId);
@@ -4854,10 +4919,39 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final CustomFieldDefinition definition = client.getCustomFieldDefinition(definitionId);
+ System.out.println("Fetched custom field definition " + definition.getDisplayName());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Php
+ source: |
+ try {
+ $custom_field_def = $client->getCustomFieldDefinition($definition_id);
+
+ echo 'Got CustomFieldDefinition:' . PHP_EOL;
+ var_dump($custom_field_def);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
"/sites/{site_id}/items":
get:
tags:
- item
operationId: list_items
@@ -4895,38 +4989,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var items = client.ListItems(limit: 200);
+ foreach(Item item in items)
+ {
+ Console.WriteLine(item.Code);
+ }
+ - lang: Node.js
+ source: |
+ const items = client.listItems({ limit: 200 })
+
+ for await (const item of items.each()) {
+ console.log(item.code)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
Pager<Item> items = client.listItems(params);
for (Item item : items) {
System.out.println(item.getCode());
}
- - lang: ".NET"
- source: |
- var items = client.ListItems(limit: 200);
- foreach(Item item in items)
- {
- Console.WriteLine(item.Code);
- }
- lang: Ruby
source: |
items = @client.list_items(limit: 200)
items.each do |item|
puts "Item: #{item.code}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const items = client.listItems({ limit: 200 })
+ $params = ['limit' => 200];
+ $items = $client->listItems($params);
- for await (const item of items.each()) {
- console.log(item.code)
+ foreach($items as $item) {
+ echo 'Item: ' . $item->getCode() . PHP_EOL;
}
- lang: Python
source: |
items = client.list_items(limit=200).items()
for item in items:
@@ -4974,41 +5076,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- ItemCreate itemReq = new ItemCreate();
-
- itemReq.setCode(itemCode);
- itemReq.setName("Item Name");
- itemReq.setDescription("Item Description");
- itemReq.setExternalSku("a35JE-44");
- itemReq.setAccountingCode("item-code-127");
- itemReq.setRevenueScheduleType("at_range_end");
-
- List<CustomField> customFields = new ArrayList<>();
- CustomField customField = new CustomField();
- customField.setName("custom-field-1");
- customField.setValue("Custom Field 1 value");
- customFields.add(customField);
-
- itemReq.setCustomFields(customFields);
-
-
- Item item = client.createItem(itemReq);
- System.out.println("Created item " + item.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var itemReq = new ItemCreate()
@@ -5038,10 +5109,69 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const itemCreate = {
+ code: itemCode,
+ name: "Item Name",
+ description: "Item Description",
+ external_sku: "a35JE-44",
+ accounting_code: "item-code-127",
+ revenue_schedule_type: "at_range_end",
+ custom_fields: [{
+ name: "custom-field-1",
+ value: "Custom Field 1 value"
+ }]
+ }
+ const item = await client.createItem(itemCreate)
+ console.log('Created Item: ', item.code)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ ItemCreate itemReq = new ItemCreate();
+
+ itemReq.setCode(itemCode);
+ itemReq.setName("Item Name");
+ itemReq.setDescription("Item Description");
+ itemReq.setExternalSku("a35JE-44");
+ itemReq.setAccountingCode("item-code-127");
+ itemReq.setRevenueScheduleType("at_range_end");
+
+ List<CustomField> customFields = new ArrayList<>();
+ CustomField customField = new CustomField();
+ customField.setName("custom-field-1");
+ customField.setValue("Custom Field 1 value");
+ customFields.add(customField);
+
+ itemReq.setCustomFields(customFields);
+
+
+ Item item = client.createItem(itemReq);
+ System.out.println("Created item " + item.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
item_create = {
code: item_code,
@@ -5060,37 +5190,30 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const itemCreate = {
- code: itemCode,
- name: "Item Name",
- description: "Item Description",
- external_sku: "a35JE-44",
- accounting_code: "item-code-127",
- revenue_schedule_type: "at_range_end",
- custom_fields: [{
- name: "custom-field-1",
- value: "Custom Field 1 value"
- }]
- }
- const item = await client.createItem(itemCreate)
- console.log('Created Item: ', item.code)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $item_create = array(
+ "code" => $item_code,
+ "name" => "Coffee Grinder",
+ "description" => "A professional-grade bean grinder."
+ );
+ $item = $client->createItem($item_create);
+
+ echo 'Created Item:' . PHP_EOL;
+ var_dump($item);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
item_create = {
@@ -5139,23 +5262,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Item item = client.getItem(itemId);
- System.out.println("Fetched item: " + item.getCode());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Item item = client.GetItem(itemId);
@@ -5170,20 +5280,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- item = @client.get_item(item_id: item_id)
- puts "Got Item #{item}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const item = await client.getItem(itemId)
console.log('Fetched item: ', item.code)
@@ -5196,10 +5296,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Item item = client.getItem(itemId);
+ System.out.println("Fetched item: " + item.getCode());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ item = @client.get_item(item_id: item_id)
+ puts "Got Item #{item}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $item = $client->getItem($item_id);
+
+ echo 'Got Item:' . PHP_EOL;
+ var_dump($item);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
item = client.get_item(item_id)
print("Got Item %s" % item)
@@ -5251,29 +5390,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final ItemUpdate itemUpdate = new ItemUpdate();
- itemUpdate.setName("New Item Name");
- itemUpdate.setDescription("New Item Description");
-
- final Item item = client.updateItem(itemId, itemUpdate);
- System.out.println("Updated item: " + item.getCode());
- System.out.println(item.getName());
- System.out.println(item.getDescription());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var itemReq = new ItemUpdate() {
@@ -5293,10 +5413,49 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const itemUpdate = {
+ name: 'New Item Name',
+ description: 'New Item Description'
+ }
+ const item = await client.updateItem(itemId, itemUpdate)
+ console.log('Updated item: ', item)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final ItemUpdate itemUpdate = new ItemUpdate();
+ itemUpdate.setName("New Item Name");
+ itemUpdate.setDescription("New Item Description");
+
+ final Item item = client.updateItem(itemId, itemUpdate);
+ System.out.println("Updated item: " + item.getCode());
+ System.out.println(item.getName());
+ System.out.println(item.getDescription());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
item_update = {
name: "New Item Name",
@@ -5310,29 +5469,29 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const itemUpdate = {
- name: 'New Item Name',
- description: 'New Item Description'
- }
- const item = await client.updateItem(itemId, itemUpdate)
- console.log('Updated item: ', item)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $item_update = array(
+ "name" => "Dark Roast Coffee Beans",
+ "description" => "A special dark roast version.",
+ );
+ $item = $client->updateItem($item_id, $item_update);
+
+ echo 'Updated Item:' . PHP_EOL;
+ var_dump($item);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
item_update = {
@@ -5374,23 +5533,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- Item item = client.deactivateItem(itemId);
- System.out.println("deactivated item " + item.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Item item = client.DeactivateItem(itemId);
@@ -5405,20 +5551,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- item = @client.deactivate_item(item_id: item_id)
- puts "Deactivated Item #{item}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const item = await client.deactivateItem(itemId)
console.log('Deleted item: ', item.code)
@@ -5430,10 +5566,49 @@
}
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
throw err
}
+ - lang: Java
+ source: |
+ try {
+ Item item = client.deactivateItem(itemId);
+ System.out.println("deactivated item " + item.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ item = @client.deactivate_item(item_id: item_id)
+ puts "Deactivated Item #{item}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $item = $client->deactivateItem($item_id);
+
+ echo 'Deactivated Item:' . PHP_EOL;
+ var_dump($item);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
item = client.deactivate_item(item_id)
print("Deactivated Item %s" % item)
@@ -5476,23 +5651,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Item item = client.reactivateItem(itemId);
- System.out.println("Reactivated item: " + item.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Item item = client.ReactivateItem(itemId);
@@ -5507,20 +5669,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- item = @client.reactivate_item(item_id: item_id)
- puts "Reactivated Item #{item}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const item = await client.reactivateItem(itemId)
console.log('Reactivated item: ', item.code)
@@ -5532,10 +5684,49 @@
}
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
throw err
}
+ - lang: Java
+ source: |
+ try {
+ final Item item = client.reactivateItem(itemId);
+ System.out.println("Reactivated item: " + item.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ item = @client.reactivate_item(item_id: item_id)
+ puts "Reactivated Item #{item}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $item = $client->reactivateItem($item_id);
+
+ echo 'Reactivate Item:' . PHP_EOL;
+ var_dump($item);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
item = client.reactivate_item(item_id)
print("Reactivated Item %s" % item)
@@ -5582,38 +5773,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var invoices = client.ListInvoices(limit: 200);
+ foreach(Invoice invoice in invoices)
+ {
+ Console.WriteLine(invoice.Number);
+ }
+ - lang: Node.js
+ source: |
+ const invoices = client.listInvoices({ limit: 200 })
+
+ for await (const invoice of invoices.each()) {
+ console.log(invoice.number)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Invoice> invoices = client.listInvoices(params);
for (Invoice invoice : invoices) {
System.out.println(invoice.getNumber());
}
- - lang: ".NET"
- source: |
- var invoices = client.ListInvoices(limit: 200);
- foreach(Invoice invoice in invoices)
- {
- Console.WriteLine(invoice.Number);
- }
- lang: Ruby
source: |
invoices = @client.list_invoices(limit: 200)
invoices.each do |invoice|
puts "Invoice: #{invoice.number}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const invoices = client.listInvoices({ limit: 200 })
+ $params = ['limit' => '200'];
+ $invoices = $client->listInvoices($params);
- for await (const invoice of invoices.each()) {
- console.log(invoice.number)
+ foreach($invoices as $invoice) {
+ echo 'Invoice: ' . $invoice->getNumber() . PHP_EOL;
}
- lang: Python
source: |
invoices = client.list_invoices(limit=200).items()
for invoice in invoices:
@@ -5645,23 +5844,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Invoice invoice = client.getInvoice(invoiceId);
- System.out.println("Fetched invoice " + invoice.getNumber());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Invoice invoice = client.GetInvoice(invoiceId);
@@ -5676,20 +5862,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice = @client.get_invoice(invoice_id: invoice_id)
- puts "Got invoice #{invoice}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const invoice = await client.getInvoice(invoiceId)
console.log('Fetched Invoice: ', invoice.number)
@@ -5702,10 +5878,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Invoice invoice = client.getInvoice(invoiceId);
+ System.out.println("Fetched invoice " + invoice.getNumber());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice = @client.get_invoice(invoice_id: invoice_id)
+ puts "Got invoice #{invoice}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->getInvoice($invoice_id);
+
+ echo 'Got Invoice:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
invoice = client.get_invoice(invoice_id)
print("Got Invoice %s" % invoice)
@@ -5745,27 +5960,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final InvoiceUpdatable invoiceUpdate = new InvoiceUpdatable();
- invoiceUpdate.setCustomerNotes("New notes");
- invoiceUpdate.setTermsAndConditions("New terms and conditions");
-
- final Invoice invoice = client.putInvoice(invoiceId, invoiceUpdate);
- System.out.println("Edited invoice " + invoice.getNumber());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var invoiceReq = new InvoiceUpdatable()
@@ -5807,10 +6005,27 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final InvoiceUpdatable invoiceUpdate = new InvoiceUpdatable();
+ invoiceUpdate.setCustomerNotes("New notes");
+ invoiceUpdate.setTermsAndConditions("New terms and conditions");
+
+ final Invoice invoice = client.putInvoice(invoiceId, invoiceUpdate);
+ System.out.println("Edited invoice " + invoice.getNumber());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
"/sites/{site_id}/invoices/{invoice_id}.pdf":
get:
tags:
- invoice
operationId: get_invoice_pdf
@@ -5836,31 +6051,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final BinaryFile invoice = client.getInvoicePdf(invoiceId);
- //System.out.println("Fetched invoice " + invoice.getData());
- String filename = downloadDirectory + "/javainvoice-" + invoiceId + ".pdf";
-
- FileOutputStream fos = new FileOutputStream(filename);
- fos.write(invoice.getData());
- fos.close();
- System.out.println("Saved Invoice PDF to " + filename);
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- } catch (java.io.IOException e) {
- System.out.println("Unexpected File Writing Error: " + e.toString());
- }
- lang: ".NET"
source: |
try
{
BinaryFile invoice = client.GetInvoicePdf(invoiceId);
@@ -5877,23 +6071,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice = @client.get_invoice_pdf(invoice_id: invoice_id)
- puts "Got invoice #{invoice}"
- filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf"
- IO.write(filename, invoice.data)
- puts "Saved Invoice PDF to #{filename}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const invoice = await client.getInvoicePdf(invoiceId)
console.log('Fetched Invoice: ', invoice)
@@ -5914,10 +6095,62 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final BinaryFile invoice = client.getInvoicePdf(invoiceId);
+ //System.out.println("Fetched invoice " + invoice.getData());
+ String filename = downloadDirectory + "/javainvoice-" + invoiceId + ".pdf";
+
+ FileOutputStream fos = new FileOutputStream(filename);
+ fos.write(invoice.getData());
+ fos.close();
+ System.out.println("Saved Invoice PDF to " + filename);
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ } catch (java.io.IOException e) {
+ System.out.println("Unexpected File Writing Error: " + e.toString());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice = @client.get_invoice_pdf(invoice_id: invoice_id)
+ puts "Got invoice #{invoice}"
+ filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf"
+ IO.write(filename, invoice.data)
+ puts "Saved Invoice PDF to #{filename}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->getInvoicePdf($invoice_id);
+ echo 'Got Invoice PDF:' . PHP_EOL;
+ var_dump($invoice);
+ $invoice_fp = fopen("php-invoice-" . $invoice_id . ".pdf", "w");
+ fwrite($invoice_fp, $invoice->getData());
+ fclose($invoice_fp);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
invoice = client.get_invoice_pdf(invoice_id)
print("Got Invoice %s" % invoice)
@@ -5971,23 +6204,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Invoice invoice = client.collectInvoice(invoiceId);
- System.out.println("Collected invoice: " + invoice.getNumber());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Invoice invoice = client.CollectInvoice(invoiceId);
@@ -6002,36 +6222,72 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const invoice = await client.collectInvoice(invoiceId)
+ console.log('Collected invoice: ', invoice.number)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final Invoice invoice = client.collectInvoice(invoiceId);
+ System.out.println("Collected invoice: " + invoice.getNumber());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
invoice = @client.collect_invoice(invoice_id: invoice_id)
puts "Collected invoice #{invoice}"
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const invoice = await client.collectInvoice(invoiceId)
- console.log('Collected invoice: ', invoice.number)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $invoice = $client->collectInvoice($invoice_id);
+
+ echo 'Collected Invoice:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
+ - lang: Python
+ source: |
+ try:
+ invoice = client.collect_invoice(invoice_id)
+ print("Collected Invoice %s" % invoice)
+ except recurly.errors.NotFoundError as e:
+ print("Invoice not found")
"/sites/{site_id}/invoices/{invoice_id}/mark_failed":
put:
tags:
- invoice
operationId: fail_invoice
@@ -6067,23 +6323,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Invoice invoice = client.failInvoice(invoiceId);
- System.out.println("Failed invoice: " + invoice.getNumber());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Invoice invoice = client.FailInvoice(invoiceId);
@@ -6098,20 +6341,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice = @client.fail_invoice(invoice_id: invoice_id)
- puts "Failed invoice #{invoice}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const invoice = await client.failInvoice(invoiceId)
console.log('Failed invoice: ', invoice.number)
@@ -6124,10 +6357,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Invoice invoice = client.failInvoice(invoiceId);
+ System.out.println("Failed invoice: " + invoice.getNumber());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice = @client.fail_invoice(invoice_id: invoice_id)
+ puts "Failed invoice #{invoice}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->failInvoice($invoice_id);
+
+ echo 'Failed Invoice:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
"/sites/{site_id}/invoices/{invoice_id}/mark_successful":
put:
tags:
- invoice
operationId: mark_invoice_successful
@@ -6163,23 +6435,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Invoice invoice = client.markInvoiceSuccessful(invoiceId);
- System.out.println("Marked invoice " + invoice.getNumber() + " successful");
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Invoice invoice = client.MarkInvoiceSuccessful(invoiceId);
@@ -6194,20 +6453,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice = @client.mark_invoice_successful(invoice_id: invoice_id)
- puts "Marked invoice sucessful #{invoice}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const invoice = await client.markInvoiceSuccessful(invoiceId)
console.log(`Marked invoice #${invoice.number} successful`)
@@ -6221,10 +6470,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Invoice invoice = client.markInvoiceSuccessful(invoiceId);
+ System.out.println("Marked invoice " + invoice.getNumber() + " successful");
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice = @client.mark_invoice_successful(invoice_id: invoice_id)
+ puts "Marked invoice sucessful #{invoice}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->markInvoiceSuccessful($invoice_id);
+
+ echo 'Marked Invoice Successful:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
invoice = client.mark_invoice_successful(invoice_id)
print("Marked Invoice successful %s" % invoice)
@@ -6267,23 +6555,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Invoice invoice = client.reopenInvoice(invoiceId);
- System.out.println("Reopened invoice: " + invoice.getNumber());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Invoice invoice = client.ReopenInvoice(invoiceId);
@@ -6298,20 +6573,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice = @client.reopen_invoice(invoice_id: invoice_id)
- puts "Reopened invoice #{invoice}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const invoice = await client.reopenInvoice(invoiceId)
console.log('Reopened invoice: ', invoice.number)
@@ -6324,10 +6589,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Invoice invoice = client.reopenInvoice(invoiceId);
+ System.out.println("Reopened invoice: " + invoice.getNumber());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice = @client.reopen_invoice(invoice_id: invoice_id)
+ puts "Reopened invoice #{invoice}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->reopenInvoice($invoice_id);
+
+ echo 'Reopened Invoice:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
"/sites/{site_id}/invoices/{invoice_id}/void":
put:
tags:
- invoice
operationId: void_invoice
@@ -6360,11 +6664,27 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $invoice = $client->voidInvoice($invoice_id);
+
+ echo 'Voided Invoice:' . PHP_EOL;
+ var_dump($invoice);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
"/sites/{site_id}/invoices/{invoice_id}/line_items":
get:
tags:
- invoice
- line_item
@@ -6405,11 +6725,19 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $invoice_line_items = $client->listInvoiceLineItems($invoice_id, $params);
+
+ foreach($invoice_line_item as $line_item) {
+ echo 'Invoice Line Item: ' . $line_item->getId() . PHP_EOL;
+ }
"/sites/{site_id}/invoices/{invoice_id}/coupon_redemptions":
get:
tags:
- invoice
- coupon_redemption
@@ -6458,10 +6786,18 @@
limit: 200
)
coupon_redemptions.each do |redemption|
puts "CouponRedemption: #{redemption.id}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $invoice_coupon_redemptions = $client->listInvoiceCouponRedemptions($invoice_id, $params);
+
+ foreach($invoice_coupon_redemptions as $redemption) {
+ echo 'Invoice Coupon Redemption: ' . $redemption->getId() . PHP_EOL;
+ }
"/sites/{site_id}/invoices/{invoice_id}/related_invoices":
get:
tags:
- invoice
operationId: list_related_invoices
@@ -6492,17 +6828,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- final Pager<Invoice> invoices = client.listRelatedInvoices(invoiceId);
-
- for (Invoice invoice : invoices) {
- System.out.println(invoice.getNumber());
- }
- lang: ".NET"
source: |
var invoices = client.ListRelatedInvoices(invoiceId);
foreach(Invoice invoice in invoices)
{
@@ -6513,10 +6842,24 @@
const invoices = client.listRelatedInvoices(invoiceId, { limit: 200 })
for await (const invoice of invoices.each()) {
console.log(invoice.number)
}
+ - lang: Java
+ source: |
+ final Pager<Invoice> invoices = client.listRelatedInvoices(invoiceId);
+
+ for (Invoice invoice : invoices) {
+ System.out.println(invoice.getNumber());
+ }
+ - lang: Php
+ source: |
+ $related_invoices = $client->listRelatedInvoices($invoice_id);
+
+ foreach($related_invoices as $invoice) {
+ echo 'Related Invoice: ' . $invoice->getId() . PHP_EOL;
+ }
"/sites/{site_id}/invoices/{invoice_id}/refund":
post:
tags:
- invoice
operationId: refund_invoice
@@ -6560,28 +6903,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final InvoiceRefund invoiceRefund = new InvoiceRefund();
- invoiceRefund.setCreditCustomerNotes("Notes on credits");
- invoiceRefund.setType("amount"); // could also be "line_items"
- invoiceRefund.setAmount(100);
-
- final Invoice invoice = client.refundInvoice(invoiceId, invoiceRefund);
- System.out.println("Refunded invoice " + invoice.getNumber());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var refundReq = new InvoiceRefund() {
@@ -6601,27 +6926,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- invoice_refund = {
- type: "amount",
- amount: 100,
- }
- invoice = @client.refund_invoice(
- invoice_id: invoice_id,
- body: invoice_refund
- )
- puts "Refunded invoice #{invoice}"
- rescue Recurly::Errors::ValidationError => e
- # If the request was invalid, you may want to tell your user
- # why. You can find the invalid params and reasons in e.recurly_error.params
- puts "ValidationError: #{e.recurly_error.params}"
- end
- lang: Node.js
source: |
try {
const invoiceRefund = {
creditCustomerNotes: "Notes on credits",
@@ -6641,10 +6949,65 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final InvoiceRefund invoiceRefund = new InvoiceRefund();
+ invoiceRefund.setCreditCustomerNotes("Notes on credits");
+ invoiceRefund.setType("amount"); // could also be "line_items"
+ invoiceRefund.setAmount(100);
+
+ final Invoice invoice = client.refundInvoice(invoiceId, invoiceRefund);
+ System.out.println("Refunded invoice " + invoice.getNumber());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ invoice_refund = {
+ type: "amount",
+ amount: 100,
+ }
+ invoice = @client.refund_invoice(
+ invoice_id: invoice_id,
+ body: invoice_refund
+ )
+ puts "Refunded invoice #{invoice}"
+ rescue Recurly::Errors::ValidationError => e
+ # If the request was invalid, you may want to tell your user
+ # why. You can find the invalid params and reasons in e.recurly_error.params
+ puts "ValidationError: #{e.recurly_error.params}"
+ end
+ - lang: Php
+ source: |
+ try {
+ $refund = array(
+ "type" => "amount",
+ "amount" => 1
+ );
+ $invoice_collection = $client->refundInvoice($invoice_id, $refund);
+
+ echo 'Refunded Invoice:' . PHP_EOL;
+ var_dump($invoice_collection);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
invoice_refund = {"type": "amount", "amount": 100}
invoice = client.refund_invoice(invoice_id, invoice_refund)
@@ -6695,19 +7058,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- QueryParams params = new QueryParams();
- params.setLimit(200); // Pull 200 records at a time
- final Pager<LineItem> lineItems = client.listLineItems(params);
-
- for (LineItem lineItem : lineItems) {
- System.out.println("Item " + lineItem.getUuid() + " for " + lineItem.getAmount());
- }
- lang: ".NET"
source: |
var lineItems = client.ListLineItems(limit: 200);
foreach(LineItem item in lineItems)
{
@@ -6718,10 +7072,27 @@
const lineItems = client.listLineItems({ limit: 200 })
for await (const item of lineItems.each()) {
console.log(`Item ${item.id} for ${item.amount}`)
}
+ - lang: Java
+ source: |
+ QueryParams params = new QueryParams();
+ params.setLimit(200); // Pull 200 records at a time
+ final Pager<LineItem> lineItems = client.listLineItems(params);
+
+ for (LineItem lineItem : lineItems) {
+ System.out.println("Item " + lineItem.getUuid() + " for " + lineItem.getAmount());
+ }
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $line_items = $client->listLineItems($params);
+
+ foreach($line_items as $line_item) {
+ echo 'Line item: ' . $line_item->getId() . PHP_EOL;
+ }
- lang: Python
source: |
line_items = client.list_line_items(limit=200).items()
for line_item in line_items:
print(line_item.id)
@@ -6752,23 +7123,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final LineItem lineItem = client.getLineItem(lineItemId);
- System.out.println("Fetched line item " + lineItem.getUuid());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
LineItem lineItem = client.GetLineItem(lineItemId);
@@ -6783,20 +7141,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- line_item = @client.get_line_item(line_item_id: line_item_id)
- puts "Got LineItem #{line_item}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const lineItem = await client.getLineItem(lineItemId)
console.log('Fetched line item: ', lineItem.uuid)
@@ -6809,10 +7157,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final LineItem lineItem = client.getLineItem(lineItemId);
+ System.out.println("Fetched line item " + lineItem.getUuid());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ line_item = @client.get_line_item(line_item_id: line_item_id)
+ puts "Got LineItem #{line_item}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $line_item = $client->getLineItem($line_item_id);
+
+ echo 'Got LineItem:' . PHP_EOL;
+ var_dump($line_item);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
line_item = client.get_line_item(line_item_id)
print("Got LineItem %s" % line_item)
@@ -6848,23 +7235,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- client.removeLineItem(lineItemId);
- System.out.println("Removed line item " + lineItemId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
client.RemoveLineItem(lineItemId);
@@ -6879,10 +7253,39 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ await client.removeLineItem(lineItemId)
+ console.log('Removed line item: ', lineItemId)
+ } catch (err) {
+ if (err instanceof recurly.errors.NotFoundError) {
+ // If the request was not found, you may want to alert the user or
+ // just return null
+ console.log('Resource Not Found')
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ client.removeLineItem(lineItemId);
+ System.out.println("Removed line item " + lineItemId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
@client.remove_line_item(
line_item_id: line_item_id
@@ -6891,25 +7294,23 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- await client.removeLineItem(lineItemId)
- console.log('Removed line item: ', lineItemId)
- } catch (err) {
- if (err instanceof recurly.errors.NotFoundError) {
- // If the request was not found, you may want to alert the user or
- // just return null
- console.log('Resource Not Found')
- } else {
+ $client->removeLineItem($line_item_id);
+ echo 'Removed LineItem: ' . $line_item_id . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
client.remove_line_item(line_item_id)
@@ -6957,38 +7358,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var plans = client.ListPlans(limit: 200);
+ foreach(Plan plan in plans)
+ {
+ Console.WriteLine(plan.Code);
+ }
+ - lang: Node.js
+ source: |
+ const plans = client.listPlans({ limit: 200 })
+
+ for await (const plan of plans.each()) {
+ console.log(plan.code)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Plan> plans = client.listPlans(params);
for (Plan plan : plans) {
System.out.println(plan.getCode());
}
- - lang: ".NET"
- source: |
- var plans = client.ListPlans(limit: 200);
- foreach(Plan plan in plans)
- {
- Console.WriteLine(plan.Code);
- }
- lang: Ruby
source: |
plans = @client.list_plans(limit: 200)
plans.each do |plan|
puts "Plan: #{plan.code}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const plans = client.listPlans({ limit: 200 })
+ $params = ['limit' => 200];
+ $plans = $client->listPlans($params);
- for await (const plan of plans.each()) {
- console.log(plan.code)
+ foreach($plans as $plan) {
+ echo 'Plan: ' . $plan->getCode() . PHP_EOL;
}
- lang: Python
source: |
plans = client.list_plans(limit=200).items()
for plan in plans:
@@ -7030,36 +7439,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- PlanCreate planCreate = new PlanCreate();
-
- planCreate.setName("Monthly Coffee Subscription");
- planCreate.setCode(planCode);
-
- List<PlanPricing> currencies = new ArrayList<PlanPricing>();
- PlanPricing planPrice = new PlanPricing();
- planPrice.setCurrency("USD");
- planPrice.setUnitAmount(10000.0f);
- currencies.add(planPrice);
-
- planCreate.setCurrencies(currencies);
-
- Plan plan = client.createPlan(planCreate);
- System.out.println("Created Plan " + planCode);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var planReq = new PlanCreate()
@@ -7085,10 +7468,62 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const planCreate = {
+ name: 'Monthly Coffee Subscription',
+ code: planCode,
+ currencies: [
+ {
+ currency: 'USD',
+ unitAmount: 10000
+ }
+ ]
+ }
+ const plan = await client.createPlan(planCreate)
+ console.log('Created Plan: ', plan.code)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ PlanCreate planCreate = new PlanCreate();
+
+ planCreate.setName("Monthly Coffee Subscription");
+ planCreate.setCode(planCode);
+
+ List<PlanPricing> currencies = new ArrayList<PlanPricing>();
+ PlanPricing planPrice = new PlanPricing();
+ planPrice.setCurrency("USD");
+ planPrice.setUnitAmount(10000.0f);
+ currencies.add(planPrice);
+
+ planCreate.setCurrencies(currencies);
+
+ Plan plan = client.createPlan(planCreate);
+ System.out.println("Created Plan " + planCode);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
plan_create = {
code: plan_code,
@@ -7112,35 +7547,36 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const planCreate = {
- name: 'Monthly Coffee Subscription',
- code: planCode,
- currencies: [
- {
- currency: 'USD',
- unitAmount: 10000
- }
- ]
- }
- const plan = await client.createPlan(planCreate)
- console.log('Created Plan: ', plan.code)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $plan_create = array(
+ "name" => "Monthly Coffee Subscription",
+ "code" => $plan_code,
+ "currencies" => [
+ array(
+ "currency" => "USD",
+ "unit_amount" => 10000
+ )
+ ]
+ );
+
+ $plan = $client->createPlan($plan_create);
+
+ echo 'Created Plan:' . PHP_EOL;
+ var_dump($plan);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
plan_create = {
@@ -7182,23 +7618,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Plan plan = client.getPlan(planId);
- System.out.println("Fetched plan " + plan.getCode());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Plan plan = client.GetPlan(planId);
@@ -7213,20 +7636,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- plan = @client.get_plan(plan_id: plan_id)
- puts "Got plan #{plan}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const plan = await client.getPlan(planId)
console.log('Fetched plan: ', plan.code)
@@ -7239,10 +7652,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Plan plan = client.getPlan(planId);
+ System.out.println("Fetched plan " + plan.getCode());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ plan = @client.get_plan(plan_id: plan_id)
+ puts "Got plan #{plan}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $plan = $client->getPlan($plan_id);
+
+ echo 'Got Plan:' . PHP_EOL;
+ var_dump($plan);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
plan = client.get_plan(plan_id)
print("Got Plan %s" % plan)
@@ -7288,26 +7740,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final PlanUpdate planUpdate = new PlanUpdate();
- planUpdate.setName("New Monthly Coffee Subscription");
-
- final Plan plan = client.updatePlan(planId, planUpdate);
- System.out.println("Updated plan " + plan.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var planReq = new PlanUpdate() {
@@ -7344,10 +7780,45 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final PlanUpdate planUpdate = new PlanUpdate();
+ planUpdate.setName("New Monthly Coffee Subscription");
+
+ final Plan plan = client.updatePlan(planId, planUpdate);
+ System.out.println("Updated plan " + plan.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Php
+ source: |
+ try {
+ $plan_update = array(
+ "name" => "Monthly Tea Subscription"
+ );
+ $plan = $client->updatePlan($plan_id, $plan_update);
+
+ echo 'Updated Plan:' . PHP_EOL;
+ var_dump($plan);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
delete:
tags:
- plan
operationId: remove_plan
summary: Remove a plan
@@ -7366,23 +7837,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Plan plan = client.removePlan(planId);
- System.out.println("Removed plan " + plan.getCode());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Plan plan = client.RemovePlan(planId);
@@ -7413,10 +7871,37 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Plan plan = client.removePlan(planId);
+ System.out.println("Removed plan " + plan.getCode());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Php
+ source: |
+ try {
+ $plan = $client->removePlan($plan_id);
+ echo 'Removed Plan: ' . $plan_id . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
"/sites/{site_id}/plans/{plan_id}/add_ons":
get:
tags:
- add-on
- plan
@@ -7474,10 +7959,18 @@
limit: 200
)
add_ons.each do |add_on|
puts "AddOn: #{add_on.code}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $plan_add_ons = $client->listPlanAddOns($plan_id, $params);
+
+ foreach($plan_add_ons as $add_on) {
+ echo 'Plan add-on: ' . $add_on->getCode() . PHP_EOL;
+ }
- lang: Python
source: |
add_ons = client.list_plan_add_ons(plan_id).items()
for add_on in add_ons:
print(add_on.code)
@@ -7520,10 +8013,39 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ try
+ {
+ var addOnReq = new AddOnCreate() {
+ Code = "coffee_grinder",
+ Name = "A quality grinder for your beans",
+ DefaultQuantity = 1,
+ Currencies = new List<AddOnPricing>() {
+ new AddOnPricing() {
+ Currency = "USD",
+ UnitAmount = 10000
+ }
+ }
+ };
+ AddOn addOn = client.CreatePlanAddOn(planId, addOnReq);
+ Console.WriteLine($"Created add-on {addOn.Code}");
+ }
+ catch (Recurly.Errors.Validation ex)
+ {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in ex.Error.Params
+ Console.WriteLine($"Failed validation: {ex.Error.Message}");
+ }
+ catch (Recurly.Errors.ApiError ex)
+ {
+ // Use ApiError to catch a generic error from the API
+ Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
+ }
- lang: Java
source: |
try {
AddOnCreate addOnCreate = new AddOnCreate();
@@ -7547,39 +8069,37 @@
System.out.println("Failed validation: " + e.getError().getMessage());
} catch (ApiException e) {
// Use ApiException to catch a generic error from the API
System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
}
- - lang: ".NET"
+ - lang: Php
source: |
- try
- {
- var addOnReq = new AddOnCreate() {
- Code = "coffee_grinder",
- Name = "A quality grinder for your beans",
- DefaultQuantity = 1,
- Currencies = new List<AddOnPricing>() {
- new AddOnPricing() {
- Currency = "USD",
- UnitAmount = 10000
- }
- }
- };
- AddOn addOn = client.CreatePlanAddOn(planId, addOnReq);
- Console.WriteLine($"Created add-on {addOn.Code}");
- }
- catch (Recurly.Errors.Validation ex)
- {
+ try {
+ $add_on_create = [
+ "code" => $add_on_code,
+ "name" => "Fresh beans shipped monthly",
+ "currencies" => [
+ array(
+ "currency" => "USD",
+ "unit_amount" => 10
+ )
+ ]
+ ];
+
+ $add_on = $client->createPlanAddOn($plan_id, $add_on_create);
+
+ echo 'Created Plan:' . PHP_EOL;
+ var_dump($plan);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in ex.Error.Params
- Console.WriteLine($"Failed validation: {ex.Error.Message}");
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
}
- catch (Recurly.Errors.ApiError ex)
- {
- // Use ApiError to catch a generic error from the API
- Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
- }
- lang: Python
source: |
try:
add_on_create = {
"code": "coffee_grinder",
@@ -7623,23 +8143,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final AddOn addOn = client.getPlanAddOn(planId, addOnId);
- System.out.println("Fetched add-on " + addOn.getCode());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
AddOn addOn = client.GetPlanAddOn(planId, addOnId);
@@ -7654,10 +8161,23 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Java
+ source: |
+ try {
+ final AddOn addOn = client.getPlanAddOn(planId, addOnId);
+ System.out.println("Fetched add-on " + addOn.getCode());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
add_on = @client.get_plan_add_on(
plan_id: plan_id, add_on_id: add_on_id
@@ -7666,10 +8186,26 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
+ - lang: Php
+ source: |
+ try {
+ $add_on = $client->getPlanAddOn($plan_id, $add_on_id);
+
+ echo 'Got Plan Add-On:' . PHP_EOL;
+ var_dump($add_on);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
shipping_addr = client.get_shipping_address(account_id, shipping_address_id)
print("Got ShippingAddress %s" % shipping_addr)
@@ -7716,11 +8252,30 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $add_on_update = array(
+ "name" => "New AddOn Name",
+ );
+ $add_on = $client->updatePlanAddOn($plan_id, $add_on_id, $add_on_update);
+
+ echo ' Updated Plan AddOn:' . PHP_EOL;
+ var_dump($add_on);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
delete:
tags:
- plan
- add-on
operationId: remove_plan_add_on
@@ -7740,11 +8295,27 @@
description: Incorrect site, plan, or add-on ID.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $add_on = $client->removePlanAddOn($plan_id, $add_on_id);
+
+ echo 'Removed Plan AddOn:' . PHP_EOL;
+ var_dump($add_on);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
"/sites/{site_id}/add_ons":
get:
tags:
- add-on
operationId: list_add_ons
@@ -7782,25 +8353,33 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var addOns = client.ListAddOns();
+ foreach(AddOn addOn in addOns)
+ {
+ Console.WriteLine(addOn.Code);
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<AddOn> addOns = client.listAddOns(params);
for (AddOn addOn : addOns) {
System.out.println(addOn.getCode());
}
- - lang: ".NET"
+ - lang: Php
source: |
- var addOns = client.ListAddOns();
- foreach(AddOn addOn in addOns)
- {
- Console.WriteLine(addOn.Code);
+ $params = ['limit' => 200];
+ $add_ons = $client->listAddOns($params);
+
+ foreach($add_ons as $addon) {
+ echo 'Add-on: ' . $addon->getCode() . PHP_EOL;
}
"/sites/{site_id}/add_ons/{add_on_id}":
get:
tags:
- add-on
@@ -7826,11 +8405,27 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ try {
+ $add_on = $client->getAddOn($add_on_id);
+
+ echo 'Got Plan Add-On:' . PHP_EOL;
+ var_dump($add_on);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
"/sites/{site_id}/shipping_methods":
get:
tags:
- shipping_method
operationId: list_shipping_methods
@@ -7866,11 +8461,19 @@
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $shipping_methods = $client->listShippingMethods($params);
+
+ foreach($shipping_methods as $shipping_method) {
+ echo 'Shipping Method: ' . $shipping_method->getCode() . PHP_EOL;
+ }
"/sites/{site_id}/shipping_methods/{id}":
get:
tags:
- shipping_method
operationId: get_shipping_method
@@ -7943,38 +8546,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var subscriptions = client.ListSubscriptions(limit: 200);
+ foreach(Subscription subscription in subscriptions)
+ {
+ Console.WriteLine(subscription.Uuid);
+ }
+ - lang: Node.js
+ source: |
+ const subscriptions = client.listSubscriptions({ limit: 200 })
+
+ for await (const subscription of subscriptions.each()) {
+ console.log(subscription.uuid)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Subscription> subscriptions = client.listSubscriptions(params);
for (Subscription subscription : subscriptions) {
System.out.println(subscription.getUuid());
}
- - lang: ".NET"
- source: |
- var subscriptions = client.ListSubscriptions(limit: 200);
- foreach(Subscription subscription in subscriptions)
- {
- Console.WriteLine(subscription.Uuid);
- }
- lang: Ruby
source: |
subscriptions = @client.list_subscriptions(limit: 200)
subscriptions.each do |subscription|
puts "Subscription: #{subscription.uuid}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const subscriptions = client.listSubscriptions({ limit: 200 })
+ $params = ['limit' => 200];
+ $subscriptions = $client->listSubscriptions($params);
- for await (const subscription of subscriptions.each()) {
- console.log(subscription.uuid)
+ foreach($subscriptions as $sub) {
+ echo 'Subscription: ' . $sub->getUuid() . PHP_EOL;
}
- lang: Python
source: |
subscriptions = client.list_subscriptions(limit=200).items()
for subscription in subscriptions:
@@ -8017,31 +8628,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- SubscriptionCreate subscriptionCreate = new SubscriptionCreate();
- AccountCreate accountCreate = new AccountCreate();
-
- accountCreate.setCode(accountCode);
- subscriptionCreate.setCurrency("USD");
- subscriptionCreate.setAccount(accountCreate);
- subscriptionCreate.setPlanCode(planCode);
-
- Subscription subscription = client.createSubscription(subscriptionCreate);
- System.out.println("Created Subscription with Id: " + subscription.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var subReq = new SubscriptionCreate()
@@ -8065,10 +8655,54 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let subscriptionReq = {
+ planCode: planCode,
+ currency: `USD`,
+ account: {
+ code: accountCode
+ }
+ }
+ let sub = await client.createSubscription(subscriptionReq)
+ console.log('Created subscription: ', sub.uuid)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ SubscriptionCreate subscriptionCreate = new SubscriptionCreate();
+ AccountCreate accountCreate = new AccountCreate();
+
+ accountCreate.setCode(accountCode);
+ subscriptionCreate.setCurrency("USD");
+ subscriptionCreate.setAccount(accountCreate);
+ subscriptionCreate.setPlanCode(planCode);
+
+ Subscription subscription = client.createSubscription(subscriptionCreate);
+ System.out.println("Created Subscription with Id: " + subscription.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
subscription_create = {
plan_code: plan_code,
@@ -8086,32 +8720,33 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- let subscriptionReq = {
- planCode: planCode,
- currency: `USD`,
- account: {
- code: accountCode
- }
- }
- let sub = await client.createSubscription(subscriptionReq)
- console.log('Created subscription: ', sub.uuid)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $sub_create = array(
+ "plan_code" => $plan_code,
+ "currency" => "USD",
+ "account" => array(
+ "code" => $account_code
+ ),
+ );
+
+ $subscription = $client->createSubscription($sub_create);
+
+ echo 'Created Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
sub_create = {
@@ -8153,23 +8788,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Subscription subscription = client.getSubscription(subscriptionId);
- System.out.println("Fetched Subscription: " + subscription.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Subscription subscription = client.GetSubscription(sub.Id);
@@ -8184,22 +8806,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- subscription = @client.get_subscription(
- subscription_id: subscription_id
- )
- puts "Got Subscription #{subscription}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const subscription = await client.getSubscription(subscriptionId)
console.log('Fetched subscription: ', subscription.uuid)
@@ -8212,10 +8822,51 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final Subscription subscription = client.getSubscription(subscriptionId);
+ System.out.println("Fetched Subscription: " + subscription.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ subscription = @client.get_subscription(
+ subscription_id: subscription_id
+ )
+ puts "Got Subscription #{subscription}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $subscription = $client->getSubscription($subscription_id);
+
+ echo 'Got Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
subscription = client.get_subscription(subscription_id)
print("Got Subscription %s" % subscription)
@@ -8252,26 +8903,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final SubscriptionUpdate subUpdate = new SubscriptionUpdate();
- subUpdate.setTermsAndConditions("Some new terms and conditions");
- subUpdate.setCustomerNotes("Some new customer notes");
- final Subscription subscription = client.modifySubscription(subscriptionId, subUpdate);
- System.out.println("Modified Subscription: " + subscription.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var updateReq = new SubscriptionUpdate()
@@ -8291,10 +8926,47 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const update = {
+ termsAndConditions: "Some new terms and conditions",
+ customerNotes: "Some new customer notes"
+ }
+ const subscription = await client.modifySubscription(subscriptionId, update)
+ console.log('Modified subscription: ', subscription.uuid)
+ } catch(err) {
+
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final SubscriptionUpdate subUpdate = new SubscriptionUpdate();
+ subUpdate.setTermsAndConditions("Some new terms and conditions");
+ subUpdate.setCustomerNotes("Some new customer notes");
+ final Subscription subscription = client.modifySubscription(subscriptionId, subUpdate);
+ System.out.println("Modified Subscription: " + subscription.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
subscription_update = {
customer_notes: "New Notes",
@@ -8308,30 +8980,30 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const update = {
- termsAndConditions: "Some new terms and conditions",
- customerNotes: "Some new customer notes"
- }
- const subscription = await client.modifySubscription(subscriptionId, update)
- console.log('Modified subscription: ', subscription.uuid)
- } catch(err) {
+ $changes = array(
+ "terms_and_conditions" => "Some new terms and conditions",
+ "customer_notes" => "Some new customer notes"
+ );
- if (err instanceof recurly.errors.ValidationError) {
+ $subscription = $client->modifySubscription($subscription_id, $changes);
+
+ echo 'Modified Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
sub_update = {"customer_notes": "New Notes", "terms_and_conditions": "New TaC"}
@@ -8398,25 +9070,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- QueryParams queryParams = new QueryParams();
- queryParams.setRefund("none"); // "full" for a full refund, "partial" for prorated refund
- client.terminateSubscription(subscriptionId, queryParams);
- System.out.println("Terminated Subscription: " + subscriptionId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Subscription subscription = client.TerminateSubscription(subscriptionId);
@@ -8431,10 +9088,41 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const subscription = await client.terminateSubscription(subscriptionId)
+ console.log('Terminated subscription: ', subscription.uuid)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ QueryParams queryParams = new QueryParams();
+ queryParams.setRefund("none"); // "full" for a full refund, "partial" for prorated refund
+ client.terminateSubscription(subscriptionId, queryParams);
+ System.out.println("Terminated Subscription: " + subscriptionId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
subscription = @client.terminate_subscription(
subscription_id: subscription_id,
@@ -8443,25 +9131,25 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const subscription = await client.terminateSubscription(subscriptionId)
- console.log('Terminated subscription: ', subscription.uuid)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $subscription = $client->terminateSubscription($subscription_id);
+
+ echo 'Terminated Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
subscription = client.terminate_subscription(subscription_id)
@@ -8515,23 +9203,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Subscription subscription = client.cancelSubscription(subscriptionId);
- System.out.println("Canceled Subscription: " + subscription.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Subscription subscription = client.CancelSubscription(subscriptionId);
@@ -8546,10 +9221,39 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let expiredSub = await client.cancelSubscription(subscriptionId)
+ console.log('Canceled Subscription: ', expiredSub.uuid)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final Subscription subscription = client.cancelSubscription(subscriptionId);
+ System.out.println("Canceled Subscription: " + subscription.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
subscription = @client.cancel_subscription(
subscription_id: subscription_id
@@ -8558,25 +9262,25 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- let expiredSub = await client.cancelSubscription(subscriptionId)
- console.log('Canceled Subscription: ', expiredSub.uuid)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $subscription = $client->cancelSubscription($subscription_id);
+
+ echo 'Canceled Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
subscription = client.cancel_subscription(subscription_id)
@@ -8623,23 +9327,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final Subscription subscription = client.reactivateSubscription(subscriptionId);
- System.out.println("Reactivated Subscription: " + subscription.getUuid());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Subscription subscription = client.ReactivateSubscription(subscriptionId);
@@ -8654,10 +9345,40 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const subscription = await client.reactivateSubscription(subscriptionId)
+ console.log('Reactivated subscription: ', subscription.uuid)
+ } catch(err) {
+
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ final Subscription subscription = client.reactivateSubscription(subscriptionId);
+ System.out.println("Reactivated Subscription: " + subscription.getUuid());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
subscription = @client.reactivate_subscription(
subscription_id: subscription_id
@@ -8666,26 +9387,25 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const subscription = await client.reactivateSubscription(subscriptionId)
- console.log('Reactivated subscription: ', subscription.uuid)
- } catch(err) {
+ $subscription = $client->reactivateSubscription($subscription_id);
- if (err instanceof recurly.errors.ValidationError) {
+ echo 'Reactivated Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
"/sites/{site_id}/subscriptions/{subscription_id}/pause":
put:
tags:
- subscription
@@ -8763,10 +9483,27 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
+ - lang: Php
+ source: |
+ try {
+ $sub_pause = [ "remaining_pause_cycles" => 10 ];
+ $subscription = $client->pauseSubscription($subscription_id, $sub_pause);
+
+ echo 'Paused Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
sub_pause = {"remaining_pause_cycles": 10}
subscription = client.pause_subscription(subscription_id, sub_pause)
@@ -8827,10 +9564,26 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
+ - lang: Php
+ source: |
+ try {
+ $subscription = $client->resumeSubscription($subscription_id);
+
+ echo 'Resumed Subscription:' . PHP_EOL;
+ var_dump($subscription);
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ var_dump($e);
+ }
- lang: Python
source: |
try:
subscription = client.resume_subscription(subscription_id)
print("Resumed Subscription %s" % subscription)
@@ -8921,23 +9674,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- final SubscriptionChange change = client.getSubscriptionChange(subscriptionId);
- System.out.println("Fetched Subscription change " + change.getId());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
SubscriptionChange change = client.GetSubscriptionChange(subscriptionId);
@@ -8952,22 +9692,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- change = @client.get_subscription_change(
- subscription_id: subscription_id
- )
- puts "Got SubscriptionChange #{change}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const change = await client.getSubscriptionChange(subscriptionId)
console.log('Fetched subscription change: ', change.id)
@@ -8980,10 +9708,51 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ final SubscriptionChange change = client.getSubscriptionChange(subscriptionId);
+ System.out.println("Fetched Subscription change " + change.getId());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ change = @client.get_subscription_change(
+ subscription_id: subscription_id
+ )
+ puts "Got SubscriptionChange #{change}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $change = $client->getSubscriptionChange($subscription_id);
+
+ echo 'Got Pending Subscription Change:' . PHP_EOL;
+ var_dump($change);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
- lang: Python
source: |
try:
change = client.get_subscription_change(subscription_id)
print("Got SubscriptionChange %s" % change)
@@ -9032,28 +9801,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- SubscriptionChangeCreate changeCreate = new SubscriptionChangeCreate();
-
- changeCreate.setPlanCode(newPlanCode);
- changeCreate.setTimeframe("now"); // choose "now" or "renewal"
-
- SubscriptionChange change = client.createSubscriptionChange(subscriptionId, changeCreate);
- System.out.println("Created subscription " + change.getId());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var changeReq = new SubscriptionChangeCreate()
@@ -9073,10 +9824,49 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ const subscriptionChangeCreate = {
+ planCode: newPlanCode,
+ timeframe: 'now'
+ }
+
+ const change = await client.createSubscriptionChange(subscriptionId, subscriptionChangeCreate)
+ console.log('Created subscription change: ', change.id)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ SubscriptionChangeCreate changeCreate = new SubscriptionChangeCreate();
+
+ changeCreate.setPlanCode(newPlanCode);
+ changeCreate.setTimeframe("now"); // choose "now" or "renewal"
+
+ SubscriptionChange change = client.createSubscriptionChange(subscriptionId, changeCreate);
+ System.out.println("Created subscription " + change.getId());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
change_create = {
timeframe: "now",
@@ -9090,30 +9880,29 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- const subscriptionChangeCreate = {
- planCode: newPlanCode,
- timeframe: 'now'
- }
+ $change_create = array(
+ "plan_code" => $new_plan_code,
+ "timeframe" => "now"
+ );
+ $change = $client->createSubscriptionChange($subscription_id, $change_create);
- const change = await client.createSubscriptionChange(subscriptionId, subscriptionChangeCreate)
- console.log('Created subscription change: ', change.id)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ echo 'Created Subscription Change:' . PHP_EOL;
+ var_dump($change);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
sub_change_create = {"plan_code": new_plan_code, "timeframe": "now"}
@@ -9149,23 +9938,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- client.removeSubscriptionChange(subscriptionId);
- System.out.println("Removed Subscription change from " + subscriptionId);
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
client.RemoveSubscriptionChange(subscriptionId);
@@ -9180,10 +9956,39 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ await client.removeSubscriptionChange(subscriptionId)
+ console.log('Removed subscription change: ', subscriptionId)
+ } catch (err) {
+ if (err instanceof recurly.errors.NotFoundError) {
+ // If the request was not found, you may want to alert the user or
+ // just return null
+ console.log('Resource Not Found')
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ client.removeSubscriptionChange(subscriptionId);
+ System.out.println("Removed Subscription change from " + subscriptionId);
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
@client.remove_subscription_change(
subscription_id: subscription_id
@@ -9192,25 +9997,23 @@
rescue Recurly::Errors::NotFoundError
# If the resource was not found, you may want to alert the user or
# just return nil
puts "Resource Not Found"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- await client.removeSubscriptionChange(subscriptionId)
- console.log('Removed subscription change: ', subscriptionId)
- } catch (err) {
- if (err instanceof recurly.errors.NotFoundError) {
- // If the request was not found, you may want to alert the user or
- // just return null
- console.log('Resource Not Found')
- } else {
+ $client->removeSubscriptionChange($subscription_id);
+ echo 'Removed Subscription Change: ' . $subscription_id . PHP_EOL;
+ } catch (\Recurly\Errors\Validation $e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
client.remove_subscription_change(subscription_id)
@@ -9278,10 +10081,18 @@
limit: 200
)
invoices.each do |invoice|
puts "Invoice: #{invoice.number}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $subscription_invoices = $client->listSubscriptionInvoices($subscription_id, $params);
+
+ foreach($subscription_invoices as $sub_invoice) {
+ echo 'Subscription Invoice: ' . $sub_invoice->getNumber() . PHP_EOL;
+ }
- lang: Python
source: |
invoices = client.list_subscription_invoices(subscription_id).items()
for invoice in invoices:
print(invoice.number)
@@ -9345,10 +10156,18 @@
limit: 200
)
line_items.each do |line_item|
puts "LineItem: #{line_item.id}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $subscription_line_items = $client->listSubscriptionLineItems($subscription_id, $params);
+
+ foreach($subscription_line_items as $line_item) {
+ echo 'Subscription Invoice: ' . $line_item->getId() . PHP_EOL;
+ }
- lang: Python
source: |
line_items = client.list_subscription_line_items(subscription_id).items()
for line_item in line_items:
print(line_item.id)
@@ -9402,10 +10221,18 @@
limit: 200
)
coupon_redemptions.each do |redemption|
puts "CouponRedemption: #{redemption.id}"
end
+ - lang: Php
+ source: |
+ $params = ['limit' => 200];
+ $subscription_coupon_redemptions = $client->listSubscriptionCouponRedemptions($subscription_id, $params);
+
+ foreach($subscription_coupon_redemptions as $redemption) {
+ echo 'Subscription Coupon Redemption: ' . $redemption->getId() . PHP_EOL;
+ }
- lang: Python
source: |
redemptions = client.list_subscription_coupon_redemptions(subscription_id).items()
for redemption in redemptions:
print(redemption.uuid)
@@ -9449,38 +10276,46 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: ".NET"
+ source: |
+ var transactions = client.ListTransactions(limit: 200);
+ foreach(Transaction transaction in transactions)
+ {
+ Console.WriteLine(transaction.Uuid);
+ }
+ - lang: Node.js
+ source: |
+ const transactions = client.listTransactions({ limit: 200 })
+
+ for await (const transaction of transactions.each()) {
+ console.log(transaction.uuid)
+ }
- lang: Java
source: |
QueryParams params = new QueryParams();
params.setLimit(200); // Pull 200 records at a time
final Pager<Transaction> transactions = client.listTransactions(params);
for (Transaction transaction : transactions) {
System.out.println(transaction.getUuid());
}
- - lang: ".NET"
- source: |
- var transactions = client.ListTransactions(limit: 200);
- foreach(Transaction transaction in transactions)
- {
- Console.WriteLine(transaction.Uuid);
- }
- lang: Ruby
source: |
transactions = @client.list_transactions(limit: 200)
transactions.each do |transaction|
puts "Transaction: #{transaction.uuid}"
end
- - lang: Node.js
+ - lang: Php
source: |
- const transactions = client.listTransactions({ limit: 200 })
+ $params = ['limit' => 200];
+ $transactions = $client->listTransactions($params);
- for await (const transaction of transactions.each()) {
- console.log(transaction.uuid)
+ foreach($transactions as $transaction) {
+ echo 'Transaction: ' . $transaction->getUuid() . PHP_EOL;
}
- lang: Python
source: |
transactions = client.list_transactions(limit=200).items()
for transaction in transactions:
@@ -9512,23 +10347,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- Transaction transaction = client.getTransaction(transactionId);
- System.out.println("Fetched transaction " + transaction.getUuid());
- } catch (NotFoundException e) {
- // If the resource was not found
- // we may want to alert the user or just return null
- System.out.println("Resource Not Found: " + e.getError().getMessage());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
Transaction transaction = client.GetTransaction(transactionId);
@@ -9543,20 +10365,10 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
- - lang: Ruby
- source: |
- begin
- transaction = @client.get_transaction(transaction_id: transaction_id)
- puts "Got Transaction #{transaction}"
- rescue Recurly::Errors::NotFoundError
- # If the resource was not found, you may want to alert the user or
- # just return nil
- puts "Resource Not Found"
- end
- lang: Node.js
source: |
try {
const transaction = await client.getTransaction(transactionId)
console.log('Fetched transaction: ', transaction.uuid)
@@ -9569,10 +10381,49 @@
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
console.log('Unknown Error: ', err)
}
}
+ - lang: Java
+ source: |
+ try {
+ Transaction transaction = client.getTransaction(transactionId);
+ System.out.println("Fetched transaction " + transaction.getUuid());
+ } catch (NotFoundException e) {
+ // If the resource was not found
+ // we may want to alert the user or just return null
+ System.out.println("Resource Not Found: " + e.getError().getMessage());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
+ - lang: Ruby
+ source: |
+ begin
+ transaction = @client.get_transaction(transaction_id: transaction_id)
+ puts "Got Transaction #{transaction}"
+ rescue Recurly::Errors::NotFoundError
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ puts "Resource Not Found"
+ end
+ - lang: Php
+ source: |
+ try {
+ $transaction = $client->getTransaction($transaction_id);
+
+ echo 'Got Transaction:' . PHP_EOL;
+ var_dump($transaction);
+ } catch (\Recurly\Errors\NotFound $e) {
+ // Could not find the resource, you may want to inform the user
+ // or just return a NULL
+ echo 'Could not find resource.' . PHP_EOL;
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
+ // Something bad happened... tell the user so that they can fix it?
+ echo 'Some unexpected Recurly error happened. Try again later.' . PHP_EOL;
+ }
"/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}":
parameters:
- "$ref": "#/components/parameters/site_id"
- "$ref": "#/components/parameters/unique_coupon_code_id"
get:
@@ -9709,44 +10560,10 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
- - lang: Java
- source: |
- try {
- PurchaseCreate purchase = new PurchaseCreate();
- purchase.setCurrency("USD");
-
- AccountPurchase account = new AccountPurchase();
- account.setCode(accountCode);
- account.setFirstName("Benjamin");
- account.setLastName("Eckel");
- purchase.setAccount(account);
-
- BillingInfoCreate billing = new BillingInfoCreate();
- billing.setTokenId(rjsTokenId);
- account.setBillingInfo(billing);
-
- List<SubscriptionPurchase> subscriptions = new ArrayList<SubscriptionPurchase>();
- SubscriptionPurchase sub = new SubscriptionPurchase();
- sub.setPlanCode(planCode);
- subscriptions.add(sub);
-
- purchase.setSubscriptions(subscriptions);
-
- InvoiceCollection collection = client.createPurchase(purchase);
- System.out.println("Created ChargeInvoice with Id: " + collection.getChargeInvoice().getId());
- } catch (ValidationException e) {
- // If the request was not valid, you may want to tell your user
- // why. You can find the invalid params and reasons in e.getError().getParams()
- System.out.println("Failed validation: " + e.getError().getMessage());
- System.out.println("Params: " + e.getError().getParams());
- } catch (ApiException e) {
- // Use ApiException to catch a generic error from the API
- System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
- }
- lang: ".NET"
source: |
try
{
var purchaseReq = new PurchaseCreate()
@@ -9779,10 +10596,75 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let purchaseReq = {
+ currency: 'USD',
+ account: {
+ code: accountCode,
+ firstName: 'Benjamin',
+ lastName: 'Du Monde',
+ billingInfo: {
+ tokenId: rjsTokenId
+ }
+ },
+ subscriptions: [
+ { planCode: planCode },
+ ]
+ }
+ let invoiceCollection = await client.createPurchase(purchaseReq)
+ console.log('Created Charge Invoice: ', invoiceCollection.chargeInvoice)
+ console.log('Created Credit Invoices: ', invoiceCollection.creditInvoices)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
+ - lang: Java
+ source: |
+ try {
+ PurchaseCreate purchase = new PurchaseCreate();
+ purchase.setCurrency("USD");
+
+ AccountPurchase account = new AccountPurchase();
+ account.setCode(accountCode);
+ account.setFirstName("Benjamin");
+ account.setLastName("Eckel");
+ purchase.setAccount(account);
+
+ BillingInfoCreate billing = new BillingInfoCreate();
+ billing.setTokenId(rjsTokenId);
+ account.setBillingInfo(billing);
+
+ List<SubscriptionPurchase> subscriptions = new ArrayList<SubscriptionPurchase>();
+ SubscriptionPurchase sub = new SubscriptionPurchase();
+ sub.setPlanCode(planCode);
+ subscriptions.add(sub);
+
+ purchase.setSubscriptions(subscriptions);
+
+ InvoiceCollection collection = client.createPurchase(purchase);
+ System.out.println("Created ChargeInvoice with Id: " + collection.getChargeInvoice().getId());
+ } catch (ValidationException e) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in e.getError().getParams()
+ System.out.println("Failed validation: " + e.getError().getMessage());
+ System.out.println("Params: " + e.getError().getParams());
+ } catch (ApiException e) {
+ // Use ApiException to catch a generic error from the API
+ System.out.println("Unexpected Recurly Error: " + e.getError().getMessage());
+ }
- lang: Ruby
source: |
begin
purchase = {
currency: "USD",
@@ -9806,40 +10688,40 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- let purchaseReq = {
- currency: 'USD',
- account: {
- code: accountCode,
- firstName: 'Benjamin',
- lastName: 'Du Monde',
- billingInfo: {
- tokenId: rjsTokenId
- }
- },
- subscriptions: [
- { planCode: planCode },
- ]
- }
- let invoiceCollection = await client.createPurchase(purchaseReq)
- console.log('Created Charge Invoice: ', invoiceCollection.chargeInvoice)
- console.log('Created Credit Invoices: ', invoiceCollection.creditInvoices)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $purchase_create = array(
+ "currency" => "USD",
+ "account" => array(
+ "code" => $account_code,
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde",
+ "billing_info" => array(
+ "token_id" => $rjs_token_id
+ ),
+ ),
+ "subscriptions" => [
+ array(
+ "plan_code" => $plan_code
+ )
+ ]
+ );
+ $invoice_collection = $client->createPurchase($purchase_create);
+ echo 'Created Invoices:' . PHP_EOL;
+ var_dump($invoice_collection);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
purchase = {
@@ -9937,10 +10819,41 @@
catch (Recurly.Errors.ApiError ex)
{
// Use ApiError to catch a generic error from the API
Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}");
}
+ - lang: Node.js
+ source: |
+ try {
+ let purchaseReq = {
+ currency: 'USD',
+ account: {
+ firstName: 'Benjamin',
+ lastName: 'Du Monde',
+ code: accountCode,
+ billingInfo: {
+ tokenId: rjsTokenId
+ }
+ },
+ subscriptions: [
+ { planCode: planCode },
+ ]
+ }
+ let invoiceCollection = await client.previewPurchase(purchaseReq)
+ console.log('Preview Charge Invoice: ', invoiceCollection.chargeInvoice)
+ console.log('Preview Credit Invoices: ', invoiceCollection.creditInvoices)
+ } catch (err) {
+ if (err instanceof recurly.errors.ValidationError) {
+ // If the request was not valid, you may want to tell your user
+ // why. You can find the invalid params and reasons in err.params
+ console.log('Failed validation', err.params)
+ } else {
+ // If we don't know what to do with the err, we should
+ // probably re-raise and let our web framework and logger handle it
+ console.log('Unknown Error: ', err)
+ }
+ }
- lang: Ruby
source: |
begin
purchase = {
currency: "USD",
@@ -9964,40 +10877,40 @@
rescue Recurly::Errors::ValidationError => e
# If the request was invalid, you may want to tell your user
# why. You can find the invalid params and reasons in e.recurly_error.params
puts "ValidationError: #{e.recurly_error.params}"
end
- - lang: Node.js
+ - lang: Php
source: |
try {
- let purchaseReq = {
- currency: 'USD',
- account: {
- firstName: 'Benjamin',
- lastName: 'Du Monde',
- code: accountCode,
- billingInfo: {
- tokenId: rjsTokenId
- }
- },
- subscriptions: [
- { planCode: planCode },
- ]
- }
- let invoiceCollection = await client.previewPurchase(purchaseReq)
- console.log('Preview Charge Invoice: ', invoiceCollection.chargeInvoice)
- console.log('Preview Credit Invoices: ', invoiceCollection.creditInvoices)
- } catch (err) {
- if (err instanceof recurly.errors.ValidationError) {
+ $purchase_preview = array(
+ "currency" => "USD",
+ "account" => array(
+ "code" => $account_code,
+ "first_name" => "Douglas",
+ "last_name" => "Du Monde",
+ "billing_info" => array(
+ "token_id" => $rjs_token_id
+ ),
+ ),
+ "subscriptions" => [
+ array(
+ "plan_code" => $plan_code
+ )
+ ]
+ );
+ $invoice_collection = $client->previewPurchase($purchase_preview);
+ echo 'Preview Invoices:' . PHP_EOL;
+ var_dump($invoice_collection);
+ } catch (\Recurly\Errors\Validation $e) {
// If the request was not valid, you may want to tell your user
// why. You can find the invalid params and reasons in err.params
- console.log('Failed validation', err.params)
- } else {
+ var_dump($e);
+ } catch (\Recurly\RecurlyError $e) {
// If we don't know what to do with the err, we should
// probably re-raise and let our web framework and logger handle it
- console.log('Unknown Error: ', err)
- }
+ var_dump($e);
}
- lang: Python
source: |
try:
purchase = {
@@ -11207,10 +12120,21 @@
title: Accounting code
description: Accounting code for invoice line items for this add-on. If
no value is provided, it defaults to add-on's code.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 20
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ description: When this add-on is invoiced, the line item will use this revenue
+ schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type`
+ must be absent in the request as the value will be set from the item.
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
tax_code:
type: string
title: Tax code
description: Used by Avalara, Vertex, and Recurly’s EU VAT tax feature.
The tax code values are specific to each tax system. If you are using
@@ -11276,20 +12200,21 @@
description: Full add-on details.
properties:
item_code:
type: string
title: Item Code
- description: 'Unique code to identify an item, when the `Catalog: Item Add-Ons`
- feature is enabled. If `item_id` and `item_code` are both present, `item_id`
- will be used.'
+ description: 'Unique code to identify an item. Avaliable when the `Catalog:
+ Item Add-Ons` feature is enabled. If `item_id` and `item_code` are both
+ present, `item_id` will be used.'
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 50
item_id:
type: string
title: Item ID
- description: 'Available when the `Catalog: Item Add-Ons` feature is enabled.
- If `item_id` and `item_code` are both present, `item_id` will be used.'
+ description: 'System-generated unique identifier for an item. Available
+ when the `Catalog: Item Add-Ons` feature is enabled. If `item_id` and
+ `item_code` are both present, `item_id` will be used.'
maxLength: 13
code:
type: string
title: Add-on code
description: The unique identifier for the add-on within its plan. If `item_code`/`item_id`
@@ -11298,12 +12223,12 @@
maxLength: 50
name:
type: string
title: Name
description: Describes your add-on and will appear in subscribers' invoices.
- If `item_code`/`item_id` is part of the request then `code` must be absent.
- If `item_code`/`item_id` is not present `code` is required.
+ If `item_code`/`item_id` is part of the request then `name` must be absent.
+ If `item_code`/`item_id` is not present `name` is required.
maxLength: 255
plan_id:
type: string
title: Plan ID
maxLength: 13
@@ -11311,13 +12236,24 @@
accounting_code:
type: string
title: Accounting code
description: Accounting code for invoice line items for this add-on. If
no value is provided, it defaults to add-on's code. If `item_code`/`item_id`
- is part of the request then `code` must be absent.
+ is part of the request then `accounting_code` must be absent.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 20
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ description: When this add-on is invoiced, the line item will use this revenue
+ schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type`
+ must be absent in the request as the value will be set from the item.
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
display_quantity:
type: boolean
title: Display quantity?
description: Determines if the quantity field is displayed on the hosted
pages for the add-on.
@@ -11333,11 +12269,11 @@
description: Optional field used by Avalara, Vertex, and Recurly's EU VAT
tax feature to determine taxation rules. If you have your own AvaTax or
Vertex account configured, use their tax codes to assign specific tax
rules. If you are using Recurly's EU VAT feature, you can use values of
`unknown`, `physical`, or `digital`. If `item_code`/`item_id` is part
- of the request then `code` must be absent.
+ of the request then `tax_code` must be absent.
maxLength: 50
currencies:
type: array
title: Add-on pricing
items:
@@ -11379,10 +12315,21 @@
description: Accounting code for invoice line items for this add-on. If
no value is provided, it defaults to add-on's code. If an `Item` is associated
to the `AddOn` then `accounting code` must be absent.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 20
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ description: When this add-on is invoiced, the line item will use this revenue
+ schedule. If an `Item` is associated to the `AddOn` then `revenue_schedule_type`
+ must be absent in the request as the value will be set from the item.
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
tax_code:
type: string
title: Tax code
description: Optional field used by Avalara, Vertex, and Recurly's EU VAT
tax feature to determine taxation rules. If you have your own AvaTax or
@@ -11568,10 +12515,17 @@
type: string
title: 3-D Secure action result token ID
description: A token generated by Recurly.js after completing a 3-D Secure
device fingerprinting or authentication challenge.
maxLength: 22
+ iban:
+ type: string
+ maxLengh: 34
+ description: The International Bank Account Number, up to 34 alphanumeric
+ characters comprising a country code; two check digits; and a number that
+ includes the domestic bank account number, branch identifier, and potential
+ routing information
Coupon:
type: object
properties:
id:
type: string
@@ -11721,10 +12675,17 @@
type: string
title: Redeem by
description: The date and time the coupon will expire and can no longer
be redeemed. Time is always 11:59:59, the end-of-day Pacific time.
format: date-time
+ redeemed_at:
+ type: string
+ title: Redeemed at
+ description: The date and time the unique coupon code was redeemed. This
+ is only present for bulk coupons.
+ format: date-time
+ readOnly: true
created_at:
type: string
title: Created at
format: date-time
readOnly: true
@@ -12558,15 +13519,18 @@
- write_off
state:
type: string
title: Invoice state
enum:
+ - open
- pending
- processing
- past_due
- paid
+ - closed
- failed
+ - voided
account:
"$ref": "#/components/schemas/AccountMini"
subscription_ids:
type: array
title: Subscription IDs
@@ -12878,15 +13842,18 @@
- legacy
state:
type: string
title: Invoice state
enum:
+ - open
- pending
- processing
- past_due
- paid
+ - closed
- failed
+ - voided
InvoiceRefund:
type: object
title: Invoice refund
properties:
type:
@@ -12896,11 +13863,12 @@
in the request.
enum:
- amount
- line_items
amount:
- type: integer
+ type: number
+ format: float
title: Amount
description: |
The amount to be refunded. The amount will be split between the line items.
If no amount is specified, it will default to refunding the total refundable amount on the invoice.
line_items:
@@ -13002,24 +13970,25 @@
- charge
- credit
item_code:
type: string
title: Item Code
- description: Unique code to identify an item, when the Catalog feature is
- enabled.
+ description: Unique code to identify an item. Available when the Credit
+ Invoices and Subscription Billing Terms features are enabled.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 50
item_id:
type: string
title: Item ID
- description: Available when the Catalog feature is enabled.
+ description: System-generated unique identifier for an item. Available when
+ the Credit Invoices and Subscription Billing Terms features are enabled.
maxLength: 13
external_sku:
type: string
title: External SKU
- description: Optional Stock Keeping Unit assigned to an item, when the Catalog
- feature is enabled.
+ description: Optional Stock Keeping Unit assigned to an item. Available
+ when the Credit Invoices and Subscription Billing Terms features are enabled.
maxLength: 50
revenue_schedule_type:
type: string
title: Revenue schedule type
enum:
@@ -13299,11 +14268,12 @@
format: float
title: Unit amount
description: |
A positive or negative amount with `type=charge` will result in a positive `unit_amount`.
A positive or negative amount with `type=credit` will result in a negative `unit_amount`.
- If `item_code`/`item_id` is present, `unit_amount` can be passed in, to override the `Item`'s `unit_amount`. If `item_code`/`item_id` is not present then `unit_amount` is required.
+ If `item_code`/`item_id` is present, `unit_amount` can be passed in, to override the `Item`'s
+ `unit_amount`. If `item_code`/`item_id` is not present then `unit_amount` is required.
quantity:
type: integer
title: Quantity
description: This number will be multiplied by the unit amount to compute
the subtotal before any discounts or taxes.
@@ -13315,18 +14285,19 @@
is part of the request then `description` must be absent.
maxLength: 255
item_code:
type: string
title: Item Code
- description: Unique code to identify an item, when the Catalog feature is
- enabled.
+ description: Unique code to identify an item. Avaliable when the Credit
+ Invoices and Subscription Billing Terms features are enabled.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 50
item_id:
type: string
title: Item ID
- description: Available when the Catalog feature is enabled.
+ description: System-generated unique identifier for an item. Available when
+ the Credit Invoices and Subscription Billing Terms features are enabled.
maxLength: 13
revenue_schedule_type:
type: string
title: Revenue schedule type
enum:
@@ -13528,10 +14499,26 @@
title: Plan accounting code
description: Accounting code for invoice line items for the plan. If no
value is provided, it defaults to plan's code.
pattern: "/^[a-z0-9_+-]+$/"
maxLength: 20
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
+ setup_fee_revenue_schedule_type:
+ type: string
+ title: Setup fee revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
setup_fee_accounting_code:
type: string
title: Setup fee accounting code
description: Accounting code for invoice line items for the plan's setup
fee. If no value is provided, it defaults to plan's accounting code.
@@ -13646,10 +14633,26 @@
description: Subscriptions will automatically inherit this value once they
are active. If `auto_renew` is `true`, then a subscription will automatically
renew its term at renewal. If `auto_renew` is `false`, then a subscription
will expire at the end of its term. `auto_renew` can be overridden on
the subscription record itself.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
+ setup_fee_revenue_schedule_type:
+ type: string
+ title: Setup fee revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
setup_fee_accounting_code:
type: string
title: Setup fee accounting code
description: Accounting code for invoice line items for the plan's setup
fee. If no value is provided, it defaults to plan's accounting code.
@@ -13794,10 +14797,26 @@
description: Subscriptions will automatically inherit this value once they
are active. If `auto_renew` is `true`, then a subscription will automatically
renew its term at renewal. If `auto_renew` is `false`, then a subscription
will expire at the end of its term. `auto_renew` can be overridden on
the subscription record itself.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
+ setup_fee_revenue_schedule_type:
+ type: string
+ title: Setup fee revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
setup_fee_accounting_code:
type: string
title: Setup fee accounting code
description: Accounting code for invoice line items for the plan's setup
fee. If no value is provided, it defaults to plan's accounting code.
@@ -14345,10 +15364,18 @@
currency:
type: string
title: Currency
description: 3-letter ISO 4217 currency code.
maxLength: 3
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
unit_amount:
type: number
format: float
title: Subscription unit price
quantity:
@@ -14487,10 +15514,18 @@
type: number
format: float
title: Unit amount
description: Optionally, override the add-on's default unit amount.
minimum: 0
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
required:
- code
SubscriptionAddOnUpdate:
type: object
properties:
@@ -14511,10 +15546,18 @@
type: number
format: float
title: Unit amount
description: Optionally, override the add-on's default unit amount.
minimum: 0
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
SubscriptionCancel:
type: object
properties:
timeframe:
type: string
@@ -14568,10 +15611,26 @@
readOnly: true
activated:
type: boolean
title: Activated?
description: Returns `true` if the subscription change is activated.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
+ setup_fee_revenue_schedule_type:
+ type: string
+ title: Setup fee revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
created_at:
type: string
format: date-time
title: Created at
readOnly: true
@@ -14655,10 +15714,18 @@
title: Collection method
enum:
- automatic
- manual
default: automatic
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
po_number:
type: string
title: Purchase order number
description: For manual invoicing, this identifies the PO number associated
with the subscription.
@@ -14807,10 +15874,18 @@
auto_renew:
type: boolean
default: true
title: Auto renew
description: Whether the subscription renews at the end of its term.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
terms_and_conditions:
type: string
title: Terms and conditions
description: This will default to the Terms and Conditions text specified
on the Invoice Settings page in your Recurly admin. Specify custom notes
@@ -14925,10 +16000,18 @@
auto_renew:
type: boolean
default: true
title: Auto renew
description: Whether the subscription renews at the end of its term.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
required:
- plan_code
SubscriptionUpdate:
type: object
properties:
@@ -14963,9 +16046,17 @@
period will start (`current_period_ends_at`). This can be used to align
the subscription’s billing to a specific day of the month. For a subscription
in a trial period, this will change when the trial expires. This parameter
is useful for postponement of a subscription to change its billing date
without proration.
+ revenue_schedule_type:
+ type: string
+ title: Revenue schedule type
+ enum:
+ - never
+ - evenly
+ - at_range_end
+ - at_range_start
terms_and_conditions:
type: string
title: Terms and conditions
description: Specify custom notes to add or override Terms and Conditions.
Custom notes will stay with a subscription on all renewals.