openapi/api.yaml in recurly-3.23.0 vs openapi/api.yaml in recurly-3.24.0
- old
+ new
@@ -7879,10 +7879,12 @@
- invoice
operationId: apply_credit_balance
summary: Apply available credit to a pending or past due charge invoice
description: Apply credit payment to the outstanding balance on an existing
charge invoice from an account’s available balance from existing credit invoices.
+ Credit that was refunded from the invoice cannot be applied back to the invoice
+ as payment.
parameters:
- "$ref": "#/components/parameters/site_id"
- "$ref": "#/components/parameters/invoice_id"
responses:
'200':
@@ -7897,22 +7899,111 @@
application/json:
schema:
"$ref": "#/components/schemas/Error"
'422':
description: Tried applying credit to a legacy or closed invoice or there
- was an error processing the credit payment.
+ was an error processing the credit payment, such as no available credit
+ on the account.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
- x-code-samples: []
+ x-code-samples:
+ - lang: Node.js
+ source: |
+ try {
+ const invoice = await client.applyCreditBalance(invoiceId)
+ console.log('Applied credit balance to 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.apply_credit_balance(invoice_id)
+ print("Applied credit balance to invoice %s" % invoice.id)
+ except recurly.errors.NotFoundError:
+ # If the resource was not found, you may want to alert the user or
+ # just return nil
+ print("Resource Not Found")
+ - lang: ".NET"
+ source: |
+ try
+ {
+ Invoice invoice = client.ApplyCreditBalance(invoiceId);
+ Console.WriteLine($"Applied credit balance to invoice #{invoice.Number}");
+ }
+ 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: Ruby
+ source: |
+ begin
+ invoice = @client.apply_credit_balance(invoice_id: invoice_id)
+ puts "Applied credit balance to 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: Java
+ source: |
+ try {
+ final Invoice invoice = client.applyCreditBalance(invoiceId);
+ System.out.println("Applied credit balance to 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->applyCreditBalance($invoice_id);
+
+ echo 'Applied credit balance to 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);
+ }
+ - lang: Go
+ source: "invoice, err := client.ApplyCreditBalance(invoiceID)\nif e, ok :=
+ err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed
+ validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
+ Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Applied credit
+ balance to invoice: %v\", invoice)"
"/sites/{site_id}/invoices/{invoice_id}/collect":
put:
tags:
- invoice
operationId: collect_invoice
@@ -15478,10 +15569,15 @@
- ru-RU
- sk-SK
- sv-SE
- tr-TR
- zh-CN
+ preferred_time_zone:
+ type: string
+ example: America/Los_Angeles
+ description: Used to determine the time zone of emails sent on behalf of
+ the merchant to the customer. Must be a [supported IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names)
cc_emails:
type: string
description: Additional email address that should receive account correspondence.
These should be separated only by commas. These CC emails will receive
all emails that the `email` field also receives.
@@ -15610,10 +15706,16 @@
- ru-RU
- sk-SK
- sv-SE
- tr-TR
- zh-CN
+ preferred_time_zone:
+ type: string
+ example: America/Los_Angeles
+ description: The [IANA time zone name](https://docs.recurly.com/docs/email-time-zones-and-time-stamps#supported-api-iana-time-zone-names)
+ used to determine the time zone of emails sent on behalf of the merchant
+ to the customer.
cc_emails:
type: string
description: Additional email address that should receive account correspondence.
These should be separated only by commas. These CC emails will receive
all emails that the `email` field also receives.
@@ -17762,10 +17864,14 @@
maxLength: 13
previous_invoice_id:
type: string
title: Previous invoice ID
description: On refund invoices, this value will exist and show the invoice
- ID of the purchase invoice the refund was created from.
+ ID of the purchase invoice the refund was created from. This field is
+ only populated for sites without the [Only Bill What Changed](https://docs.recurly.com/docs/only-bill-what-changed)
+ feature enabled. Sites with Only Bill What Changed enabled should use
+ the [related_invoices endpoint](https://recurly.com/developers/api/v2019-10-10/index.html#operation/list_related_invoices)
+ to see purchase invoices refunded by this invoice.
maxLength: 13
number:
type: string
title: Invoice number
description: 'If VAT taxation and the Country Invoice Sequencing feature