createOrder
Version 2024-01-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.
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
Complete Create Order Mutation
Request
mutation createOrder {
createOrder(
input: {
lineItems: [
{
purchasedItem: {
itemId: {
ID: "e2a20tn5wnzf95"
},
title: "Best Pet Supplies - Waterproof Dogs toys"
price: {
currentPrice: {
amount: 10
currencyCode: "USD"
}
}
}
quantity: {
amount: 1
}
lineItemAliases: [
{
aliasType: "ID"
aliasId: "e2a20tn5wnzf95"
},
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id-e2a20tn5wnzf95"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "sku-id-e2a20tn5wnzf95"
}
]
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: "5060887210"
deliveryPreviewId: "SIP-8676502-0261200"
deliveryProvider: BUY_WITH_PRIME
}
}
},
{
purchasedItem: {
itemId: {
SKU: "sku-id-ABC123"
},
title: "LED Motion Sensor Headlamp"
price: {
currentPrice: {
amount: 28
currencyCode: "USD"
}
}
}
quantity: {
amount: 1
}
lineItemAliases: [
{
aliasType: "ID"
aliasId: "ABC123"
},
{
aliasType: "EXTERNAL_ITEM_ID"
aliasId: "external-line-item-id-ABC123"
},
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "sku-id-ABC123"
}
]
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: {
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"
}
}
orderAliases: [
{
aliasType: "EXTERNAL_DISPLAY_ID"
aliasId: "#10245"
},
{
aliasType: "EXTERNAL_ID"
aliasId: "512968435"
}
]
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]"
}
}
}
}
]
}
orderTotal: {
totalPrice: {
amount: 38.79
currencyCode: "USD"
}
rollupCharges: [
{
rollupChargeType: ORDER_SUB_TOTAL
displayString: "Subtotal"
value: {
amount: 38
currencyCode: "USD"
}
},
{
rollupChargeType: ORDER_TAX
displayString: "Taxes"
value: {
amount: 3.59
currencyCode: "USD"
}
},
{
rollupChargeType: ORDER_SHIPPING
displayString: "Shipping"
value: {
amount: 2.99
currencyCode: "USD"
}
},
{
rollupChargeType: DISCOUNT
displayString: "Discounts"
value: {
amount: 5.79
currencyCode: "USD"
}
}
]
}
orderLinks: [
{
destinationType: EXTERNAL_ORDER_MANAGEMENT
url: "https://mystore123.com/orders/512968435"
}
]
shopperIdentity: {
identityProvider: APAY
idPToken: "d5706fe2-0296-4ade-8336-af805f55cb2c"
idPTokenType: CHECKOUT_SESSION_ID
externalId: "external-shopper-checkout-session-id"
}
}
) {
id
orderLinks {
destinationType
url
}
}
}
Response
{
"data": {
"createOrder": {
"id": "322-PPP3-TTTTEE",
"orderLinks": [
{
"destinationType": "BWP_STOREFRONT",
"url": "https://order.buywithprime.amazon.com/sj130ji0go/orders/322-PPP3-TTTTEE"
}
]
}
}
}
Delivery Offer Validation Exception
Request
mutation createOrder($input: CreateOrderInput!) {
createOrder(input: $input) {
id
orderLinks {
destinationType
url
}
}
}
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 3 days ago