> ## Documentation Index
> Fetch the complete documentation index at: https://docs.buybase.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Buy Item

> Buy an item on behalf of your end-user.

### Headers

<ParamField header="authorization" type="string" required>
  Your API key for authentication.
</ParamField>

### Body

<ParamField body="items" type="array" required>
  Array of items to purchase.

  ```json
  [
    {
      "variant_id": "string", // Shopify variant ID
      "quantity": 1 // Must be at least 1
    }
  ]
  ```
</ParamField>

<ParamField body="user_id" type="string" required>
  The unique identifier for the user.
</ParamField>

<ParamField body="store_id" type="string" required>
  The unique identifier for the store.
</ParamField>

### Response

<ResponseField name="message" type="string">
  A message indicating the result of the purchase operation.
</ResponseField>

<ResponseField name="code" type="string">
  A code indicating the result of the purchase operation. Possible values:

  * `ORDER_CREATED`: Order created successfully
  * `AUTH_MISSING`: No API key provided
  * `INVALID_KEY`: Invalid API key
  * `BAD_REQUEST_ERROR`: Invalid request parameters
  * `STORE_NOT_FOUND`: Store ID not found
  * `USER_NOT_FOUND`: User ID not found
  * `STORE_NOT_VERIFIED`: Store is not verified yet
  * `FORBIDDEN`: Not authorized to access store
  * `INTERNAL_ERROR`: Server error occurred
</ResponseField>

<ResponseField name="error" type="string">
  Error message if the request fails.
</ResponseField>

<ResponseExample>
  ```json
  {
    "message": "Order created successfully",
    "code": "ORDER_CREATED"
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.