Backend API
Create a purchase link.
Arguments
Human-friendly name of the purchase link.
List of line items describing the products ordered.
List of items offered as a bundle. Defaults to product.bundle_items.
ID of the bundle item product.
ID of the bundle item product.
Expandable link to the bundle product.
Quantity of the bundle item being ordered. Defaults to 1.
Weight to be used in shipping calculation, if applicable.
ID of the bundle item variant.
Expandable link to the bundle variant.
Description used for custom line items, when product is not defined.
List of discounts to apply to the item. Normally populated by applying a coupon or promotions.
Unique identifier for the object. Should refer to one of the IDs in the cart discounts object.
Fixed discount amount.
Arbitrary item data, typically set in a checkout flow to store custom values. See Storefront API for details.
Item options matching one or more of product.options. When adding to the cart, specify either option id or name (case-insensitive) to identify the option.
Gift card products have two special options that can be used when fulfilling gift cards by email. Use the option ID send_email and value as the recipient email address, and send_note as a custom message from the customer to the recipient sent by email.
Unique identifier for the object.
Name of the product option. Populated automatically when adding an option by ID.
Additional price added onto the base price of the product.
Additional shipping weight added onto the base weight of the product.
Name value of the product option. When adding to the cart, specify either the product option value id or name (case-insensitive) to identify the value.
Indicates the option refers to a variant aspect.
Method of delivery taken automatically from product.delivery
Possible enum values:
Price of the item. Override this value to set a custom price. Defaults to product price or sale price.
ID of the item product.
Expandable link to the product, if applicable.
Quantity of the item being ordered. Defaults to 1.
Weight to be used in shipping calculation, if applicable.
List of tax rules to apply to the item. Normally populated by tax settings.
Unique identifier for the object. Should refer to one of the IDs in the cart taxes object.
Fixed tax amount.
ID of the item variant, if applicable.
Expandable link to the variant, if applicable.
Indicates the cart has been updated by a customer within the last 3 hours.
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/purchaselinks', {
name: 'Purchase link example',
active: true,
items: [
{
product_id: '626034d4e7b741001968292d',
quantity: 1,
}
],
});Response
{
"active": true,
"name": "Purchase link example",
"items": [
{
"product_id": "626034d4e7b741001968292d",
"quantity": 1,
"price": 5,
"price_total": 5,
"discount_total": 0,
"discount_each": 0,
"id": "62681502ea4c3f00138da5ea"
}
],
"currency": "USD",
"sub_total": 5,
"item_discount": 0,
"discount_total": 0,
"grand_total": 5,
"date_created": "2022-04-26T15:51:30.324Z",
"date_updated": "2022-04-26T15:52:33.949Z",
"id": "DEEFRebs"
}