Purchase Product

Programmatically create an order, deduct balance, and instantly receive products.

Endpoint Features

The Purchase Product endpoint acts as checkout. Pass a Product UUID and a desired quantity. The system automatically calculates your VIP rank, verifies balance and stock availability, and fulfills the items securely.

Authentication

Requires Authorization header with a Bearer API token.

Request Body (JSON)

FieldTypeDescription
productIdstringRequired. The exact UUID of the item to purchase.
quantitynumberOptional. Number of items. Defaults to 1.
webhookUrlstringOptional. A custom URL to securely receive real-time webhook events for this order. Passing this automatically updates your account's default webhook!

Error Codes

  • INVALID_PARAMETERS (400) : The productId was missing or quantity is less than 1.
  • PRODUCT_NOT_FOUND (404) : The product is deactivated or invalid.
  • INSUFFICIENT_BALANCE (400) : Current wallet balance cannot afford the requested quantity.
  • OUT_OF_STOCK (400) : The requested quantity exceeds available inventory numbers.
  • PRODUCT_UNAVAILABLE (503) : The server is currently experiencing heavy load. Please try again in a few minutes.
  • FULFILLMENT_FAILED (502) : High demand or network timeout caused a temporary assignment failure. Your account has been automatically refunded.

Interactive Testing

POST
https://api.hsmail.shop/v1/order/create
Headers:Authorization: (Not Set - Set in Topbar)

Request Snippets

curl -X POST https://api.hsmail.shop/v1/order/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"productId":"d290f1ee-6c54-4b01-90e6-d701748f0851","quantity":1,"webhookUrl":"https://your-domain.com/webhook?token=SECURE123"}'