Try it

Upsert an order with predefined ID

Create or update an order with predefined identifier string.

Authorizations:
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

The resource identifier string.

query Parameters
expand
string

Expand a response to get a full related object included inside of the _embedded path in the response. To expand multiple objects, it accepts a comma-separated list of objects (example: expand=recentInvoice,initialInvoice). Available arguments are:

  • recentInvoice
  • initialInvoice
  • customer
  • website

See the expand guide for more info.

header Parameters
Organization-Id
string (ResourceId) <= 50 characters
Example: 4f6cf35x-2c4y-483z-a0a9-158621f77a21

Organization identifier in scope of which need to perform request (if not specified, the default organization will be used).

Request Body schema: application/json

Order resource.

orderType
required
string
Default: "subscription-order"

Specifies the type of order, a subscription or a one-time purchase.

customerId
required
string <= 50 characters

Unique id for each customer.

websiteId
required
string <= 50 characters

Unique id for each website.

items
required
Array of objects non-empty
deliveryAddress
object Nullable

Delivery address.

billingAddress
object Nullable

Billing address.

riskMetadata
object Nullable

Risk metadata. If null, the value would coalesce to the risk metadata captured when creating the payment token.

couponIds
Array of strings Nullable

A list of coupons to redeem on the customer and restrict to this subscription. Read more about coupons here.

This parameter respects the following logic:

  • When not passed then applied coupons will not be changed.

  • When empty array passed then all applied coupon redemptions will be canceled.

  • When list of coupons is passed then not applied yet coupons will be applied, already applied coupons will not change their state, applied coupons that are not presented in passed list will be canceled.

If list of applied coupons on pending order will be changed due to this param during update order, Invoice for the order will be reissued.

poNumber
string Nullable

Purchase order number, will be displayed on the issued invoices.

customFields
object (ResourceCustomFields)
Default: {}

Custom Fields list as a map {"custom field name": "custom field value", ...}. The format must follow the saved format (see Custom Fields section for the formats).

Responses

200

Order was updated.

201

Order was created.

401

Unauthorized access, invalid credentials was used.

403

Access forbidden.

404

Resource was not found.

422

Invalid data was sent.

put /subscriptions/{id}

Sandbox Server.

https://api-sandbox.rebilly.com/subscriptions/{id}

Live Server.

https://api.rebilly.com/subscriptions/{id}

Request samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "orderType": "one-time-order",
  • "customerId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "websiteId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "items":
    [
    ],
  • "deliveryAddress":
    {
    },
  • "billingAddress":
    {
    },
  • "riskMetadata": null,
  • "couponIds":
    [
    ],
  • "poNumber": "PO123456",
  • "customFields":
    {
    }
}

Response samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "orderType": "one-time-order",
  • "billingStatus": "unpaid",
  • "customerId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "websiteId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "initialInvoiceId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "recentInvoiceId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "items":
    [
    ],
  • "deliveryAddress":
    {
    },
  • "billingAddress":
    {
    },
  • "riskMetadata": null,
  • "activationTime": "2021-01-25T19:24:54Z",
  • "poNumber": "PO123456",
  • "revision": 0,
  • "status": "pending",
  • "customFields":
    {
    },
  • "createdTime": "2021-01-25T19:24:54Z",
  • "updatedTime": "2021-01-25T19:24:54Z",
  • "_links":
    [
    ],
  • "_embedded":
    [
    ]
}