Change subscription order items

Request

Changes subscription order items or quantities, and designates if or when pro-rata credits should be given.

Security
SecretApiKey or JWT
Path
idstring, <= 50 characters^[@~\-\.\w]+$required

ID of the resource.

Query
expandstring

Expand a response to receive a full related object in the _embedded path.

To expand multiple objects, use a comma-separated list. Example: expand=recentInvoice,initialInvoice.

Available arguments are:

  • customer
  • leadSource
  • website
  • shippingRate
  • initialInvoice
  • recentInvoice
  • upcomingInvoice
  • paymentInstrument

For more information, see Embedded resources.

Bodyapplication/jsonrequired

Change items request.

itemsArray of objects, non-emptyrequired

Details of items in the order.

renewalPolicystringrequired

How the service periods and trial state of the subscription order are managed when its items change.

The reset and retain values are deprecated. The deprecated keepTrial and ignoreRecurring are ignored unless reset or retain is used.

Enum ValueDescription
resetToRecurring

Resets the service periods, ends any trial, and converts trial-only items to recurring.

retainRecurring

Retains the current service periods, ends any trial, and converts trial-only items to recurring.

retainTrialThenRecurring

Retains the trial until it ends, then converts the item to recurring. Returns a validation error if the order has no trial.

retainTrialOnly

Retains the trial and keeps the item as trial-only. Returns a validation error if the order is not trial-only.

reset

Deprecated. Use resetToRecurring instead. Resets the renewalTime to a newly calculated value.

retain

Deprecated. Use retainRecurring, retainTrialThenRecurring, or retainTrialOnly instead. Retains the current renewalTime.

proratedbooleanrequired

Specifies whether to give a pro rata credit for the amount of time remaining between the effectiveTime and the end of the current period.

In addition, if the renewalTime is retained, by setting the renewalPolicy to retainRecurring, retainTrialThenRecurring or retainTrialOnly, a pro rata debit occurs for the amount between the effectiveTime and the renewalTime as a percentage of the normal period size.

effectiveTimestring, (date-time)

Date from which the renewal time for reset operations and proration calculations are made. If this field is omitted, this value defaults to the current time.

previewboolean

Specifies if changes to the subscription can be previewed. Subscriptions cannot be changed in preview.

Default:false
keepTrialbooleandeprecated

Deprecated. Use the retainTrialThenRecurring or retainTrialOnly value of renewalPolicy instead.

Specifies if the order must retain its active trial. This field is only applicable if renewalPolicy is set to the deprecated value retain.

Default:false
ignoreRecurringbooleandeprecated

Deprecated. Use the retainTrialOnly value of renewalPolicy instead.

Specifies if the order must ignore the recurring settings of its items. This field is only applicable if the order is trial-only and the keepTrial value is true. For more information, see Trial-only order.

Default:false
curl -i -X POST \
  'https://www.rebilly.com/_mock/catalog/all/subscriptions/{id}/change-items?expand=string' \
  -H 'Content-Type: application/json' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE' \
  -d '{
    "items": [
      {
        "plan": {
          "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21"
        },
        "quantity": 0,
        "usageLimits": {
          "softLimit": {
            "quantity": 0
          },
          "hardLimit": {
            "quantity": 0
          },
          "trialLimit": 20.725
        }
      }
    ],
    "renewalPolicy": "resetToRecurring",
    "prorated": true,
    "effectiveTime": "2019-08-24T14:15:22Z",
    "preview": false,
    "keepTrial": false,
    "ignoreRecurring": false
  }'

Responses

Order changed.

Headers
Locationstring, (uri)

Location of the related resource.

Example:"https://api.rebilly.com/example"
X-RateLimit-Limitinteger

Total number of rate limit tokens for this request within a rate limit period. For more information, see Rate limits.

Example:3600
X-RateLimit-Remaininginteger

Remaining number of rate limit tokens for this request within the rate limit period. For example, in the sandbox environment, rate limits for non-GET endpoints are set at 3000 requests per 10 minutes.

Example:3600
Bodyapplication/json
idstring, <= 50 charactersread-only

ID of the order.

Example:"sub_01HRF27SATGE4Z6PBJE6PD8328"
orderTypestringrequired

Specifies the type of order. An order may be a subscription or a one-time purchase.

Note: The order type cannot be changed after creation.

Value:"subscription-order"
Discriminator
customerIdstring, <= 50 characters(CustomerId)required

ID of the customer resource.

Example:"cus_0YV7DDSDD1C8DA64KHH2W33CPF"
renewalReminderTimestring or null, (date-time)read-only

Date and time when the renewal reminder event triggers.

renewalReminderNumberinteger or nullread-only

Number of triggered renewal reminder events.

abandonReminderTimestring or null, (date-time)read-only

Date and time when the abandon order reminder event triggers.

abandonReminderNumberinteger or nullread-only

Number of abandon order reminder events that are triggered.

organizationIdstring, <= 50 characters(OrganizationId)read-only

Unique organization identifier. An organization is an entity that represents a company. For more information, see Obtain an organization ID.

Example:"org_0YVDM8RC7GDADADSBSMW124JA8"
statusstringread-only

Status of the subscription service. A subscription starts in the pending status, and becomes active when the service period begins.

Enum:"pending""active""abandoned""canceled""churned""paused""voided""completed""trial-ended"
inTrialbooleanread-only

Specifies if the subscription is currently in a trial period.

trialobject

Details of the trial. To use plan defaults, omit the trial key or set this value to null.

isTrialOnlyboolean

Specifies if a subscription ends after a trial period. If this value is true, recurring settings are ignored.

Default:false
trialConversionTimestring or null, (date-time)read-only

Date and time when the subscription had a trial conversion. Trial conversion occurs when the first successful payment is made after a trial period.

invoiceTimeShiftobject or null(InvoiceTimeShift)

Shifts issue time and due time of invoices for this subscription.

This setting overrides plan settings. To use plan settings, set this value to null.

To use multiple plans in one subscription, all plans must have the same billing period, this property enables the customer to subscribe to different plans.

recurringIntervalobject or null

Recurring interval to override plan settings. To use plan settings, set this value to null.

To use multiple plans in one subscription, all plans must have the same recurring period length.

Example:null
autopayboolean

Specifies if payment attempts are made automatically. If autopay is enabled, the payment is retrieved from the customer on the renewal date using the payment instrument that is set at paymentInstrumentId, or the default payment instrument on the subscription.

Default:true
startTimestring or null, (date-time)

Date and time when the subscription starts. If this value is null, the current time is used. This value cannot be more than one service period in the past.

Default:null
Example:null
churnTimestring or null, (date-time)read-only

Date and time when the subscription is deactivated.

renewalTimestring or null, (date-time)

Date and time when the subscription renews.

currentPeriodStartstring, (date-time)read-only

Date and time of the current service period start.

currentPeriodEndstring, (date-time)read-only

Date and time of the current service period end.

rebillNumberinteger or nullread-only

Current billing period number.

mrrnumber, (double)read-only

Monthly recurring revenue of the order.

Example:49.95
paymentInstrumentIdstring or null, <= 50 characters

ID of the payment instrument to use for autopay. If this value is not provided, or if the payment instrument is inactive, the customer's default payment instrument is used.

Example:"inst_0YVB8KPKNXCBR9EDX7JHSED75N"
billingStatusstringread-only

Billing status of the most recent invoice. This value may help you to determine if you should change the service status of the service, such as suspending the service.

Enum:"draft""unpaid""past-due""abandoned""paid""voided""refunded""disputed""partially-refunded""partially-paid"
websiteIdstring, <= 50 charactersrequired

ID of the website. A website is where an organization obtains a customer. For more information, see Obtain an organization ID and website ID.

Note: The ID of the website cannot be changed after creation.

Example:"web_0YV7DE4Z26DQSA1AC92FBJ7SEG"
currencystring, = 3 characters(CurrencyCode)read-only

Currency of the order.

Example:"USD"
initialInvoiceIdstring or null, <= 50 charactersread-only

ID of the initial invoice.

Example:"in_0YVF9605RKC62BP14NE2R7V2XT"
recentInvoiceIdstring or null, <= 50 charactersread-only

ID of the most recently issued invoice. The invoice might not be paid yet.

Example:"in_0YVF9605RKC62BP14NE2R7V2XT"
itemsArray of objects, non-empty(SubscriptionOrOneTimeSaleItem)required

Details of items in the order.

deliveryAddressContactObject (object) or null
One of:

Contact's information.

billingAddressContactObject (object) or null
One of:

Contact's information.

activationTimestring or null, (date-time)read-only

Date and time when the order is activated.

voidTimestring or null, (date-time)read-only

Date and time when the order is voided.

abandonTimestring or null, (date-time)

Date and time when the pending order is automatically abandoned. If this value is not passed during order creation, a pending order TTL setting is used to calculate the value.

delinquencyPeriodstring or null

Length of time, in ISO-8601 durations format, which is added to the due time of the order when setting the delinquency time for all related invoices. When the delinquency time of an invoice is reached, the order is automatically canceled.

  • If the delinquencyPeriod value is null, the order does not change state and remains active. You must explicitly configure the delinquency period to enable automatic cancellation of unpaid orders.
  • If you add a delinquency period to an active order, it is applied to all new invoices created for the order. It is not applied to the unpaid and past-due invoices. To apply a delinquency period to unpaid and past-due invoices, set the delinquencyTime parameter using the upsert an invoice API operation.

If this value is not passed during order creation, an order delinquency period setting is used to calculate the value.

Default:null
Example:"P7D"
poNumberstring or null

Purchase order number displayed on the issued invoices.

Example:"PO123456"
shippingobject(Shipping)
notesstring

Notes for the customer displayed on the order invoice.

canceledTimestring or null, (date-time)read-only

Date and time when a subscription is canceled.

canceledBystring or nullread-only

Specifies who initiated the cancellation.

Enum:"merchant""customer""rebilly"null
cancelCategorystring or nullread-only

Category of the cancellation.

Enum:"billing-failure""delinquency""did-not-use""did-not-want""missing-features""bugs-or-problems""do-not-remember""risk-warning""contract-expired""too-expensive"
cancelDescriptionstring or null, <= 255 charactersread-only

Description of the cancellation reason in free form.

revisionintegerread-only

Number of times the order data has been modified.

The revision is useful when analyzing webhook data to determine if the change takes precedence over the current representation.

riskMetadataRisk metadata (object) or null
One of:

Risk metadata used for 3D Secure and risk scoring.

billingPortalTokenstring or nullread-only

Customer JWT to access a billing portal. This field is presented only if a billing portal exists. This is an experimental field and can be changed or removed in the future.

customFieldsobject(ResourceCustomFields)

Use custom fields to extend a resource scheme to include custom data that is not provided as a common field. For more information, see Custom fields.

Default:{}
Example:
{ "foo": "bar" }
createdTimestring, (date-time)(CreatedTime)read-only

Date and time when the resource is created. This value is set automatically when the resource is created.

updatedTimestring, (date-time)(UpdatedTime)read-only

Date and time when the resource is updated. This value is set automatically when the resource is updated.

_embeddedobjectread-only

Embedded objects that are requested by the expand query parameter.

lineItemsArray of objectsread-onlydeprecated

Subscription line items which queue until the next renewal, or interim, invoice is issued for the subscription.

lineItemSubtotalobjectread-onlydeprecated

Subtotal of line items in this subscription (signed value). If credits exceed debits, this value is a negative number.

Response
{ "id": "sub_01HRF27SATGE4Z6PBJE6PD8328", "orderType": "subscription-order", "customerId": "cus_0YV7DDSDD1C8DA64KHH2W33CPF", "renewalReminderTime": "2019-08-24T14:15:22Z", "renewalReminderNumber": 0, "abandonReminderTime": "2019-08-24T14:15:22Z", "abandonReminderNumber": 0, "organizationId": "org_0YVDM8RC7GDADADSBSMW124JA8", "status": "pending", "inTrial": true, "trial": { "enabled": true, "endTime": "2019-08-24T14:15:22Z" }, "isTrialOnly": false, "trialConversionTime": "2019-08-24T14:15:22Z", "invoiceTimeShift": { "issueTimeShift": {}, "dueTimeShift": {} }, "recurringInterval": null, "autopay": true, "startTime": null, "churnTime": "2019-08-24T14:15:22Z", "renewalTime": "2019-08-24T14:15:22Z", "currentPeriodStart": "2019-08-24T14:15:22Z", "currentPeriodEnd": "2019-08-24T14:15:22Z", "rebillNumber": 0, "lineItems": [ {} ], "lineItemSubtotal": { "currency": "USD", "amount": 49.95 }, "mrr": 49.95, "paymentInstrumentId": "inst_0YVB8KPKNXCBR9EDX7JHSED75N", "billingStatus": "draft", "websiteId": "web_0YV7DE4Z26DQSA1AC92FBJ7SEG", "currency": "USD", "initialInvoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT", "recentInvoiceId": "in_0YVF9605RKC62BP14NE2R7V2XT", "items": [ {} ], "deliveryAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "phoneNumbers": [], "emails": [], "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "billingAddress": { "firstName": "Benjamin", "lastName": "Franklin", "organization": "Rebilly", "address": "36 Craven St", "address2": "string", "city": "Austin", "region": "Texas", "country": "GB", "postalCode": "WC2N 5NF", "phoneNumbers": [], "emails": [], "dob": "1980-04-01", "jobTitle": "CEO", "hash": "056ae6d97c788b9e98b049ebafd7b229bf852221" }, "activationTime": "2019-08-24T14:15:22Z", "voidTime": "2019-08-24T14:15:22Z", "abandonTime": "2019-08-24T14:15:22Z", "delinquencyPeriod": "P7D", "poNumber": "PO123456", "shipping": { "amount": 0.1, "calculator": "manual" }, "notes": "string", "canceledTime": "2019-08-24T14:15:22Z", "canceledBy": "merchant", "cancelCategory": "billing-failure", "cancelDescription": "string", "revision": 0, "riskMetadata": { "ipAddress": "93.92.91.90", "fingerprint": "pIUt3xbgX3l9g3YDiLbx", "httpHeaders": {}, "browserData": {}, "extraData": {}, "isProxy": true, "isVpn": true, "isTor": true, "isHosting": true, "hostingName": "string", "isp": "string", "country": "US", "region": "NY", "city": "New York", "latitude": 0.1, "longitude": 0, "postalCode": "string", "timeZone": "America/New_York", "accuracyRadius": 0, "distance": 0, "hasMismatchedBillingAddressCountry": true, "hasMismatchedBankCountry": true, "hasMismatchedTimeZone": true, "hasMismatchedHolderName": true, "hasFakeName": true, "isHighRiskCountry": true, "paymentInstrumentVelocity": 0, "declinedPaymentInstrumentVelocity": 0, "deviceVelocity": 0, "ipVelocity": 0, "emailVelocity": 0, "billingAddressVelocity": 0, "paymentInstrumentApprovedTransactionCount": 0, "score": 0 }, "billingPortalToken": "string", "customFields": { "foo": "bar" }, "createdTime": "2019-08-24T14:15:22Z", "updatedTime": "2019-08-24T14:15:22Z", "_links": [ {} ], "_embedded": { "recentInvoice": {}, "initialInvoice": {}, "customer": {}, "website": {}, "leadSource": {}, "shippingRate": {}, "paymentInstrument": {}, "upcomingInvoice": {} } }