openapi/api.yaml in recurly-3.6.0 vs openapi/api.yaml in recurly-3.7.0
- old
+ new
@@ -379,10 +379,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const site = await client.getSite(siteId)
+ console.log('Fetched site: ', site)
+ } 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: Python
source: |
try:
site = client.get_site(site_id)
print("Got Site %s" % site)
@@ -416,10 +432,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: Java
+ source: |
+ try {
+ final Site site = client.getSite(siteId);
+ System.out.println("Fetched site: " + site.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: PHP
source: |
try {
$site = $client->getSite($site_id);
@@ -2233,10 +2262,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const redemptions = client.listAccountCouponRedemptions(accountId, { limit: 200 })
+
+ for await (const redemption of redemptions.each()) {
+ console.log(redemption.id)
+ }
- lang: Python
source: |
redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items()
for redemption in redemptions:
print(redemption.id)
@@ -2558,10 +2594,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const redemption = await client.removeCouponRedemption(accountId)
+ console.log('Removed coupon redemption: ', redemption.id)
+ } 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: Python
source: |
try:
client.remove_coupon_redemption(account_id)
print("Removed Redemption from Account id=%s" % account_id)
@@ -2765,10 +2817,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const invoices = client.listAccountInvoices(accountId, { limit: 200 })
+
+ for await (const invoice of invoices.each()) {
+ console.log(invoice.number)
+ }
- lang: Python
source: |
invoices = client.list_account_invoices(account_id, limit=200).items()
for invoice in invoices:
print(invoice.number)
@@ -3197,10 +3256,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const lineItems = client.listAccountLineItems(accountId, { limit: 200 })
+
+ for await (const lineItem of lineItems.each()) {
+ console.log(lineItem.id)
+ }
- 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)
@@ -4345,10 +4411,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const subscriptions = client.listAccountSubscriptions(accountId, { limit: 200 })
+
+ for await (const subscription of subscriptions.each()) {
+ console.log(subscription.uuid)
+ }
- lang: Python
source: |
subscriptions = client.list_account_subscriptions(account.id, limit=200).items()
for subscription in subscriptions:
print(subscription.uuid)
@@ -4434,10 +4507,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const transactions = client.listAccountTransactions(accountId, { limit: 200 })
+
+ for await (const transaction of transactions.each()) {
+ console.log(transaction.uuid)
+ }
- lang: Python
source: |
transactions = client.list_account_transactions(account_id, limit=200).items()
for transaction in transactions:
print("Transaction %s" % transaction.id)
@@ -4593,10 +4673,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const acquisitions = client.listAccountAcquisition({ limit: 200 })
+
+ for await (const acquisition of acquisitions.each()) {
+ console.log(acquisition.id)
+ }
- lang: Python
source: |
acquisitions = client.list_account_acquisition(limit=200).items()
for acquisition in acquisitions:
print(acquisition.id)
@@ -4611,10 +4698,19 @@
source: |
acquisitions = @client.list_account_acquisition(limit: 200)
acquisitions.each do |acquisition|
puts "AccountAcquisition: #{acquisition.cost}"
end
+ - lang: Java
+ source: |
+ QueryParams params = new QueryParams();
+ params.setLimit(200); // Pull 200 records at a time
+ final Pager<AccountAcquisition> acquisitions = client.listAccountAcquisition(params);
+
+ for (AccountAcquisition acquisition : acquisitions) {
+ System.out.println(acquisition.getId());
+ }
- lang: PHP
source: |
$params = ['limit' => 200];
$account_acquisition = $client->listAccountAcquisition($params);
@@ -4760,10 +4856,32 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const couponCreate = {
+ name: "Promotional Coupon",
+ code: couponCode,
+ discount_type: "fixed",
+ currencies: [{"currency": "USD", "discount": 10}],
+ }
+ const coupon = await client.createCoupon(couponCreate)
+ console.log('Created coupon: ', coupon.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: Python
source: |
try:
coupon_create = {
"name": "Promotional Coupon",
@@ -5054,10 +5172,29 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const couponUpdate = {
+ name: "New Coupon Name"
+ }
+ const coupon = await client.updateCoupon(couponId, couponUpdate)
+ console.log('Updated coupon: ', coupon)
+ } 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: Python
source: |
try:
coupon_update = {
"name": "New Coupon Name",
@@ -5100,10 +5237,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: Java
+ source: |
+ try {
+ final CouponUpdate couponUpdate = new CouponUpdate();
+ couponUpdate.setName("New Coupon Name");
+
+ final Coupon coupon = client.updateCoupon(couponId, couponUpdate);
+ System.out.println("Updated coupon: " + coupon.getCode());
+ System.out.println(coupon.getName());
+ } 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 {
$coupon_update = array(
"name" => "New Coupon Name"
@@ -7519,10 +7673,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const invoice = await client.voidInvoice(invoiceId)
+ console.log('Voided invoice: ', invoice)
+ } 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: Python
source: |
try:
invoice = client.void_invoice(invoice_id)
print("Voided Invoice %s" % invoice.id)
@@ -7538,10 +7708,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: Java
+ source: |
+ try {
+ final Invoice invoice = client.voidInvoice(invoiceId);
+ System.out.println("Voided invoice " + invoice.getId());
+ } catch (final 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 (final 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 {
$invoice = $client->voidInvoice($invoice_id);
@@ -7670,10 +7853,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const lineItems = client.listInvoiceLineItems(invoiceId, { limit: 200 })
+
+ for await (const lineItem of lineItems.each()) {
+ console.log(lineItem.id)
+ }
- lang: Python
source: |
try:
line_items = client.list_invoice_line_items(invoice_id, limit=200).items()
for item in line_items:
@@ -7696,10 +7886,19 @@
limit: 200
)
line_items.each do |line_item|
puts "Line Item: #{line_item.id}"
end
+ - lang: Java
+ source: |
+ QueryParams params = new QueryParams();
+ params.setLimit(200);
+ Pager<LineItem> lineItems = client.listInvoiceLineItems(invoiceId, params);
+
+ for (LineItem lineItem : lineItems) {
+ System.out.println(lineItem.getId());
+ }
- lang: PHP
source: |
$params = ['limit' => 200];
$invoice_line_items = $client->listInvoiceLineItems($invoice_id, $params);
@@ -7744,10 +7943,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const redemptions = client.listInvoiceCouponRedemptions(invoiceId, { limit: 200 })
+
+ for await (const redemption of redemptions.each()) {
+ console.log(redemption.id)
+ }
- lang: Python
source: |
try:
redemptions = client.list_invoice_coupon_redemptions(invoice_id, limit=200).items()
for redemption in redemptions:
@@ -9077,10 +9283,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const addOns = client.listPlanAddOns(planId, { limit: 200 })
+
+ for await (const addOn of addOns.each()) {
+ console.log(addOn.code)
+ }
- lang: Python
source: |
add_ons = client.list_plan_add_ons(plan_id).items()
for add_on in add_ons:
print(add_on.code)
@@ -9163,10 +9376,38 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const addOnCreate = {
+ code: 'coffee_grinder',
+ name: 'A quality grinder for your beans',
+ defaultQuantity: 1,
+ currencies: [
+ {
+ currency: 'USD',
+ unitAmount: 10000
+ }
+ ]
+ }
+
+ const addOn = await client.createPlanAddOn(planId, addOnCreate)
+ console.log('Created add-on: ', addOn.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: Python
source: |
try:
add_on_create = {
"code": "coffee_grinder",
@@ -9323,10 +9564,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const addOn = await client.getPlanAddOn(planId, addOnId)
+ console.log('Fetched add-on: ', addOn.code)
+ } 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: Python
source: |
try:
add_on = client.get_plan_add_on(plan_id, add_on_id)
print("Got Plan Add-On %s" % add_on)
@@ -9439,10 +9696,29 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const addOnUpdate = {
+ name: 'New AddOn Name',
+ }
+ const addOn = await client.updatePlanAddOn(planId, addOnId, addOnUpdate)
+ console.log('Updated add-on: ', addOn)
+ } 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: Python
source: |
try:
add_on_update = {
"name": "New Add-On Name",
@@ -9479,10 +9755,27 @@
finest beans\"\n }\n add_on = @client.update_plan_add_on(\n plan_id:
plan_id, \n add_on_id: add_on_id, \n body: add_on_update\n )\n puts
\"Updated add-on #{add_on}\"\nrescue Recurly::Errors::NotFoundError\n #
If the resource was not found, you may want to alert the user or\n # just
return nil\n puts \"Resource Not Found\"\nend\n"
+ - lang: Java
+ source: |
+ try {
+ final AddOnUpdate addOnUpdate = new AddOnUpdate();
+ addOnUpdate.setName("New Add-On Name");
+
+ final AddOn addOn = client.updatePlanAddOn(planId, addOnId, addOnUpdate);
+ System.out.println("Updated add-on " + addOn.getCode());
+ System.out.println(addOn.getName());
+ } 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 {
$add_on_update = array(
"name" => "New AddOn Name",
@@ -9529,10 +9822,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const addOn = await client.removePlanAddOn(planId, addOnId)
+ console.log('Removed plan add-on: ', addOn)
+ } 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: Python
source: |
try:
add_on = client.remove_plan_add_on(plan_id, add_on_id)
print("Removed Plan Add-On %s" % add_on_id)
@@ -9561,10 +9870,23 @@
- lang: Ruby
source: "begin\n add_on = @client.remove_plan_add_on(\n plan_id: plan_id,
\n add_on_id: add_on_id\n )\n puts \"Removed add-on #{add_on}\"\nrescue
Recurly::Errors::NotFoundError\n # If the resource was not found, you may
want to alert the user or\n # just return nil\n puts \"Resource Not Found\"\nend\n"
+ - lang: Java
+ source: |-
+ try {
+ final AddOn addOn = client.removePlanAddOn(planId, addOnId);
+ System.out.println("Removed add-on " + addOn.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 {
$add_on = $client->removePlanAddOn($plan_id, $add_on_id);
@@ -9624,10 +9946,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const addOns = client.listAddOns({ limit: 200 })
+
+ for await (const addOn of addOns.each()) {
+ console.log(addOn.code)
+ }
- lang: Python
source: |
add_ons = client.list_add_ons().items()
for add_on in add_ons:
print("Add-On %s" % add_on.code)
@@ -9696,10 +10025,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const addOn = await client.getAddOn(addOnId)
+ console.log('Fetched add-on: ', addOn)
+ } 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: Python
source: |
try:
add_on = client.get_add_on(add_on_id)
print("Got Add-On %s" % add_on)
@@ -9733,10 +10078,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: Java
+ source: |
+ try {
+ final AddOn addOn = client.getAddOn(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: PHP
source: |
try {
$add_on = $client->getAddOn($add_on_id);
@@ -9795,10 +10153,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const methods = client.listShippingMethods({ limit: 200 })
+
+ for await (const method of methods.each()) {
+ console.log(method.code)
+ }
- lang: Python
source: |
shipping_methods = client.list_shipping_methods(limit=200).items()
for shipping_method in shipping_methods:
print("Shipping Method %s" % shipping_method.code)
@@ -9815,10 +10180,19 @@
limit: 200
)
shipping_methods.each do |shipping_method|
puts "Shipping Method: #{shipping_method.code}"
end
+ - lang: Java
+ source: |
+ QueryParams params = new QueryParams();
+ params.setLimit(200); // Pull 200 records at a time
+ final Pager<ShippingMethod> shippingMethods = client.listShippingMethods(params);
+
+ for (ShippingMethod shippingMethod : shippingMethods) {
+ System.out.println(shippingMethod.getCode());
+ }
- lang: PHP
source: |
$params = ['limit' => 200];
$shipping_methods = $client->listShippingMethods($params);
@@ -9831,10 +10205,55 @@
:= client.ListShippingMethods(listParams)\n\nfor shippingMethods.HasMore
{\n\terr := shippingMethods.Fetch()\n\tif e, ok := err.(*recurly.Error);
ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor
i, method := range shippingMethods.Data {\n\t\tfmt.Printf(\"Shipping Method
%3d: %s, %s\\n\",\n\t\t\ti,\n\t\t\tmethod.Id,\n\t\t\tmethod.Code,\n\t\t)\n\t}\n}"
+ post:
+ tags:
+ - shipping_method
+ operationId: create_shipping_method
+ summary: Create a new shipping method
+ parameters:
+ - "$ref": "#/components/parameters/site_id"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ShippingMethodCreate"
+ required: true
+ responses:
+ '201':
+ description: A new shipping method.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ShippingMethod"
+ '400':
+ description: Bad request, perhaps invalid JSON?
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ '404':
+ description: Incorrect site ID.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ '422':
+ description: Invalid request parameters.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ default:
+ description: Unexpected error.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ x-code-samples: []
"/sites/{site_id}/shipping_methods/{id}":
get:
tags:
- shipping_method
operationId: get_shipping_method
@@ -9848,28 +10267,105 @@
required: true
schema:
type: string
responses:
'200':
- description: A shipping_method.
+ description: A shipping method.
content:
application/json:
schema:
"$ref": "#/components/schemas/ShippingMethod"
'404':
- description: Incorrect site or shipping_method ID.
+ description: Incorrect site or shipping method ID.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
- description: Unexpected error
+ description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
+ "/sites/{site_id}/shipping_methods/{shipping_method_id}":
+ put:
+ tags:
+ - shipping_method
+ operationId: update_shipping_method
+ summary: Update an active Shipping Method
+ parameters:
+ - "$ref": "#/components/parameters/site_id"
+ - "$ref": "#/components/parameters/shipping_method_id"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ShippingMethodUpdate"
+ required: true
+ responses:
+ '200':
+ description: The updated shipping method.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ShippingMethod"
+ '400':
+ description: Bad request, perhaps invalid JSON?
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ '404':
+ description: Incorrect site or shipping method ID.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ '422':
+ description: Invalid request parameters
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ default:
+ description: Unexpected error.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ x-code-samples: []
+ delete:
+ tags:
+ - shipping_method
+ operationId: deactivate_shipping_method
+ summary: Deactivate a shipping method
+ parameters:
+ - "$ref": "#/components/parameters/site_id"
+ - "$ref": "#/components/parameters/shipping_method_id"
+ description: Deactivating a shipping method makes it unavailable for new subscriptions
+ or purchases. It will not affect existing subscriptions.
+ responses:
+ '200':
+ description: A shipping method.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/ShippingMethod"
+ '422':
+ description: Shipping method may already be inactive.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ default:
+ description: Unexpected error.
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/Error"
+ x-code-samples: []
"/sites/{site_id}/subscriptions":
get:
tags:
- subscription
operationId: list_subscriptions
@@ -10870,10 +11366,29 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ let pauseReq = {
+ remaining_pause_cycles: 2,
+ }
+ const subscription = await client.pauseSubscription(subscriptionId, pauseReq)
+ console.log('Paused subscription: ', subscription.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: Python
source: |
try:
sub_pause = {"remaining_pause_cycles": 10}
subscription = client.pause_subscription(subscription_id, sub_pause)
@@ -10999,10 +11514,26 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const subscription = await client.resumeSubscription(subscriptionId)
+ console.log('Resumed subscription: ', subscription.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: Python
source: |
try:
subscription = client.resume_subscription(subscription_id)
print("Resumed Subscription %s" % subscription)
@@ -11039,10 +11570,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: Java
+ source: |
+ try {
+ final Subscription subscription = client.resumeSubscription(subscriptionId);
+ System.out.println("Resumed 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: PHP
source: |
try {
$subscription = $client->resumeSubscription($subscription_id);
@@ -11553,10 +12097,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const invoices = client.listSubscriptionInvoices(subscriptionId, { limit: 200 })
+
+ for await (const invoice of invoices.each()) {
+ console.log(invoice.number)
+ }
- lang: Python
source: |
invoices = client.list_subscription_invoices(subscription_id).items()
for invoice in invoices:
print(invoice.number)
@@ -11643,10 +12194,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const lineItems = client.listSubscriptionLineItems(subscriptionId, { limit: 200 })
+
+ for await (const lineItem of lineItems.each()) {
+ console.log(lineItem.id)
+ }
- lang: Python
source: |
line_items = client.list_subscription_line_items(subscription_id).items()
for line_item in line_items:
print(line_item.id)
@@ -11723,10 +12281,17 @@
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples:
+ - lang: Node.js
+ source: |
+ const redemptions = client.listSubscriptionCouponRedemptions(subscriptionId, { limit: 200 })
+
+ for await (const redemption of redemptions.each()) {
+ console.log(redemption.id)
+ }
- lang: Python
source: |
redemptions = client.list_subscription_coupon_redemptions(subscription_id).items()
for redemption in redemptions:
print(redemption.uuid)
@@ -12238,11 +12803,11 @@
try {
AccountPurchase account = new AccountPurchase();
account.setCode(accountCode);
account.setFirstName("Benjamin");
- account.setLastName("Eckel");
+ account.setLastName("DuMonde");
BillingInfoCreate billing = new BillingInfoCreate();
billing.setTokenId(rjsTokenId);
account.setBillingInfo(billing);
@@ -12465,10 +13030,46 @@
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: Java
+ source: |
+ try {
+
+ AccountPurchase account = new AccountPurchase();
+ account.setCode(accountCode);
+ account.setFirstName("Joanna");
+ account.setLastName("DuMonde");
+
+ 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);
+
+ PurchaseCreate purchase = new PurchaseCreate();
+ purchase.setCurrency("USD");
+ purchase.setAccount(account);
+ purchase.setSubscriptions(subscriptions);
+
+ InvoiceCollection collection = client.previewPurchase(purchase);
+ System.out.println("Preview Charge Invoice:" + collection.getChargeInvoice());
+ System.out.println("Preview Credit Invoices: " + 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());
+ 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: PHP
source: |
try {
$purchase_preview = array(
"currency" => "USD",
@@ -12591,10 +13192,18 @@
in: path
description: Shipping Address ID.
required: true
schema:
type: string
+ shipping_method_id:
+ name: shipping_method_id
+ in: path
+ description: Shipping Method ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`.
+ For code use prefix `code-`, e.g. `code-usps_2-day`.
+ required: true
+ schema:
+ type: string
subscription_id:
name: subscription_id
in: path
description: Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`.
For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
@@ -13883,11 +14492,13 @@
* If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`,
then `currencies` must be absent.
tier_type:
type: string
title: Tier type
- description: The type of tiering used by the Add-on.
+ description: |
+ The pricing model for the add-on. For more information,
+ [click here](https://docs.recurly.com/docs/billing-models#section-quantity-based).
default: flat
enum:
- flat
- tiered
- stairstep
@@ -13895,11 +14506,15 @@
tiers:
type: array
title: Tiers
items:
"$ref": "#/components/schemas/Tier"
- description: At least one tier is required if `tier_type` is not 'flat'.
+ description: |
+ If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object
+ must include one to many tiers with `ending_quantity` and `unit_amount` for
+ the desired `currencies`. There must be one tier with an `ending_quantity` of
+ 999999999 which is the default if not provided.
required:
- code
- name
- currencies
AddOnUpdate:
@@ -13985,12 +14600,14 @@
type: array
title: Tiers
items:
"$ref": "#/components/schemas/Tier"
description: |
- If tiers are provided in the request, all existing tiers on the Add-on will be
- removed and replaced by the tiers in the request.
+ If the tier_type is `flat`, then `tiers` must be absent. The `tiers` object
+ must include one to many tiers with `ending_quantity` and `unit_amount` for
+ the desired `currencies`. There must be one tier with an `ending_quantity` of
+ 999999999 which is the default if not provided.
BillingInfo:
type: object
properties:
id:
type: string
@@ -14159,19 +14776,31 @@
includes the domestic bank account number, branch identifier, and potential
routing information. (SEPA only)
name_on_account:
type: string
maxLength: 255
- description: The name associated with the bank account.
+ description: The name associated with the bank account (ACH, SEPA, Bacs
+ only)
account_number:
type: string
maxLength: 255
- description: The bank account number. (ACH only)
+ description: The bank account number. (ACH, Bacs only)
routing_number:
type: string
maxLength: 15
description: The bank's rounting number. (ACH only)
+ sort_code:
+ type: string
+ maxLength: 15
+ description: Bank identifier code for UK based banks. Required for Bacs
+ based billing infos. (Bacs only)
+ type:
+ type: string
+ enum:
+ - bacs
+ description: The payment method type for a non-credit card based billing
+ info. The value of `bacs` is the only accepted value (Bacs only)
account_type:
type: string
enum:
- checking
- savings
@@ -16128,10 +16757,15 @@
title: Trial length
description: Length of plan's trial period in `trial_units`. `0` means `no
trial`.
default: 0
minimum: 0
+ trial_requires_billing_info:
+ type: boolean
+ title: Trial Requires BillingInfo
+ description: Allow free trial subscriptions to be created without billing
+ info.
total_billing_cycles:
type: integer
title: Total billing cycles
description: Automatically terminate subscriptions after a defined number
of billing cycles. Number of billing cycles before the plan automatically
@@ -16196,10 +16830,17 @@
minItems: 1
hosted_pages:
type: object
title: Hosted pages settings
"$ref": "#/components/schemas/PlanHostedPages"
+ allow_any_item_on_subscriptions:
+ type: boolean
+ title: Allow any item on subscriptions
+ description: |
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
+ If `false`, only plan add-ons can be used.
created_at:
type: string
format: date-time
title: Created at
readOnly: true
@@ -16270,10 +16911,17 @@
title: Trial length
description: Length of plan's trial period in `trial_units`. `0` means `no
trial`.
default: 0
minimum: 0
+ trial_requires_billing_info:
+ type: boolean
+ title: Trial Requires BillingInfo
+ description: Allow free trial subscriptions to be created without billing
+ info. Should not be used if billing info is needed for initial invoice
+ due to existing uninvoiced charges or setup fee.
+ default: true
total_billing_cycles:
type: integer
title: Total billing cycles
description: Automatically terminate plans after a defined number of billing
cycles.
@@ -16337,10 +16985,18 @@
add_ons:
type: array
title: Add Ons
items:
"$ref": "#/components/schemas/AddOnCreate"
+ allow_any_item_on_subscriptions:
+ type: boolean
+ title: Allow any item on subscriptions
+ default: false
+ description: |
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
+ If `false`, only plan add-ons can be used.
required:
- code
- name
- currencies
PlanHostedPages:
@@ -16434,10 +17090,17 @@
title: Trial length
description: Length of plan's trial period in `trial_units`. `0` means `no
trial`.
default: 0
minimum: 0
+ trial_requires_billing_info:
+ type: boolean
+ title: Trial Requires BillingInfo
+ description: Allow free trial subscriptions to be created without billing
+ info. Should not be used if billing info is needed for initial invoice
+ due to existing uninvoiced charges or setup fee.
+ default: true
total_billing_cycles:
type: integer
title: Total billing cycles
description: Automatically terminate plans after a defined number of billing
cycles.
@@ -16501,10 +17164,17 @@
add_ons:
type: array
title: Add Ons
items:
"$ref": "#/components/schemas/AddOnCreate"
+ allow_any_item_on_subscriptions:
+ type: boolean
+ title: Allow any item on subscriptions
+ description: |
+ Used to determine whether items can be assigned as add-ons to individual subscriptions.
+ If `true`, items can be assigned as add-ons to individual subscription add-ons.
+ If `false`, only plan add-ons can be used.
AddOnPricing:
type: object
properties:
currency:
type: string
@@ -16796,10 +17466,83 @@
name:
type: string
title: Name
description: The name of the shipping method displayed to customers.
maxLength: 100
+ ShippingMethodCreate:
+ type: object
+ properties:
+ code:
+ type: string
+ title: Code
+ description: The internal name used identify the shipping method.
+ pattern: "/^[a-z0-9_+-]+$/i"
+ maxLength: 50
+ name:
+ type: string
+ title: Name
+ description: The name of the shipping method displayed to customers.
+ maxLength: 100
+ accounting_code:
+ type: string
+ title: Accounting Code
+ description: Accounting code for shipping method.
+ maxLength: 20
+ tax_code:
+ type: string
+ title: Tax code
+ description: |
+ Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax
+ code values are specific to each tax system. If you are using Recurly’s
+ built-in taxes the values are:
+
+ - `FR` – Common Carrier FOB Destination
+ - `FR022000` – Common Carrier FOB Origin
+ - `FR020400` – Non Common Carrier FOB Destination
+ - `FR020500` – Non Common Carrier FOB Origin
+ - `FR010100` – Delivery by Company Vehicle Before Passage of Title
+ - `FR010200` – Delivery by Company Vehicle After Passage of Title
+ - `NT` – Non-Taxable
+ maxLength: 50
+ required:
+ - code
+ - name
+ ShippingMethodUpdate:
+ type: object
+ properties:
+ code:
+ type: string
+ title: Code
+ description: The internal name used identify the shipping method.
+ pattern: "/^[a-z0-9_+-]+$/i"
+ maxLength: 50
+ name:
+ type: string
+ title: Name
+ description: The name of the shipping method displayed to customers.
+ maxLength: 100
+ accounting_code:
+ type: string
+ title: Accounting Code
+ description: Accounting code for shipping method.
+ maxLength: 20
+ tax_code:
+ type: string
+ title: Tax code
+ description: |
+ Used by Avalara, Vertex, and Recurly’s built-in tax feature. The tax
+ code values are specific to each tax system. If you are using Recurly’s
+ built-in taxes the values are:
+
+ - `FR` – Common Carrier FOB Destination
+ - `FR022000` – Common Carrier FOB Origin
+ - `FR020400` – Non Common Carrier FOB Destination
+ - `FR020500` – Non Common Carrier FOB Origin
+ - `FR010100` – Delivery by Company Vehicle Before Passage of Title
+ - `FR010200` – Delivery by Company Vehicle After Passage of Title
+ - `NT` – Non-Taxable
+ maxLength: 50
ShippingFeeCreate:
type: object
properties:
method_id:
type: string
@@ -17221,12 +17964,15 @@
type: array
title: Tiers
items:
"$ref": "#/components/schemas/SubscriptionAddOnTier"
minItems: 1
- description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
- be absent.
+ description: |
+ If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object
+ must include one to many tiers with `ending_quantity` and `unit_amount`.
+ There must be one tier with an `ending_quantity` of 999999999 which is the
+ default if not provided.
revenue_schedule_type:
type: string
title: Revenue schedule type
enum:
- never
@@ -17267,12 +18013,15 @@
type: array
title: Tiers
items:
"$ref": "#/components/schemas/SubscriptionAddOnTier"
minItems: 1
- description: If the plan add-on's `tier_type` is `flat`, then `tiers` must
- be absent.
+ description: |
+ If the plan add-on's `tier_type` is `flat`, then `tiers` must be absent. The `tiers` object
+ must include one to many tiers with `ending_quantity` and `unit_amount`.
+ There must be one tier with an `ending_quantity` of 999999999 which is the
+ default if not provided.
revenue_schedule_type:
type: string
title: Revenue schedule type
enum:
- never
@@ -18171,9 +18920,13 @@
- Z
created_at:
type: string
format: date-time
title: Created at
+ updated_at:
+ type: string
+ format: date-time
+ title: Updated at
voided_at:
type: string
format: date-time
title: Voided at
collected_at: