Arguments

input
CartCreateInput!
required

The input object contains items with their quantities and optionally the identity of the buyer.

If BuyerIdentity is not provided upon cart creation then AmazonOffer.shippingMethods and ShopifyOffer.shippingMethods will contain only the preliminary estimated default shipping method. To get more accurate shipping information use updateCartBuyerIdentity mutation to provide buyer information.

fetchBuyerIdentity
Boolean

Set to false by default. If set to true, the buyerIdentity field will be fetched in the response.

fetchCartLines
Boolean

Set to true by default. If set to true, the cartLines field will be fetched in the response.

fetchOffer
Boolean

Set to true by default. If set to true, the offers field will be fetched in the response.

fetchShippingMethods
Boolean

Set to false by default. If set to true, the shippingMethods field will be fetched in the response.

Returns

CartResponse.*
CartResponse

Any requested field from the CartResponse object.

Usage

Create cart with buyer identity

import { RyeClient, Marketplace } from "@rye-api/rye-sdk";

const ryeClient = new RyeClient("<AUTH_HEADER>", "<SHOPPER_IP>");

// Create cart with buyer identity
const result = await ryeClient.createCart({
  input: {
    items: {
      amazonCartItemsInput: [
        {
          quantity: 1,
          productId: "B007W3DDUW",
        },
      ],
    },
    buyerIdentity: {
      firstName: "<FIRST_NAME>",
      lastName: "<LAST_NAME>",
      email: "<EMAIL>",
      phone: "<PHONE>",
      address1: "<ADDRESS_1>",
      address2: "<ADDRESS_2>",
      city: "<CITY>",
      provinceCode: "<PROVINCE_CODE>",
      countryCode: "<COUNTRY_CODE>",
      postalCode: "<POSTAL_CODE>",
    },
  },
  fetchBuyerIdentity: false, // Set to true to fetch buyer identity
  fetchOffer: false, // Set to true to fetch offers for each store
  fetchCartLines: false, // Set to true to fetch cart lines
  fetchShippingMethods: false, // Set to true to fetch shipping methods
});

Create cart without buyer identity

import { RyeClient, Marketplace } from "@rye-api/rye-sdk";

const ryeClient = new RyeClient("<AUTH_HEADER>", "<SHOPPER_IP>");

// Create cart without buyer identity
const result = await ryeClient.createCart({
  input: {
    items: {
      amazonCartItemsInput: [
        {
          quantity: 1,
          productId: "B007W3DDUW",
        },
      ],
    },
  },
  fetchBuyerIdentity: false, // Set to true to fetch buyer identity
  fetchOffer: false, // Set to true to fetch offers for each store
  fetchCartLines: false, // Set to true to fetch cart lines
  fetchShippingMethods: false, // Set to true to fetch shipping methods
});