Subscriptions (SMT API) (2.0.0)

Download OpenAPI specification:Download

fabric's Subscriptions API lets your customers set recurring purchases of their desired products or services for a scheduled period (weekly, monthly, etc.). In addition, Subscriptions helps you retrieve and update subscription details, and lets your customers skip one or more subscription schedules, or remove a subscription. This API also lets you create and updates customers cancellation reasons, and subscription discounts.

Subscribers

These endpoints let you create, update, or get one or all of your subscribers (customers who have subscriptions). If you request all subscribers, you will receive a paginated response; you can specify the page size, and which page you want.

Create subscriber

Create new subscriber with specified details

Request
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Details of customer being created

customerReferenceId
required
string

Unique customer reference ID

locale
required
string

Customer locale (language_country)

email
required
string

Customer's email address

contactnumber
string

Customer's contact number

firstName
required
string

Customer's first name

middleName
string

Customer's middle name or initial

lastName
required
string

Customer's last name

segment
Array of strings

Customer's segments

employeeId
string

Customer employee ID

required
object (communicationPreference)

Customer's communications preferences

Responses
200

Request processed successfully

400

Bad request

post/v1/customers
Request samples
application/json
{
  • "customerReferenceId": "12345",
  • "locale": "en_US",
  • "email": "customer@example.com",
  • "contactnumber": "+923333709568",
  • "firstName": "Pat",
  • "middleName": "E",
  • "lastName": "Kake",
  • "segment": [
    ],
  • "employeeId": "345",
  • "communicationPreference": {
    }
}
Response samples
application/json
{
  • "id": "62cffd65e8d7eb868c6a29d6",
  • "customerReferenceId": "12345",
  • "locale": "en_US",
  • "email": "customer@example.com",
  • "contactNumber": "+923333709568",
  • "firstName": "Pat",
  • "middleName": "E",
  • "lastName": "Kake",
  • "segment": [
    ],
  • "employeeId": "345",
  • "communicationPreference": {
    },
  • "status": "ACTIVE",
  • "createdAt": "2021-10-12T21:35:05.756Z",
  • "updatedAt": "2021-10-14T05:40:55.997Z"
}

Get single subscriber's account

Get details of single customer, specified by customer ID

Request
path Parameters
id
required
string

Customer ID

Example: 62cffd65e8d7eb868c6a29d6
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

404

Not found

get/v1/customers/{id}
Response samples
application/json
{
  • "id": "62cffd65e8d7eb868c6a29d6",
  • "customerReferenceId": "12345",
  • "locale": "en_US",
  • "email": "customer@example.com",
  • "contactNumber": "+923333709568",
  • "firstName": "Pat",
  • "middleName": "E",
  • "lastName": "Kake",
  • "segment": [
    ],
  • "employeeId": "345",
  • "communicationPreference": {
    },
  • "status": "ACTIVE",
  • "createdAt": "2021-10-12T21:35:05.756Z",
  • "updatedAt": "2021-10-14T05:40:55.997Z"
}

Update single subscriber

Update single subscriber, specified by customer ID

Request
path Parameters
id
required
string

Customer ID

Example: 62cffd65e8d7eb868c6a29d6
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Details of customer being updated

customerReferenceId
required
string

Unique customer reference ID

locale
required
string

Customer locale (language_country)

email
required
string

Customer's email address

contactnumber
string

Customer's contact number

firstName
required
string

Customer's first name

middleName
string

Customer's middle name or initial

lastName
required
string

Customer's last name

segment
Array of strings

Customer's segments

employeeId
string

Customer employee ID

required
object (communicationPreference)

Customer's communications preferences

Responses
200

Request processed successfully

400

Bad request

404

Not found

put/v1/customers/{id}
Request samples
application/json
{
  • "customerReferenceId": "12345",
  • "locale": "en_US",
  • "email": "customer@example.com",
  • "contactnumber": "+923333709568",
  • "firstName": "Pat",
  • "middleName": "E",
  • "lastName": "Kake",
  • "segment": [
    ],
  • "employeeId": "345",
  • "communicationPreference": {
    }
}
Response samples
application/json
{
  • "id": "62cffd65e8d7eb868c6a29d6",
  • "customerReferenceId": "12345",
  • "locale": "en_US",
  • "email": "customer@example.com",
  • "contactNumber": "+923333709568",
  • "firstName": "Pat",
  • "middleName": "E",
  • "lastName": "Kake",
  • "segment": [
    ],
  • "employeeId": "345",
  • "communicationPreference": {
    },
  • "status": "ACTIVE",
  • "createdAt": "2021-10-12T21:35:05.756Z",
  • "updatedAt": "2021-10-14T05:40:55.997Z"
}

Update single subscriber's shipping and billing information

Update single subscriber's shipping and billing information (subscriber specified by customer ID)

Request
path Parameters
id
required
string

Customer ID

Example: 62cffd65e8d7eb868c6a29d6
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Details for updating customer billing and shipping information

object (AddressShipTo)

Ship-to address and phone details

object (Address)

Bill-to address and phone details

Responses
200

Request processed successfully

400

Bad request

404

Not found

patch/v1/customers/{id}/subscriptions
Request samples
application/json
{
  • "shipTo": {
    },
  • "billTo": {
    }
}
Response samples
application/json
{
  • "subscriptions": [
    ]
}

Subscriptions

These endpoints let your customers set recurring purchases of their desired products or services for a scheduled period (weekly, monthly, etc.). In addition, these endpoints let you get and update subscription details, and let your customers skip one or more subscription schedules, or remove a subscription.

Get all subscriptions

Get all subscriptions (response is paginated)

Request
query Parameters
limit
number

Maximum number of subscriptions to return per page

Example: limit=10
offset
number

Page number

Example: offset=0
status
string

Subscription status

Example: status=ACTIVE
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

404

Subscription not found

get/v1/subscriptions
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Get single subscription

Get single subscription by subscription ID

Request
path Parameters
id
required
string

Subscription ID

Example: 6169b2d892a5f30009d76480
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

404

Subscription not found

get/v1/subscriptions/{id}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Update single subscription

Update single subscription by subscription ID

Request
path Parameters
id
required
string

Subscription ID

Example: 6169b2d892a5f30009d76480
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
channel
string

Channel

Enum: "WEBSITE" "POS"
object (CustomerUpdateBody)

Customer details to be updated

object (AddressUpdateShipTo)

Ship to details

object (AddressUpdate)

Billing address update details

object (UpdatePaymentDetails)

Payment details to be updated

object (CustomAttributes)

Custom attributes

object (UpdateItem)

Item details to be updated

object (UpdatePlan)

Subscription plan details

object (UpdateOffer)

Offer details to be updated

object (UpdateShipping)

Shipping details to be updated

object (Expiry)

Expiration date and billing cycle

Responses
200

Request processed successfully

404

Subscription not found

patch/v1/subscriptions/{id}
Request samples
application/json
{
  • "channel": "WEBSITE",
  • "customer": {
    },
  • "shipTo": {
    },
  • "billTo": {
    },
  • "paymentDetails": {
    },
  • "customAttributes": {
    },
  • "item": {
    },
  • "plan": {
    },
  • "offer": {
    },
  • "shipping": {
    },
  • "expiry": {
    }
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Create bulk subscriptions

Create bulk subscriptions

Request
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
channel
required
string

Channel

Enum: "WEBSITE" "POS"
originOrderId
string

Client's origin order ID

object (CustomerBody)

Customer details

required
object (AddressShipTo)

Ship-to address and phone details

required
object (Address)

Bill-to address and phone details

required
object (PaymentDetails)

Payment details

object (CustomAttributes)

Custom attributes

Array of objects (SubscriptionItems)

Subscription items

Responses
200

Request processed successfully

400

Bad request

post/v1/subscriptions/bulk
Request samples
application/json
{
  • "channel": "WEBSITE",
  • "originOrderId": "22-4498-4800",
  • "customer": {
    },
  • "shipTo": {
    },
  • "billTo": {
    },
  • "paymentDetails": {
    },
  • "customAttributes": {
    },
  • "item": [
    ]
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Deactivate single subscription

Deactivate single subscription by subscription ID

Request
path Parameters
id
required
string

Subscription ID

Example: 6169b2d892a5f30009d76480
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

put/v1/subscriptions/{id}/inactive
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Reactivate single subscription

Reactivate single subscription by subscription ID

Request
path Parameters
id
required
string

Subscription ID

Example: 6169b2d892a5f30009d76480
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

put/v1/subscriptions/{id}/reactivate
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Replace a subscription item

Replace a subscription item (with details) by specifying item SKU

Request
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
object

Replacement item details

object

Replacement item details

Responses
200

Request processed successfully

400

Bad request

post/v1/subscriptions/replace-items
Request samples
application/json
{
  • "item": {
    },
  • "replacementItem": {
    }
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "This request to replace items is currently being processed. Once done, we will update you via your webhooks (your webhooks need to be configured). Refer to our documentation on more information on webhooks."
}

Discontinue items in subscription

Discontinue items in subscription by specifying item SKUs

Request
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
sku
Array of strings

SKUs

Responses
200

Request processed successfully

post/v1/subscriptions/discontinued-items
Request samples
application/json
{
  • "sku": [
    ]
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "This request to replace items is currently being processed. Once done, we will update you via your webhooks (your webhooks need to be configured). Refer to our documentation on more information on webhooks."
}

Orders

These endpoints let your customers purchase products and services from your store.

Get single order

Get single order, specified by order ID

Request
path Parameters
orderId
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

403

Unauthorized

404

Not found

get/v1/orders/{orderId}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Update single order

Update single order, specified by order ID

Request
path Parameters
orderId
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
object (UpdateOrder)

Order details to be updated

Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

patch/v1/orders/{orderId}
Request samples
application/json
{
  • "order": {
    }
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Get all orders for a specific customer

Get all orders for a specified customer, specified by customer ID

Request
path Parameters
customerId
required
string (Id)

Customer reference ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

403

Unauthorized

404

Not found

get/v1/customers/{customerId}/orders
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Trigger single order

Trigger order specified by order ID

Request
path Parameters
orderId
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

403

Unauthorized

404

Not found

get/v1/orders/{orderId}/trigger-now
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Skip single order

Skip order specified by order ID

Request
path Parameters
orderId
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

put/v1/orders/{orderId}/skip
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Remove items from single order

Remove items from order specified by order ID

Request
path Parameters
id
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
lineItemIds
Array of integers

Line items to remove from order

Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

post/v1/orders/{id}/remove-items
Request samples
application/json
{
  • "lineItemIds": [
    ]
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Add items to single order

Add items to order specified by order ID

Request
path Parameters
id
required
string (Id)

Order ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
Array of objects (AddItemToOrderItems)

Line items to add to order

Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

post/v1/orders/{id}/add-items
Request samples
application/json
{
  • "lineItems": [
    ]
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Cancellation Reasons

These endpoints let you create and get cancellation reasons.

Get all cancellation reasons

Get all cancellation reasons

Request
header Parameters
Authorization
required
string

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

403

Unauthorized access

get/v1/cancellation-reasons
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": [
    ]
}

Create cancellation reasons

Create cancellation reasons

Request
header Parameters
Authorization
required
string

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Cancellation reason to be created

Array
code
number

Cancellation code

reason
string

Cancellation reason

Responses
200

Request processed successfully

400

Bad Request

403

Unauthorized access

post/v1/cancellation-reasons
Request samples
application/json
[
  • {
    }
]
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": [
    ]
}

Subscription Discounts

These endpoints let you create, update, deactivate, and get discount offers for the orders placed by your customers.

Create subscription discounts

Create subscription discounts

Request
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Details of subscription discount to be created

object (Validity)

Dates during which discount is valid, and orders to which discount applies

message
string

Merchant discount message

object (Discount)

Discount detail

skus
Array of strings

SKUs to which discount applies

categories
Array of strings

Product categories

object (Frequency)

Shipping frequency details

itemQuantity
integer

Number of items

channel
string

Channel

Enum: "WEBSITE" "POS"
target
string

Discount target

Enum: "PDP" "CART" "QUICK VIEW" "SUBSCRIPTION MANAGEMENT PORTAL"
customerSegment
Array of strings

Customer segments

Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

post/v1/subscriptionDiscount
Request samples
application/json
{
  • "validity": {
    },
  • "message": "Offer terms and conditions",
  • "discount": {
    },
  • "skus": [
    ],
  • "categories": [
    ],
  • "frequency": {
    },
  • "itemQuantity": 1,
  • "channel": "WEBSITE",
  • "target": "PDP",
  • "customerSegment": [
    ]
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Get a subscription discount

Get a subscription discount for a specified offer (specified by offer ID)

Request
path Parameters
offerId
required
string

Offer code

Example: SUB-D45DD7
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

403

Unauthorized

404

Not found

get/v1/subscriptionDiscount/{offerId}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Update a subscription discount

Update a subscription discount for a specified offer (specified by offer ID)

Request
path Parameters
offerId
required
string (Id)

Offer ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json

Details used to update discount

object (Discount)

Discount detail

message
string

Merchant discount message

skus
Array of strings

SKUs

categories
Array of strings

Product categories

object (Frequency)

Shipping frequency details

itemQuantity
integer

Number of items

channel
string

Channel

Enum: "WEBSITE" "POS"
target
string

Discount target

Enum: "PDP" "CART" "QUICK VIEW" "SUBSCRIPTION MANAGEMENT PORTAL"
Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

put/v1/subscriptionDiscount/{offerId}
Request samples
application/json
{
  • "discount": {
    },
  • "message": "Offer terms and conditions",
  • "skus": [
    ],
  • "categories": [
    ],
  • "frequency": {
    },
  • "itemQuantity": 1,
  • "channel": "WEBSITE",
  • "target": "PDP"
}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}

Deactivate a subscription discount

Deactivate a specified subscription discount (specified by discount ID)

Request
path Parameters
id
required
string (Id)

Discount ID

Example: 606f01f441b8fc0008529916
header Parameters
Authorization
required
string (Authorization)

JWT authorization token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Responses
200

Request processed successfully

400

Bad request

403

Unauthorized

404

Not found

patch/v1/subscriptionDiscount/deactivate/{id}
Response samples
application/json
{
  • "responseStatus": "OK",
  • "message": "Request processed successfully",
  • "data": {
    }
}