Skip to content

Guest Checkout

Description

The Guest Checkout API allows none authenticated customers to place an order using the items in their cart and session id used in adding items to a cart (Generate Session Id).

Authentication Requirements

  • The X-SessionId header is mandatory .
  • The X-MerchantApiKey header is mandatory for all requests.

Endpoint

POST /v1/carts/guest/checkout

Required Headers

json
{
  "Authorization": "Bearer JWT_TOKEN",
  "X-MerchantApiKey": "MERCHANT_API_KEY",
  "X-SessionId": "XXXXXXXXXX",
  "Content-Type": "application/json"
}

📥 Request Body

ParameterTypeRequiredDescription
countrystringNoThe country where the order is being placed.
statestringYesThe state where the order is being placed.
citystringYesThe city where the order is being placed.
areastringYesArea details (2 to 100 characters).
landmarkstringNoLandmark details (2 to 100 characters).
metaobjectNoAdditional metadata about the order.
shippingAddressstringYesAddress where the order will be shipped.
shippingMethodstringYesThe method of shipping.
billingAddressstringYesBilling address (if different from shipping address).
promoCodestringNoPromo code to apply any discounts.
firstNamestringYesThe customer first name
lastNamestringYesThe customer last name
emailstringYesThe customer email address
phoneNumberstringYesThe customer phone number
currencystringNoThe currency payment is been made in
totalAmountstringNoThe total amount customer is expected to pay
shippingMethodstringYesThe total amount customer is expected to pay

Example API Call (Fetch or Axios)

javascript
fetch('https://api.shopsynch.com/v1/carts/guest/checkout', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer JWT_TOKEN',
    'X-MerchantApiKey': 'MERCHANT_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    country: "USA",
    state: "California",
    city: "Los Angeles",
    area: "Downtown",
    landmark: "Near Central Park",
    shippingAddress: "123 Main St, Los Angeles, CA",
    shippingMethod: "Standard",
    billingAddress: "123 Main St, Los Angeles, CA",
    promoCode: "DISCOUNT10",
    lastName: "John",
    firstName: "Doe",
    phoneNumber: "xxxxxxx",
    email: "sameple@yopmail.com"
  })
})
.then(response => response.json())
.then(data => console.log(data));

📤 Sample 200 Response (Success)

json
{
    "data": {
        "id": "67e3b3ee8a86a453d84eb58d",
        "orderNumber": "ORD-A780935E",
        "orderDate": "2025-03-26T08:59:42.925",
        "billingAddress": null,
        "shippingMethod": "Bus",
        "paymentMethod": null,
        "totalPrice": "51196.82",
        "waybillPrice": null,
        "country": "Nigeria",
        "state": "Lagos",
        "city": "ikeja",
        "area": null,
        "landmark": null,
        "status": "PENDING",
        "paymentStatus": "PENDING",
        "paymentGateway": null,
        "paymentGatewayTransactionId": null,
        "fulfillmentStatus": "UNFULFILLED",
        "user": null,
        "contactInformation": {
            "firstName": "Taofeeq",
            "lastName": "Adewuyi",
            "email": "realolamilekan@gmail.com",
            "phoneNumber": "07086556010",
            "address": "Ajegunle"
        },
        "promotion": null,
        "address": null,
        "tenantId": "679f2dd75f703c799f673415",
        "createdAt": "2025-03-26T08:59:42.94"
    },
    "message": "Order initiated successfully",
    "status": true
}

❌ Sample 400 Response (Cart Empty Error)

json
{
    "status": false,
    "message": "Your cart is empty. Please add items before proceeding."
}

Next Steps

Build with joy