Upsert a cancellation

Creates or updates (upserts) a cancellation order with a specified ID.

SecuritySecretApiKey or JWT
Request
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

ID of the resource.

Request Body schema: application/json

Cancellation resource.

subscriptionId
required
string <= 50 characters

ID of the canceled subscription order.

churnTime
required
string <date-time>

Date and time when the subscription is deactivated.

canceledBy
string
Default: "customer"

Specifies who initiated the cancellation.

Enum: "merchant" "customer"
reason
string
Default: "other"

Reason for the cancellation.

Enum: "did-not-use" "did-not-want" "missing-features" "bugs-or-problems" "do-not-remember" "risk-warning" "contract-expired" "too-expensive" "other" "billing-failure"
description
string <= 255 characters

Description of the cancellation reason in free form.

prorated
boolean
Default: false

Specifies if the customer gets a pro-rata credit for the time remaining between churnTime and subscription next renewal time.

status
string
Default: "confirmed"

Status of the subscription order.

Enum: Description
draft

Creates a daft cancellation so that the cancellation and charge can be previewed.

confirmed

Confirms a subscription cancellation. Sets the subscription to cancel when the churnTime is reached.

completed

Marks a subscription cancellation as completed. This is a read-only status that is set when the churnTime is reached. The cancellation may not be changed or deleted when the status is completed.

revoked

Revokes a subscription cancellation.

Array of objects (UpcomingInvoiceItem)

Items to be added to the new invoice. Proration item is generated and added automatically.

Array
type
required
string

Type of invoice line item.

Enum: "debit" "credit"
unitPriceAmount
required
number <double>

Unit price of the line item.

unitPriceCurrency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

quantity
required
integer

Quantity of the line item.

description
string <= 1000 characters

Description of the line item.

periodStartTime
string <date-time>

Date and time when the period begins for this item.

periodEndTime
string <date-time>

Date and time when the period ends for this item.

Responses
200

Cancellation updated.

Response Schema: application/json
subscriptionId
required
string <= 50 characters

ID of the canceled subscription order.

churnTime
required
string <date-time>

Date and time when the subscription is deactivated.

id
string <= 50 characters

ID of the cancellation.

proratedInvoiceId
string <= 50 characters

ID of the invoice on which the cancellation proration is calculated.

appliedInvoiceId
string <= 50 characters

ID of the invoice on which the cancellation fees or credits are applied.

canceledBy
string
Default: "customer"

Specifies who initiated the cancellation.

Enum: "merchant" "customer"
reason
string
Default: "other"

Reason for the cancellation.

Enum: "did-not-use" "did-not-want" "missing-features" "bugs-or-problems" "do-not-remember" "risk-warning" "contract-expired" "too-expensive" "other" "billing-failure"
description
string <= 255 characters

Description of the cancellation reason in free form.

prorated
boolean
Default: false

Specifies if the customer gets a pro-rata credit for the time remaining between churnTime and subscription next renewal time.

status
string
Default: "confirmed"

Status of the subscription order.

Enum: Description
draft

Creates a daft cancellation so that the cancellation and charge can be previewed.

confirmed

Confirms a subscription cancellation. Sets the subscription to cancel when the churnTime is reached.

completed

Marks a subscription cancellation as completed. This is a read-only status that is set when the churnTime is reached. The cancellation may not be changed or deleted when the status is completed.

revoked

Revokes a subscription cancellation.

canceledTime
string <date-time>

Date and time when a subscription is cancelled. By default, this occurs when status is confirmed, unless draft is specified.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects (UpcomingInvoiceItem)

Items to be added to the new invoice. Proration item is generated and added automatically.

Array
type
required
string

Type of invoice line item.

Enum: "debit" "credit"
unitPriceAmount
required
number <double>

Unit price of the line item.

unitPriceCurrency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

quantity
required
integer

Quantity of the line item.

description
string <= 1000 characters

Description of the line item.

periodStartTime
string <date-time>

Date and time when the period begins for this item.

periodEndTime
string <date-time>

Date and time when the period ends for this item.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

lineItemSubtotal
number

Subtotal of the line items added after the subscription cancellation.

Array of objects (SelfLink)

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Value: "self"
201

Cancellation created.

Response Headers
Location
string <uri>

Location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
subscriptionId
required
string <= 50 characters

ID of the canceled subscription order.

churnTime
required
string <date-time>

Date and time when the subscription is deactivated.

id
string <= 50 characters

ID of the cancellation.

proratedInvoiceId
string <= 50 characters

ID of the invoice on which the cancellation proration is calculated.

appliedInvoiceId
string <= 50 characters

ID of the invoice on which the cancellation fees or credits are applied.

canceledBy
string
Default: "customer"

Specifies who initiated the cancellation.

Enum: "merchant" "customer"
reason
string
Default: "other"

Reason for the cancellation.

Enum: "did-not-use" "did-not-want" "missing-features" "bugs-or-problems" "do-not-remember" "risk-warning" "contract-expired" "too-expensive" "other" "billing-failure"
description
string <= 255 characters

Description of the cancellation reason in free form.

prorated
boolean
Default: false

Specifies if the customer gets a pro-rata credit for the time remaining between churnTime and subscription next renewal time.

status
string
Default: "confirmed"

Status of the subscription order.

Enum: Description
draft

Creates a daft cancellation so that the cancellation and charge can be previewed.

confirmed

Confirms a subscription cancellation. Sets the subscription to cancel when the churnTime is reached.

completed

Marks a subscription cancellation as completed. This is a read-only status that is set when the churnTime is reached. The cancellation may not be changed or deleted when the status is completed.

revoked

Revokes a subscription cancellation.

canceledTime
string <date-time>

Date and time when a subscription is cancelled. By default, this occurs when status is confirmed, unless draft is specified.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

Array of objects (UpcomingInvoiceItem)

Items to be added to the new invoice. Proration item is generated and added automatically.

Array
type
required
string

Type of invoice line item.

Enum: "debit" "credit"
unitPriceAmount
required
number <double>

Unit price of the line item.

unitPriceCurrency
required
string (CurrencyCode) = 3 characters

Currency code in ISO 4217 format.

quantity
required
integer

Quantity of the line item.

description
string <= 1000 characters

Description of the line item.

periodStartTime
string <date-time>

Date and time when the period begins for this item.

periodEndTime
string <date-time>

Date and time when the period ends for this item.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

lineItemSubtotal
number

Subtotal of the line items added after the subscription cancellation.

Array of objects (SelfLink)

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Value: "self"
401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

put/subscription-cancellations/{id}
Request samples
application/json
{
  • "subscriptionId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "canceledBy": "merchant",
  • "reason": "did-not-use",
  • "description": "string",
  • "prorated": false,
  • "status": "draft",
  • "churnTime": "2019-08-24T14:15:22Z",
  • "lineItems": [
    ]
}
Response samples
application/json
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "subscriptionId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "proratedInvoiceId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "appliedInvoiceId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "canceledBy": "merchant",
  • "reason": "did-not-use",
  • "description": "string",
  • "prorated": false,
  • "status": "draft",
  • "canceledTime": "2019-08-24T14:15:22Z",
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "churnTime": "2019-08-24T14:15:22Z",
  • "lineItems": [
    ],
  • "lineItemSubtotal": 49.95,
  • "_links": [
    ]
}