createOrder
Version 2024-11-01
Important
The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.
Overview
Create a BwP Order.
Response
Return type CreateOrderResponse
Arguments
Argument | Description |
---|---|
input (CreateOrderInput required) | Specifies the input fields to create an Order. |
Examples
Create Order With Non Prime Items Without Shopper Identity
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id"
}
title: "example-product-title"
price: {
amount: 28
currencyCode: "USD"
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
deliveryCharge: {
amount: 2.99
currencyCode: "USD"
}
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: false
deliverySpeed: "STANDARD"
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
aliases: [
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-order-display-id"
},
{
aliasType: "EXTERNAL_ID"
aliasId: "external-order-id"
}
]
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title",
"price": {
"currencyCode": "USD",
"amount": 28
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order With Non Prime Items
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id-1"
}
title: "example-product-title-1"
price: {
amount: 10
currencyCode: "USD"
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
},
{
product: {
identifier: {
productId: "example-product-id-2"
}
title: "example-product-title-2"
price: {
amount: 28
currencyCode: "USD"
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
deliveryCharge: {
amount: 2.99
currencyCode: "USD"
}
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: false
deliverySpeed: "STANDARD"
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
aliases: [
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-order-display-id"
},
{
aliasType: "EXTERNAL_ID"
aliasId: "external-order-id"
}
]
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "d5706fe2-0296-4ade-8336-af805f55cb2c"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title-1",
"price": {
"currencyCode": "USD",
"amount": 10
}
}
},
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title-2",
"price": {
"currencyCode": "USD",
"amount": 28
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order With Minimal Bundle Product Information
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
sku: "example-component-product-1-sku"
}
title: "example-component-product-1-title"
price: {
amount: 10.79
currencyCode: "USD"
}
purchaseGroupMembership: {
product: {
identifier: {
sku: "example-bundle-product-sku"
}
}
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
},
{
product: {
identifier: {
sku: "example-component-product-2-sku"
}
title: "example-component-product-2-title"
price: {
amount: 5
currencyCode: "USD"
}
purchaseGroupMembership: {
product: {
identifier: {
sku: "example-bundle-product-sku"
}
}
}
}
amount: {
value: 2
}
selectedDeliveryOffer: {
details: {
id: "0987654321"
deliveryPreviewId: "SIP-0000000-000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
totalPrice: {
value: {
amount: 20.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "apay-session-id"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
purchaseGroupMembership {
product {
sku
}
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-component-product-1-title",
"price": {
"currencyCode": "USD",
"amount": 10.79
},
"purchaseGroupMembership": {
"product": {
"sku": "example-bundle-product-sku"
}
}
}
},
{
"amount": {
"unit": "ONE",
"value": 2
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-component-product-2-title",
"price": {
"currencyCode": "USD",
"amount": 5
},
"purchaseGroupMembership": {
"product": {
"sku": "example-bundle-product-sku"
}
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order With Merchant Fulfilled Items
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id-1"
}
title: "example-product-title-1"
price: {
amount: 10
currencyCode: "USD"
}
}
amount: {
value: 1
}
taxes: {
summary: {
collectableTaxAmount: {
amount: 1.02
currencyCode: "USD"
}
}
}
selectedDeliveryOffer: {
details: {
id: "123456"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
},
{
product: {
identifier: {
productId: "example-product-id-2"
}
title: "example-product-title-2"
price: {
amount: 28
currencyCode: "USD"
}
}
amount: {
value: 1
}
aliases: [
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-line-item-display-id"
}
]
selectedDeliveryOffer: {
summary: {
deliveryMessage: {
messageText: "Free standard shipping in 5-7 business days"
locale: "en-US"
}
deliveryCharge: {
amount: 2.99
currencyCode: "USD"
}
discounts: {
summary: {
amount: {
amount: 2.99
currencyCode: "USD"
}
}
}
deliveryProvider: MERCHANT
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
aliases: [
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-order-display-id"
},
{
aliasType: "EXTERNAL_ID"
aliasId: "external-order-id"
}
]
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "apay-session-id"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title-1",
"price": {
"currencyCode": "USD",
"amount": 10
}
}
},
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title-2",
"price": {
"currencyCode": "USD",
"amount": 28
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order With External Order Details
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id"
}
title: "example-product-title"
price: {
amount: 10
currencyCode: "USD"
}
}
amount: {
value: 1
}
aliases: [
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-line-item-display-id"
}
]
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
aliases: [
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-order-display-id"
},
{
aliasType: "EXTERNAL_ID"
aliasId: "external-order-id"
}
]
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "example-apay-session-id"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title",
"price": {
"currencyCode": "USD",
"amount": 10
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order With Bundle Product For Prime And Non Prime Items
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
sku: "example-component-product-1-sku"
}
title: "example-component-product-1-title"
price: {
amount: 10.79
currencyCode: "USD"
}
purchaseGroupMembership: {
product: {
identifier: {
sku: "example-bundle-product-sku"
}
price: {
amount: 20.79
currencyCode: "USD"
}
}
memberAmount: {
value: 1
}
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
},
{
product: {
identifier: {
sku: "example-component-product-2-sku"
}
purchaseGroupMembership: {
product: {
identifier: {
sku: "example-bundle-product-sku"
}
price: {
amount: 20.79
currencyCode: "USD"
}
}
memberAmount: {
value: 2
}
}
}
amount: {
value: 2
}
selectedDeliveryOffer: {
details: {
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: false
deliverySpeed: "STANDARD"
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
totalPrice: {
value: {
amount: 20.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "apay-session-id"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
purchaseGroupMembership {
product {
sku
price {
currencyCode
amount
}
}
memberAmount {
value
}
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-component-product-1-title",
"price": {
"currencyCode": "USD",
"amount": 10.79
},
"purchaseGroupMembership": {
"product": {
"sku": "example-bundle-product-sku",
"price": {
"currencyCode": "USD",
"amount": 20.79
}
},
"memberAmount": {
"value": 1
}
}
}
},
{
"amount": {
"unit": "ONE",
"value": 2
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-component-product-2-title",
"price": {
"currencyCode": "USD",
"amount": 5
},
"purchaseGroupMembership": {
"product": {
"sku": "example-bundle-product-sku",
"price": {
"currencyCode": "USD",
"amount": 20.79
}
},
"memberAmount": {
"value": 1
}
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Order Using Lwa
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id"
}
title: "example-product-title"
price: {
amount: 10
currencyCode: "USD"
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
lwaAccessToken: {
value: "example-lwa-token",
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title",
"price": {
"currencyCode": "USD",
"amount": 10
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Create Minimum Fulfillable Order
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
product: {
identifier: {
productId: "example-product-id"
}
title: "example-product-title"
price: {
amount: 10
currencyCode: "USD"
}
}
amount: {
value: 1
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-000000"
deliveryProvider: AMAZON
deliveryTerms: {
isPrimeEligible: true
}
}
}
}
]
customer: {
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
deliveryAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98109"
}
}
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
apayCheckoutSessionId: {
value: "apay-session-id"
externalId: "external-shopper-checkout-session-id"
}
}
}
) {
order {
id
lineItems {
amount {
unit
value
}
createdAt
product {
title
price {
currencyCode
amount
}
}
}
orderLinks {
destinationType
url
}
}
}
}
Response
{
"data": {
"createOrder": {
"order": {
"id": "322-ABC1-AAAAAA",
"lineItems": [
{
"amount": {
"unit": "ONE",
"value": 1
},
"createdAt": "2022-02-22T16:13:11.798Z",
"product": {
"title": "example-product-title",
"price": {
"currencyCode": "USD",
"amount": 10
}
}
}
],
"orderLinks": [
{
"destinationType": "EXTERNAL_ORDER_MANAGEMENT",
"url": "https://mystore123.com/orders/512968435"
}
]
}
}
}
}
Updated about 21 hours ago