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.

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({
  authHeader: "<AUTH_HEADER>",
  shopperIp: "<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>",
    },
  },
});

Create cart without buyer identity

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

const ryeClient = new RyeClient({
  authHeader: "<AUTH_HEADER>",
  shopperIp: "<SHOPPER_IP>",
});

// Create cart without buyer identity
const result = await ryeClient.createCart({
  input: {
    items: {
      amazonCartItemsInput: [
        {
          quantity: 1,
          productId: "B007W3DDUW",
        },
      ],
    },
  },
});