Skip to main content

Overview

Place orders for gift cards after verifying product availability. Orders process instantly and return an orderId for tracking.
Orders are final once placed. Check stock and balance first.

API Reference

POST /v3/gift-cards/placeOrder

Complete endpoint documentation

Place an Order

import requests
import os

def place_order(product_id, type_id, quantity):
    response = requests.post(
        'https://api.oneclickdz.com/v3/gift-cards/placeOrder',
        headers={
            'Content-Type': 'application/json',
            'X-Access-Token': os.getenv('API_KEY')
        },
        json={
            'productId': product_id,
            'typeId': type_id,
            'quantity': quantity
        }
    )

    result = response.json()

    if not response.ok:
        raise Exception(result.get('message', 'Order failed'))

    return result['data']['orderId']

# Usage
order_id = place_order('507f1f77bcf86cd799439011', 'type_001', 2)
print(f"Order placed: {order_id}")

Response

{
  "success": true,
  "data": {
    "orderId": "6901616fe9e88196b4eb64b3"
  }
}

Error Handling

try:
    order_id = place_order(product_id, type_id, quantity)
    print(f"Success: {order_id}")
except Exception as error:
    if 'stock' in str(error):
        print("Out of stock")
    elif 'balance' in str(error):
        print("Insufficient balance")
    else:
        print(f"Order failed: {error}")

Next Steps

After placing an order:
  1. Save the orderId - You’ll need it to check status
  2. Track the order - Check status until fulfilled
  3. Deliver cards - Send codes to your customer