
Quickstart
OpenStock Docs
Create an API key and send a customer to checkout in a few minutes.
This walkthrough takes you from a fresh store to a working checkout link using a single API call.
Create an API key
In the dashboard, open Developers → API Keys and create a key with the checkout_api permission. Copy it right away — it starts with sk_ and is only shown once.
Store the key on your server
Keep the key in an environment variable on your backend. It must never ship to a browser or mobile app.
OPENSTOCK_API_KEY=sk_your_secret_keyCreate a checkout session
Send the items you want to charge for. The response contains a hosted checkout URL.
curl -X POST "https://openstock.dev/api/checkout-api/sessions" \
-H "Authorization: Bearer $OPENSTOCK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"line_items": [{ "name": "Premium License", "price": 29.99, "quantity": 1 }],
"success_url": "https://example.com/success"
}'Redirect the customer
Send the customer to the returned url. After paying they land on your success_url. To fulfil orders reliably, listen for the checkout.session.completed webhook rather than relying on the redirect.