diff --git a/lib/recurly/client/operations.rb b/lib/recurly/client/operations.rb index c1f06bed..e6ed35ab 100644 --- a/lib/recurly/client/operations.rb +++ b/lib/recurly/client/operations.rb @@ -2382,7 +2382,21 @@ def deactivate_external_product_external_product_reference(external_product_id:, delete(path, **options) end - # List a site's external subscriptions + # Create an external subscription + # + # {https://developers.recurly.com/api/v2021-02-25#operation/create_external_subscription create_external_subscription api documentation} + # + # @param body [Requests::ExternalSubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ExternalSubscriptionCreate} + # @param params [Hash] Optional query string parameters: + # + # @return [Resources::ExternalSubscription] Returns the external subscription + # + def create_external_subscription(body:, **options) + path = "/external_subscriptions" + post(path, body, Requests::ExternalSubscriptionCreate, **options) + end + + # List the external subscriptions on a site # # {https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions list_external_subscriptions api documentation} # @@ -2413,6 +2427,21 @@ def get_external_subscription(external_subscription_id:, **options) get(path, **options) end + # Update an external subscription + # + # {https://developers.recurly.com/api/v2021-02-25#operation/put_external_subscription put_external_subscription api documentation} + # + # @param external_subscription_id [String] External subscription id + # @param params [Hash] Optional query string parameters: + # :body [Requests::ExternalSubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ExternalSubscriptionUpdate} + # + # @return [Resources::ExternalSubscription] Settings for an external subscription. + # + def put_external_subscription(external_subscription_id:, **options) + path = interpolate_path("/external_subscriptions/{external_subscription_id}", external_subscription_id: external_subscription_id) + put(path, options[:body], Requests::ExternalSubscriptionUpdate, **options) + end + # List the external invoices on an external subscription # # {https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscription_external_invoices list_external_subscription_external_invoices api documentation} diff --git a/lib/recurly/requests/account_external_subscription.rb b/lib/recurly/requests/account_external_subscription.rb new file mode 100644 index 00000000..ba169a9c --- /dev/null +++ b/lib/recurly/requests/account_external_subscription.rb @@ -0,0 +1,14 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Requests + class AccountExternalSubscription < Request + + # @!attribute account_code + # @return [String] The account code of a new or existing account to be used when creating the external subscription. + define_attribute :account_code, String + end + end +end diff --git a/lib/recurly/requests/external_account_create.rb b/lib/recurly/requests/external_account_create.rb index a392da7f..cfc7f804 100644 --- a/lib/recurly/requests/external_account_create.rb +++ b/lib/recurly/requests/external_account_create.rb @@ -11,7 +11,7 @@ class ExternalAccountCreate < Request define_attribute :external_account_code, String # @!attribute external_connection_type - # @return [String] Represents the connection type. `AppleAppStore` or `GooglePlayStore` + # @return [String] Represents the connection type. One of the connection types of your enabled App Connectors define_attribute :external_connection_type, String end end diff --git a/lib/recurly/requests/external_account_update.rb b/lib/recurly/requests/external_account_update.rb index de019417..66c2ed98 100644 --- a/lib/recurly/requests/external_account_update.rb +++ b/lib/recurly/requests/external_account_update.rb @@ -11,7 +11,7 @@ class ExternalAccountUpdate < Request define_attribute :external_account_code, String # @!attribute external_connection_type - # @return [String] Represents the connection type. `AppleAppStore` or `GooglePlayStore` + # @return [String] Represents the connection type. One of the connection types of your enabled App Connectors define_attribute :external_connection_type, String end end diff --git a/lib/recurly/requests/external_product_reference_base.rb b/lib/recurly/requests/external_product_reference_base.rb index c9340d5d..cb2d68bf 100644 --- a/lib/recurly/requests/external_product_reference_base.rb +++ b/lib/recurly/requests/external_product_reference_base.rb @@ -7,8 +7,8 @@ module Requests class ExternalProductReferenceBase < Request # @!attribute external_connection_type - # @return [String] - define_attribute :external_connection_type, String + # @return [ExternalProductReferenceConnectionType] Represents the connection type. One of the connection types of your enabled App Connectors + define_attribute :external_connection_type, :ExternalProductReferenceConnectionType # @!attribute reference_code # @return [String] A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. diff --git a/lib/recurly/requests/external_product_reference_connection_type.rb b/lib/recurly/requests/external_product_reference_connection_type.rb new file mode 100644 index 00000000..969b5a4f --- /dev/null +++ b/lib/recurly/requests/external_product_reference_connection_type.rb @@ -0,0 +1,10 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Requests + class ExternalProductReferenceConnectionType < Request + end + end +end diff --git a/lib/recurly/requests/external_product_reference_create.rb b/lib/recurly/requests/external_product_reference_create.rb index 2b9f10da..533e9cad 100644 --- a/lib/recurly/requests/external_product_reference_create.rb +++ b/lib/recurly/requests/external_product_reference_create.rb @@ -7,8 +7,8 @@ module Requests class ExternalProductReferenceCreate < Request # @!attribute external_connection_type - # @return [String] - define_attribute :external_connection_type, String + # @return [ExternalProductReferenceConnectionType] Represents the connection type. One of the connection types of your enabled App Connectors + define_attribute :external_connection_type, :ExternalProductReferenceConnectionType # @!attribute reference_code # @return [String] A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. diff --git a/lib/recurly/requests/external_product_reference_update.rb b/lib/recurly/requests/external_product_reference_update.rb new file mode 100644 index 00000000..7fac9b03 --- /dev/null +++ b/lib/recurly/requests/external_product_reference_update.rb @@ -0,0 +1,18 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Requests + class ExternalProductReferenceUpdate < Request + + # @!attribute external_connection_type + # @return [ExternalProductReferenceConnectionType] Represents the connection type. One of the connection types of your enabled App Connectors + define_attribute :external_connection_type, :ExternalProductReferenceConnectionType + + # @!attribute reference_code + # @return [String] A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store. + define_attribute :reference_code, String + end + end +end diff --git a/lib/recurly/requests/external_subscription_create.rb b/lib/recurly/requests/external_subscription_create.rb new file mode 100644 index 00000000..47ad810b --- /dev/null +++ b/lib/recurly/requests/external_subscription_create.rb @@ -0,0 +1,62 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Requests + class ExternalSubscriptionCreate < Request + + # @!attribute account + # @return [AccountExternalSubscription] + define_attribute :account, :AccountExternalSubscription + + # @!attribute activated_at + # @return [DateTime] When the external subscription was activated in the external platform. + define_attribute :activated_at, DateTime + + # @!attribute app_identifier + # @return [String] Identifier of the app that generated the external subscription. + define_attribute :app_identifier, String + + # @!attribute auto_renew + # @return [Boolean] An indication of whether or not the external subscription will auto-renew at the expiration date. + define_attribute :auto_renew, :Boolean + + # @!attribute expires_at + # @return [DateTime] When the external subscription expires in the external platform. + define_attribute :expires_at, DateTime + + # @!attribute external_id + # @return [String] Id of the subscription in the external system, i.e. Apple App Store or Google Play Store. + define_attribute :external_id, String + + # @!attribute external_product_reference + # @return [ExternalProductReferenceCreate] + define_attribute :external_product_reference, :ExternalProductReferenceCreate + + # @!attribute imported + # @return [Boolean] An indication of whether or not the external subscription was being created by a historical data import. + define_attribute :imported, :Boolean + + # @!attribute last_purchased + # @return [DateTime] When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. + define_attribute :last_purchased, DateTime + + # @!attribute quantity + # @return [Integer] An indication of the quantity of a subscribed item's quantity. + define_attribute :quantity, Integer + + # @!attribute state + # @return [String] External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. + define_attribute :state, String + + # @!attribute trial_ends_at + # @return [DateTime] When the external subscription trial period ends in the external platform. + define_attribute :trial_ends_at, DateTime + + # @!attribute trial_started_at + # @return [DateTime] When the external subscription trial period started in the external platform. + define_attribute :trial_started_at, DateTime + end + end +end diff --git a/lib/recurly/requests/external_subscription_update.rb b/lib/recurly/requests/external_subscription_update.rb new file mode 100644 index 00000000..f3be3bab --- /dev/null +++ b/lib/recurly/requests/external_subscription_update.rb @@ -0,0 +1,58 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Requests + class ExternalSubscriptionUpdate < Request + + # @!attribute activated_at + # @return [DateTime] When the external subscription was activated in the external platform. + define_attribute :activated_at, DateTime + + # @!attribute app_identifier + # @return [String] Identifier of the app that generated the external subscription. + define_attribute :app_identifier, String + + # @!attribute auto_renew + # @return [Boolean] An indication of whether or not the external subscription will auto-renew at the expiration date. + define_attribute :auto_renew, :Boolean + + # @!attribute expires_at + # @return [DateTime] When the external subscription expires in the external platform. + define_attribute :expires_at, DateTime + + # @!attribute external_id + # @return [String] Id of the subscription in the external system, i.e. Apple App Store or Google Play Store. + define_attribute :external_id, String + + # @!attribute external_product_reference + # @return [ExternalProductReferenceUpdate] + define_attribute :external_product_reference, :ExternalProductReferenceUpdate + + # @!attribute imported + # @return [Boolean] An indication of whether or not the external subscription was being created by a historical data import. + define_attribute :imported, :Boolean + + # @!attribute last_purchased + # @return [DateTime] When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade. + define_attribute :last_purchased, DateTime + + # @!attribute quantity + # @return [Integer] An indication of the quantity of a subscribed item's quantity. + define_attribute :quantity, Integer + + # @!attribute state + # @return [String] External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused. + define_attribute :state, String + + # @!attribute trial_ends_at + # @return [DateTime] When the external subscription trial period ends in the external platform. + define_attribute :trial_ends_at, DateTime + + # @!attribute trial_started_at + # @return [DateTime] When the external subscription trial period started in the external platform. + define_attribute :trial_started_at, DateTime + end + end +end diff --git a/lib/recurly/requests/invoice_create.rb b/lib/recurly/requests/invoice_create.rb index 78f0e3f6..ac32097e 100644 --- a/lib/recurly/requests/invoice_create.rb +++ b/lib/recurly/requests/invoice_create.rb @@ -6,6 +6,14 @@ module Recurly module Requests class InvoiceCreate < Request + # @!attribute business_entity_code + # @return [String] The `business_entity_code` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_code, String + + # @!attribute business_entity_id + # @return [String] The `business_entity_id` is the value that represents a specific business entity for an end customer which will be assigned to the invoice. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_id, String + # @!attribute charge_customer_notes # @return [String] This will default to the Customer Notes text specified on the Invoice Settings for charge invoices. Specify custom notes to add or override Customer Notes on charge invoices. define_attribute :charge_customer_notes, String diff --git a/lib/recurly/requests/purchase_create.rb b/lib/recurly/requests/purchase_create.rb index 8f00e592..19178c36 100644 --- a/lib/recurly/requests/purchase_create.rb +++ b/lib/recurly/requests/purchase_create.rb @@ -14,6 +14,14 @@ class PurchaseCreate < Request # @return [String] The `billing_info_id` is the value that represents a specific billing info for an end customer. When `billing_info_id` is used to assign billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. define_attribute :billing_info_id, String + # @!attribute business_entity_code + # @return [String] The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_code, String + + # @!attribute business_entity_id + # @return [String] The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_id, String + # @!attribute collection_method # @return [String] Must be set to manual in order to preview a purchase for an Account that does not have payment information associated with the Billing Info. define_attribute :collection_method, String @@ -70,6 +78,10 @@ class PurchaseCreate < Request # @return [String] Terms and conditions to be put on the purchase invoice. define_attribute :terms_and_conditions, String + # @!attribute transaction + # @return [Hash] (Transaction Data, Card on File) - Options for flagging transactions as Customer or Merchant Initiated Unscheduled. + define_attribute :transaction, Hash + # @!attribute transaction_type # @return [String] An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions. define_attribute :transaction_type, String diff --git a/lib/recurly/requests/subscription_change_create.rb b/lib/recurly/requests/subscription_change_create.rb index c9bbd24a..3f7b9320 100644 --- a/lib/recurly/requests/subscription_change_create.rb +++ b/lib/recurly/requests/subscription_change_create.rb @@ -14,6 +14,14 @@ class SubscriptionChangeCreate < Request # @return [SubscriptionChangeBillingInfoCreate] define_attribute :billing_info, :SubscriptionChangeBillingInfoCreate + # @!attribute business_entity_code + # @return [String] The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. + define_attribute :business_entity_code, String + + # @!attribute business_entity_id + # @return [String] The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. Only allowed if the `timeframe` is not `now`. + define_attribute :business_entity_id, String + # @!attribute collection_method # @return [String] Collection method define_attribute :collection_method, String diff --git a/lib/recurly/requests/subscription_create.rb b/lib/recurly/requests/subscription_create.rb index 9b885531..3bf9898d 100644 --- a/lib/recurly/requests/subscription_create.rb +++ b/lib/recurly/requests/subscription_create.rb @@ -26,6 +26,14 @@ class SubscriptionCreate < Request # @return [Boolean] Optional field to be used only when needing to bypass the 60 second limit on creating subscriptions. Should only be used when creating subscriptions in bulk from the API. define_attribute :bulk, :Boolean + # @!attribute business_entity_code + # @return [String] The `business_entity_code` is the value that represents a specific business entity for an end customer. When `business_entity_code` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_code, String + + # @!attribute business_entity_id + # @return [String] The `business_entity_id` is the value that represents a specific business entity for an end customer. When `business_entity_id` is used to assign a business entity to the subscription, all future billing events for the subscription will bill to the specified business entity. Available when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` and `business_entity_code` are present, `business_entity_id` will be used. + define_attribute :business_entity_id, String + # @!attribute collection_method # @return [String] Collection method define_attribute :collection_method, String diff --git a/lib/recurly/resources/business_entity_mini.rb b/lib/recurly/resources/business_entity_mini.rb new file mode 100644 index 00000000..c55090ae --- /dev/null +++ b/lib/recurly/resources/business_entity_mini.rb @@ -0,0 +1,26 @@ +# This file is automatically created by Recurly's OpenAPI generation process +# and thus any edits you make by hand will be lost. If you wish to make a +# change to this file, please create a Github issue explaining the changes you +# need and we will usher them to the appropriate places. +module Recurly + module Resources + class BusinessEntityMini < Resource + + # @!attribute code + # @return [String] The entity code of the business entity. + define_attribute :code, String + + # @!attribute id + # @return [String] Business entity ID + define_attribute :id, String + + # @!attribute name + # @return [String] This name describes your business entity and will appear on the invoice. + define_attribute :name, String + + # @!attribute object + # @return [String] Object type + define_attribute :object, String + end + end +end diff --git a/lib/recurly/resources/subscription.rb b/lib/recurly/resources/subscription.rb index 86bb41fc..d03aff09 100644 --- a/lib/recurly/resources/subscription.rb +++ b/lib/recurly/resources/subscription.rb @@ -42,6 +42,10 @@ class Subscription < Resource # @return [String] Billing Info ID. define_attribute :billing_info_id, String + # @!attribute business_entity_id + # @return [String] The ID of the business entity associated with the subscription. This will be `null` if the subscription relies on resolving the business entity during renewal. + define_attribute :business_entity_id, String + # @!attribute canceled_at # @return [DateTime] Canceled at define_attribute :canceled_at, DateTime diff --git a/lib/recurly/resources/subscription_change.rb b/lib/recurly/resources/subscription_change.rb index 64b1c55e..e4fd8cf9 100644 --- a/lib/recurly/resources/subscription_change.rb +++ b/lib/recurly/resources/subscription_change.rb @@ -22,6 +22,10 @@ class SubscriptionChange < Resource # @return [SubscriptionChangeBillingInfo] Accept nested attributes for three_d_secure_action_result_token_id define_attribute :billing_info, :SubscriptionChangeBillingInfo + # @!attribute business_entity + # @return [BusinessEntityMini] Business entity details + define_attribute :business_entity, :BusinessEntityMini + # @!attribute created_at # @return [DateTime] Created at define_attribute :created_at, DateTime diff --git a/lib/recurly/resources/transaction.rb b/lib/recurly/resources/transaction.rb index e2b11b32..8c943506 100644 --- a/lib/recurly/resources/transaction.rb +++ b/lib/recurly/resources/transaction.rb @@ -90,6 +90,10 @@ class Transaction < Resource # @return [String] Transaction ID define_attribute :id, String + # @!attribute indicator + # @return [String] Must be sent for one-time transactions in order to provide context on which entity is submitting the transaction to ensure proper fraud checks are observed, such as 3DS. If the customer is in session, send `customer`. If this is a merchant initiated one-time transaction, send `merchant`. + define_attribute :indicator, String + # @!attribute invoice # @return [InvoiceMini] Invoice mini details define_attribute :invoice, :InvoiceMini @@ -102,6 +106,10 @@ class Transaction < Resource # @return [String] IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. define_attribute :ip_address_v4, String + # @!attribute merchant_reason_code + # @return [String] This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. Only use this if the initiator value is "merchant". Otherwise, it will be ignored. - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. + define_attribute :merchant_reason_code, String + # @!attribute object # @return [String] Object type define_attribute :object, String diff --git a/openapi/api.yaml b/openapi/api.yaml index bcad8e35..460dd35f 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -8198,11 +8198,49 @@ paths: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions": + post: + tags: + - external_subscriptions + operationId: create_external_subscription + summary: Create an external subscription + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscriptionCreate" + required: true + responses: + '201': + description: Returns the external subscription + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscription" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: External subscription cannot be completed for the specified + reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] get: tags: - external_subscriptions operationId: list_external_subscriptions - summary: List a site's external subscriptions + summary: List the external subscriptions on a site description: See the [Pagination Guide](/developers/guides/pagination.html) to learn how to use pagination in the API and Client Libraries. parameters: @@ -8228,9 +8266,9 @@ paths: "$ref": "#/components/schemas/Error" x-code-samples: [] "/external_subscriptions/{external_subscription_id}": - parameters: - - "$ref": "#/components/parameters/external_subscription_id_fetch" get: + parameters: + - "$ref": "#/components/parameters/external_subscription_id_fetch" tags: - external_subscriptions operationId: get_external_subscription @@ -8262,6 +8300,52 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] + put: + parameters: + - "$ref": "#/components/parameters/external_subscription_id" + tags: + - external_subscriptions + operationId: put_external_subscription + summary: Update an external subscription + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscriptionUpdate" + required: false + responses: + '200': + description: Settings for an external subscription. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalSubscription" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: Incorrect site or external subscription ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Validation error with external resource connection or feature + flag. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/external_subscriptions/{external_subscription_id}/external_invoices": parameters: - "$ref": "#/components/parameters/external_subscription_id" @@ -20294,6 +20378,22 @@ components: title: Currency description: 3-letter ISO 4217 currency code. maxLength: 3 + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer which will be assigned to the invoice. + Available when the `Multiple Business Entities` feature is enabled. If + both `business_entity_id` and `business_entity_code` are present, `business_entity_id` + will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer which will be assigned to the invoice. + Available when the `Multiple Business Entities` feature is enabled. If + both `business_entity_id` and `business_entity_code` are present, `business_entity_id` + will be used. collection_method: title: Collection method description: An automatic invoice means a corresponding transaction is run @@ -22820,6 +22920,13 @@ components: subscription. maxLength: 13 readOnly: true + business_entity_id: + type: string + title: Business Entity ID + description: The ID of the business entity associated with the subscription. + This will be `null` if the subscription relies on resolving the business + entity during renewal. + maxLength: 13 started_with_gift: type: boolean default: false @@ -23186,6 +23293,9 @@ components: invoice_collection: title: Invoice Collection "$ref": "#/components/schemas/InvoiceCollection" + business_entity: + title: Business Entity + "$ref": "#/components/schemas/BusinessEntityMini" custom_fields: "$ref": "#/components/schemas/CustomFields" created_at: @@ -23251,6 +23361,26 @@ components: maxLength: 50 description: If you want to change to a new plan, you can provide the plan's code or id. If both are provided the `plan_id` will be used. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + Only allowed if the `timeframe` is not `now`. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + Only allowed if the `timeframe` is not `now`. unit_amount: type: number format: float @@ -23399,6 +23529,24 @@ components: maxLength: 13 description: You must provide either a `plan_code` or `plan_id`. If both are provided the `plan_id` will be used. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. account: "$ref": "#/components/schemas/AccountCreate" billing_info_id: @@ -24023,8 +24171,12 @@ components: maxLength: 13 account: "$ref": "#/components/schemas/AccountMini" + indicator: + "$ref": "#/components/schemas/TransactionIndicatorEnum" invoice: "$ref": "#/components/schemas/InvoiceMini" + merchant_reason_code: + "$ref": "#/components/schemas/TransactionMerchantReasonCodeEnum" voided_by_invoice: "$ref": "#/components/schemas/InvoiceMini" subscription_ids: @@ -24511,6 +24663,24 @@ components: billing info to the subscription, all future billing events for the subscription will bill to the specified billing info. `billing_info_id` can ONLY be used for sites utilizing the Wallet feature. + business_entity_id: + type: string + title: Business Entity ID + description: The `business_entity_id` is the value that represents a specific + business entity for an end customer. When `business_entity_id` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. + business_entity_code: + type: string + title: Business Entity Code + description: The `business_entity_code` is the value that represents a specific + business entity for an end customer. When `business_entity_code` is used + to assign a business entity to the subscription, all future billing events + for the subscription will bill to the specified business entity. Available + when the `Multiple Business Entities` feature is enabled. If both `business_entity_id` + and `business_entity_code` are present, `business_entity_id` will be used. collection_method: title: Collection method description: Must be set to manual in order to preview a purchase for an @@ -24552,6 +24722,17 @@ components: type: string title: Terms and conditions description: Terms and conditions to be put on the purchase invoice. + transaction: + type: object + description: "(Transaction Data, Card on File) - Options for flagging transactions + as Customer or Merchant Initiated Unscheduled." + allOf: + - type: object + properties: + indicator: + "$ref": "#/components/schemas/Transaction/properties/indicator" + merchant_reason_code: + "$ref": "#/components/schemas/Transaction/properties/merchant_reason_code" customer_notes: type: string title: Customer notes @@ -24807,6 +24988,38 @@ components: type: string format: date-time description: Time the object was last updated + ExternalChargeCreate: + type: object + properties: + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + unit_amount: + type: string + format: decimal + quantity: + type: integer + description: + type: string + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceCreate" + required: + - quantity + - currency + - unit_amount + AccountExternalSubscription: + allOf: + - type: object + properties: + account_code: + type: string + description: The account code of a new or existing account to be used + when creating the external subscription. + maxLength: 50 + required: + - account_code ExternalPaymentPhase: type: object description: Details of payments in the lifecycle of a subscription from an @@ -24974,7 +25187,7 @@ components: Google Play Store. maxLength: 255 external_connection_type: - "$ref": "#/components/schemas/ExternalProductReferenceConnectionTypeEnum" + "$ref": "#/components/schemas/ExternalProductReferenceConnectionType" ExternalProductReferenceCollection: type: object properties: @@ -25001,11 +25214,10 @@ components: ExternalProductReferenceUpdate: allOf: - "$ref": "#/components/schemas/ExternalProductReferenceBase" - ExternalProductReferenceConnectionTypeEnum: + ExternalProductReferenceConnectionType: type: string - enum: - - apple_app_store - - google_play_store + description: Represents the connection type. One of the connection types of + your enabled App Connectors ExternalAccountList: type: object properties: @@ -25031,7 +25243,8 @@ components: description: Represents the account code for the external account. external_connection_type: type: string - description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + description: Represents the connection type. One of the connection types + of your enabled App Connectors required: - external_account_code - external_connection_type @@ -25043,7 +25256,8 @@ components: description: Represents the account code for the external account. external_connection_type: type: string - description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + description: Represents the connection type. One of the connection types + of your enabled App Connectors ExternalAccount: type: object title: External Account @@ -25217,6 +25431,91 @@ components: format: date-time title: Updated at description: When the external subscription was updated in Recurly. + ExternalSubscriptionBase: + type: object + properties: + external_id: + type: string + title: External Id + description: Id of the subscription in the external system, i.e. Apple App + Store or Google Play Store. + last_purchased: + type: string + format: date-time + title: Last purchased + description: When a new billing event occurred on the external subscription + in conjunction with a recent billing period, reactivation or upgrade/downgrade. + auto_renew: + type: boolean + title: Auto-renew + description: An indication of whether or not the external subscription will + auto-renew at the expiration date. + default: false + state: + type: string + description: External subscriptions can be active, canceled, expired, past_due, + voided, revoked, or paused. + default: active + app_identifier: + type: string + title: App identifier + description: Identifier of the app that generated the external subscription. + quantity: + type: integer + title: Quantity + description: An indication of the quantity of a subscribed item's quantity. + default: 1 + minimum: 0 + activated_at: + type: string + format: date-time + title: Activated at + description: When the external subscription was activated in the external + platform. + expires_at: + type: string + format: date-time + title: Expires at + description: When the external subscription expires in the external platform. + trial_started_at: + type: string + format: date-time + title: Trial started at + description: When the external subscription trial period started in the + external platform. + trial_ends_at: + type: string + format: date-time + title: Trial ends at + description: When the external subscription trial period ends in the external + platform. + imported: + type: boolean + title: Import + description: An indication of whether or not the external subscription was + being created by a historical data import. + default: false + ExternalSubscriptionCreate: + allOf: + - type: object + properties: + account: + "$ref": "#/components/schemas/AccountExternalSubscription" + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceCreate" + - "$ref": "#/components/schemas/ExternalSubscriptionBase" + required: + - external_id + - quantity + - activated_at + - expires_at + ExternalSubscriptionUpdate: + allOf: + - type: object + properties: + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceUpdate" + - "$ref": "#/components/schemas/ExternalSubscriptionBase" ExternalSubscriptionList: type: object properties: @@ -25282,6 +25581,86 @@ components: format: date-time title: Updated at description: When the external invoice was updated in Recurly. + ExternalPaymentPhaseBase: + type: object + properties: + started_at: + type: string + format: date-time + title: Started At + ends_at: + type: string + format: date-time + title: Ends At + starting_billing_period_index: + type: integer + title: Starting Billing Period Index + ending_billing_period_index: + type: integer + title: Ending Billing Period Index + offer_type: + type: string + title: Offer Type + description: Type of discount offer given, e.g. "FREE_TRIAL" + offer_name: + type: string + title: Offer Name + description: Name of the discount offer given, e.g. "introductory" + period_count: + type: integer + title: Period Count + description: Number of billing periods + period_length: + type: string + title: Period Length + description: Billing cycle length + amount: + type: string + format: decimal + title: Amount + minimum: 0 + description: Allows up to 9 decimal places + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + ExternalInvoiceCreate: + type: object + properties: + external_id: + type: string + description: An identifier which associates the external invoice to a corresponding + object in an external platform. + state: + "$ref": "#/components/schemas/ExternalInvoiceStateEnum" + total: + type: string + format: decimal + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + maxLength: 3 + purchased_at: + type: string + format: date-time + description: When the invoice was created in the external platform. + line_items: + type: array + items: + "$ref": "#/components/schemas/ExternalChargeCreate" + external_payment_phase: + "$ref": "#/components/schemas/ExternalPaymentPhaseBase" + external_payment_phase_id: + type: string + description: External payment phase ID, e.g. `a34ypb2ef9w1`. + required: + - external_id + - state + - total + - currency + - purchased_at ExternalInvoiceList: type: object properties: @@ -25584,6 +25963,30 @@ components: format: date-time title: Last updated at readOnly: true + BusinessEntityMini: + type: object + description: Business entity details + properties: + id: + title: Business entity ID + type: string + maxLength: 13 + readOnly: true + object: + title: Object type + type: string + readOnly: true + code: + title: Business entity code + type: string + maxLength: 50 + description: The entity code of the business entity. + name: + type: string + title: Name + description: This name describes your business entity and will appear on + the invoice. + maxLength: 255 GiftCardList: type: object properties: @@ -26907,3 +27310,32 @@ components: enum: - destination - origin + TransactionMerchantReasonCodeEnum: + type: string + default: none + description: | + This conditional parameter is useful for merchants in specific industries who need to submit one-time Merchant Initiated transactions in specific cases. + Not all gateways support these methods, but will support a generic one-time Merchant Initiated transaction. + Only use this if the initiator value is "merchant". Otherwise, it will be ignored. + - Incremental: Send `incremental` with an additional purchase if the original authorization amount is not sufficient to cover the costs of your service or product. For example, if the customer adds goods or services or there are additional expenses. + - No Show: Send `no_show` if you charge customers a fee due to an agreed-upon cancellation policy in your industry. + - Resubmission: Send `resubmission` if you need to attempt collection on a declined transaction. You may also use the force collection behavior which has the same effect. + - Service Extension: Send `service_extension` if you are in a service industry and the customer has increased/extended their service in some way. For example: adding a day onto a car rental agreement. + - Split Shipment: Send `split_shipment` if you sell physical product and need to split up a shipment into multiple transactions when the customer is no longer in session. + - Top Up: Send `top_up` if you process one-time transactions based on a pre-arranged agreement with your customer where there is a pre-arranged account balance that needs maintaining. For example, if the customer has agreed to maintain an account balance of 30.00 and their current balance is 20.00, the MIT amount would be at least 10.00 to meet that 30.00 threshold. + enum: + - incremental + - no_show + - resubmission + - service_extension + - split_shipment + - top_up + TransactionIndicatorEnum: + type: string + description: Must be sent for one-time transactions in order to provide context + on which entity is submitting the transaction to ensure proper fraud checks + are observed, such as 3DS. If the customer is in session, send `customer`. + If this is a merchant initiated one-time transaction, send `merchant`. + enum: + - customer + - merchant