Skip to main content
Version: 1.0.0

Purchase Mutations

This section documents the GraphQL mutations available for managing purchases and orders in the YSCP platform. Purchase mutations allow you to perform operations related to orders, such as cancellation and refunds.

Available Mutations

The following purchase mutations are available:

Common Parameters

Most purchase mutations require the following parameters:

  • orderId: The unique identifier of the order to operate on
  • email: The email address associated with the order (for guest orders)

Authentication

Purchase mutations have different authentication requirements:

  • Guest order operations (like CancelGuestOrderMutation) require the email address used during checkout and the order ID
  • Customer order operations require the user to be authenticated

Order States

Orders can be in various states, and certain mutations can only be performed on orders in specific states:

  • New: The order has been placed but not yet processed
  • Processing: The order is being processed
  • Complete: The order has been fulfilled
  • Canceled: The order has been canceled
  • Refunded: The order has been refunded

Error Handling

Purchase mutations may return errors in the following cases:

  • Invalid order ID
  • Order not found
  • Unauthorized access to the order
  • Invalid operation for the current order state
  • Required fields missing

Each error includes a message explaining the issue and how to resolve it.