Rental intent token
Understanding the _rental_intent_token
Line Item Property.
The _rental_intent_token
is a custom property attached to Shopify order line items that contains crucial information about rental intents in Supercycle. This document explains the structure and purpose of this property. If an item doesn’t have a rental_intent_token Supercycle will not process that item.
Overview
The _rental_intent_token
is a JSON serialized token that contains all necessary information to create a rental when a customer purchases an item. This token is generated when customers select rental options in the storefront and is processed when orders are fulfilled.
Common Attributes
A typical _rental_intent_token
contains the following attributes:
Attribute | Type | Description |
---|---|---|
variant_id | Integer | ID of the variant being rented |
available_item_count | Integer | Number of items available for rental |
schedule | Object | Contains timing information for the rental |
purchase_type | String | Class name of the purchase type:CalendarRental::Purchase, MembershipRental::Purchase, SubscriptionRental::Purchase, Resale::Purchase |
purchase_attributes | Object | Attributes specific to the purchase type |
location_id | Integer | Optional ID of the location for fulfillment |
Schedule Object
The schedule
object contains timing information for the rental lifecycle:
Attribute | Type | Description |
---|---|---|
prepare_from | ISO Date | When the items reservation will start |
fulfill_at | ISO Date | When the rental should be fulfilled |
rental_start | ISO Date | When the rental period begins |
rental_end | ISO Date | When the rental period ends |
receive_at | ISO Date | When the item should be received back |
restock_by | ISO Date | When the items reservation will end |
minimum_rental_end | ISO Date | Minimum date for rental end |
Rental Method-Specific Attributes
Membership Rental
Attribute | Type | Description |
---|---|---|
credit_cost | Integer | Number of credits required for rental |
Calendar Rental
Attribute | Type | Description |
---|---|---|
selling_plan_id | Integer | ID of the selling plan associated with rental |
Subscription Rental
Attribute | Type | Description |
---|---|---|
selling_plan_id | Integer | ID of the subscription selling plan |
deposit_variant_id | Integer | Optional ID of the deposit variant |
create_subscription_contract | Integer | Optional ID of selling plan to create contract |
How It’s Used
- Generation: The token is generated when a customer selects rental options in the storefront.
- Storage: The token is attached to the line item as a custom property named
_rental_intent_token
. - Processing: When an order is processed, the Supercycle decodes the token and creates rentals based on the information it contains.
Rental Creation
The token provides all necessary information to:
- Select available items
- Set up the rental schedule
- Create the appropriate purchase records
- Handle deposits if required
- Set up subscriptions if applicable
Code Example
Here’s how a typical _rental_intent_token
might look: