createOrder
Version 2024-04-01
Overview
Create a BwP Order.
Required scope(s)
Edit Order Data
Response
Return type CreateOrderResponse
Arguments
Argument | Description |
---|---|
input (CreateOrderInput required) | Specifies the input fields to create an Order. |
Examples
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: BUY_WITH_PRIME
}
}
},
{
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: BUY_WITH_PRIME
}
}
}
]
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"
}
]
}
}
}
}
Complete Create Order Mutation With Lwa
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
}
aliases: [
{
aliasType: "ID"
aliasId: "example-id"
},
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-display-id"
}
]
taxes: {
summary: {
collectableTaxAmount: {
amount: 1.02
currencyCode: "USD"
}
}
}
clientDetails: {
browserFingerprint: {
browserPlatform: "Desktop"
browserType: "Chrome"
browserVersion: "105.0.0.0"
browserTimezone: "America/Los_Angeles"
}
ipFingerprint: {
ipAddress: "128.0.0.1"
}
storeFingerprint: {
storeUrl: "www.mystoreurl.com"
}
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: BUY_WITH_PRIME
}
}
},
{
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"
}
]
taxes: {
summary: {
collectableTaxAmount: {
amount: 2.57
currencyCode: "USD"
}
}
}
discounts: {
summary: {
amount: {
amount: 2.8
currencyCode: "USD"
}
displayString: "TENPERCENTOFF"
}
}
clientDetails: {
browserFingerprint: {
browserPlatform: "Desktop"
browserType: "Chrome"
browserVersion: "105.0.0.0"
browserTimezone: "America/Los_Angeles"
}
ipFingerprint: {
ipAddress: "128.0.0.1"
}
storeFingerprint: {
storeUrl: "www.mystoreurl.com"
}
}
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: {
id: "customer-id-1"
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
id: "recipient-id-1"
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"
}
]
payments: {
details: [
{
id: "payment-id-1"
amount: {
amount: 38.79
currencyCode: "USD"
}
paymentMethod: {
displayString: "Visa ending in 1234"
type: AMAZON_PAY
}
state: SUCCESS
payer: {
id: "payer-id-1"
billingAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98019"
contactNumber: "123-456-7890"
}
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
}
]
}
totalPrice: {
value: {
amount: 38.79
currencyCode: "USD"
}
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
lwaAccessToken: {
value: "example-lwa-access-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-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"
}
]
}
}
}
}
Complete Create Order Mutation With Apay
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
}
aliases: [
{
aliasType: "ID"
aliasId: "example-id"
},
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "external-display-id"
}
]
taxes: {
summary: {
collectableTaxAmount: {
amount: 1.02
currencyCode: "USD"
}
}
}
clientDetails: {
browserFingerprint: {
browserPlatform: "Desktop"
browserType: "Chrome"
browserVersion: "105.0.0.0"
browserTimezone: "America/Los_Angeles"
}
ipFingerprint: {
ipAddress: "128.0.0.1"
}
storeFingerprint: {
storeUrl: "www.mystoreurl.com"
}
}
selectedDeliveryOffer: {
details: {
id: "1234567890"
deliveryPreviewId: "SIP-0000000-0000000"
deliveryProvider: BUY_WITH_PRIME
}
}
},
{
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"
}
]
taxes: {
summary: {
collectableTaxAmount: {
amount: 2.57
currencyCode: "USD"
}
}
}
discounts: {
summary: {
amount: {
amount: 2.8
currencyCode: "USD"
}
displayString: "TENPERCENTOFF"
}
}
clientDetails: {
browserFingerprint: {
browserPlatform: "Desktop"
browserType: "Chrome"
browserVersion: "105.0.0.0"
browserTimezone: "America/Los_Angeles"
}
ipFingerprint: {
ipAddress: "128.0.0.1"
}
storeFingerprint: {
storeUrl: "www.mystoreurl.com"
}
}
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: {
id: "customer-id-1"
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
recipient: {
id: "recipient-id-1"
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"
}
]
payments: {
details: [
{
id: "payment-id-1"
amount: {
amount: 38.79
currencyCode: "USD"
}
paymentMethod: {
displayString: "Visa ending in 1234"
type: AMAZON_PAY
}
state: SUCCESS
payer: {
id: "payer-id-1"
billingAddress: {
name: "John Smith"
streetAddress: "399 Boren Ave N"
locality: "Seattle"
region: "WA"
countryCode: "US"
postalCode: "98019"
contactNumber: "123-456-7890"
}
contact: {
emailData: {
name: "John Smith"
email: "[email protected]"
}
}
}
}
]
}
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-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"
}
]
}
}
}
}
Delivery Offer Validation Exception
Request
mutation createOrder($input: CreateOrderInput!) {
createOrder(input: $input) {
order {
id
}
}
}
Response
{
"errors": [
{
"message": "Delivery offer has expired.",
"locations": [
{
"line": 2,
"column": 2
}
],
"path": [
"createOrder"
],
"extensions": {
"classification": {
"errorType": "ValidationException",
"errorCode": 400,
"type": "ValidationError",
"code": "UnspecifiedError",
"details": {}
},
"category": "Fulfillment",
"categoryErrorCode": 412
}
}
],
"data": {
"createOrder": null
}
}
Updated 1 day ago