156 lines
5.1 KiB
Bash
Executable File
156 lines
5.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Create all Clavitor products in Paddle Sandbox
|
|
# Run: chmod +x create_in_paddle.sh && ./create_in_paddle.sh
|
|
|
|
API_KEY="pdl_sdbx_apikey_01knegw36v6cvybp2y5652xpmq_weT2XzhV6Qk0rGEYDY0V5X_Aig"
|
|
BASE_URL="https://sandbox-api.paddle.com"
|
|
|
|
echo "Creating Clavitor products in Paddle Sandbox..."
|
|
echo ""
|
|
|
|
# Create Personal product
|
|
PERSONAL=$(curl -s -X POST "$BASE_URL/products" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "Clavitor Personal",
|
|
"description": "Password manager for individuals. 1 vault, 5 agents, 2 devices.",
|
|
"tax_category": "software",
|
|
"type": "standard",
|
|
"custom_data": {"tier": "personal", "max_vaults": 1, "max_agents": 5, "max_devices": 2}
|
|
}' | jq -r '.data.id')
|
|
|
|
echo "Personal Product ID: $PERSONAL"
|
|
|
|
# Create Personal prices
|
|
for currency in USD EUR GBP; do
|
|
amount="1200"
|
|
[ "$currency" = "EUR" ] && amount="1100"
|
|
[ "$currency" = "GBP" ] && amount="1000"
|
|
|
|
curl -s -X POST "$BASE_URL/prices" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"product_id\": \"$PERSONAL\",
|
|
\"description\": \"Yearly subscription - $currency\",
|
|
\"name\": \"Yearly\",
|
|
\"billing_cycle\": {\"interval\": \"year\", \"frequency\": 1},
|
|
\"unit_price\": {\"amount\": \"$amount\", \"currency_code\": \"$currency\"},
|
|
\"custom_data\": {\"billing_period\": \"yearly\", \"region\": \"${currency,,}\"}
|
|
}" | jq -r '.data.id' > /dev/null
|
|
|
|
echo " ✓ Personal $currency price created"
|
|
done
|
|
|
|
# Create Family product
|
|
FAMILY=$(curl -s -X POST "$BASE_URL/products" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "Clavitor Family",
|
|
"description": "Family sharing. 1 vault, 15 agents, 6 devices.",
|
|
"tax_category": "software",
|
|
"type": "standard",
|
|
"custom_data": {"tier": "family", "max_vaults": 1, "max_agents": 15, "max_devices": 6}
|
|
}' | jq -r '.data.id')
|
|
|
|
echo "Family Product ID: $FAMILY"
|
|
|
|
for currency in USD EUR GBP; do
|
|
amount="2900"
|
|
[ "$currency" = "EUR" ] && amount="2700"
|
|
[ "$currency" = "GBP" ] && amount="2500"
|
|
|
|
curl -s -X POST "$BASE_URL/prices" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"product_id\": \"$FAMILY\",
|
|
\"description\": \"Yearly - $currency\",
|
|
\"name\": \"Yearly\",
|
|
\"billing_cycle\": {\"interval\": \"year\", \"frequency\": 1},
|
|
\"unit_price\": {\"amount\": \"$amount\", \"currency_code\": \"$currency\"}
|
|
}" | jq -r '.data.id' > /dev/null
|
|
|
|
echo " ✓ Family $currency price created"
|
|
done
|
|
|
|
# Create Pro product
|
|
PRO=$(curl -s -X POST "$BASE_URL/products" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"name": "Clavitor Pro",
|
|
"description": "Power users. 1 vault, 50 agents, unlimited devices.",
|
|
"tax_category": "software",
|
|
"type": "standard",
|
|
"custom_data": {"tier": "pro", "max_vaults": 1, "max_agents": 50}
|
|
}' | jq -r '.data.id')
|
|
|
|
echo "Pro Product ID: $PRO"
|
|
|
|
for currency in USD EUR GBP; do
|
|
amount="4900"
|
|
[ "$currency" = "EUR" ] && amount="4500"
|
|
[ "$currency" = "GBP" ] && amount="4100"
|
|
|
|
curl -s -X POST "$BASE_URL/prices" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"product_id\": \"$PRO\",
|
|
\"description\": \"Yearly - $currency\",
|
|
\"name\": \"Yearly\",
|
|
\"billing_cycle\": {\"interval\": \"year\", \"frequency\": 1},
|
|
\"unit_price\": {\"amount\": \"$amount\", \"currency_code\": \"$currency\"}
|
|
}" | jq -r '.data.id' > /dev/null
|
|
|
|
echo " ✓ Pro $currency price created"
|
|
done
|
|
|
|
# Create Team products
|
|
for seats in 10 25 100 250 500; do
|
|
amounts=(24900 49900 149900 299900 499900)
|
|
case $seats in
|
|
10) amount=${amounts[0]} ;;
|
|
25) amount=${amounts[1]} ;;
|
|
100) amount=${amounts[2]} ;;
|
|
250) amount=${amounts[3]} ;;
|
|
500) amount=${amounts[4]} ;;
|
|
esac
|
|
|
|
TEAM=$(curl -s -X POST "$BASE_URL/products" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"name\": \"Clavitor Team $seats\",
|
|
\"description\": \"Up to $seats employees. Company vault + personal vaults.\",
|
|
\"tax_category\": \"software\",
|
|
\"type\": \"standard\",
|
|
\"custom_data\": {\"tier\": \"team$seats\", \"max_employees\": $seats}
|
|
}" | jq -r '.data.id')
|
|
|
|
echo "Team $seats Product ID: $TEAM"
|
|
|
|
curl -s -X POST "$BASE_URL/prices" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"product_id\": \"$TEAM\",
|
|
\"description\": \"Per employee yearly - USD\",
|
|
\"name\": \"Yearly\",
|
|
\"billing_cycle\": {\"interval\": \"year\", \"frequency\": 1},
|
|
\"unit_price\": {\"amount\": \"$amount\", \"currency_code\": \"USD\"},
|
|
\"quantity\": {\"minimum\": 1, \"maximum\": 1}
|
|
}" | jq -r '.data.id' > /dev/null
|
|
|
|
echo " ✓ Team $seats USD price created"
|
|
done
|
|
|
|
echo ""
|
|
echo "========================================"
|
|
echo "All products and prices created!"
|
|
echo "View in dashboard: https://sandbox-vendors.paddle.com"
|
|
echo "========================================"
|