Developer docs v0.1.0

Quickstart

BASE=https://your-payware-host

# 1. Payware provisions your merchant account (you supply your NETOPIA Payments API key and POS
#    signature once, out of band) and gives you your first API key.
KEY=sk_test_...   # api_key from the response
auth=(-H "authorization: Bearer $KEY" -H 'content-type: application/json')

# 2. Catalog
curl -sS $BASE/v1/products "${auth[@]}" -d '{"name":"Pro plan"}'
curl -sS $BASE/v1/prices   "${auth[@]}" -d '{"product_id":"<product id>","amount":4900,"currency":"RON",
                                              "recurring":{"interval":"month"}}'

# 3. Customer + zero-RON hosted enrollment
curl -sS $BASE/v1/customers "${auth[@]}" -d '{"email":"[email protected]"}'
curl -sS $BASE/v1/enrollments "${auth[@]}" -H 'idempotency-key: enroll-ana-1' \
  -d '{"customer_id":"<customer id>"}'
# Poll GET /v1/enrollments/:id, redirect to checkout_url,
# then wait for succeeded + instrument_id before subscribing.

# 4. Subscribe — commits a pending first charge; read the subscription for its final status
curl -sS $BASE/v1/subscriptions "${auth[@]}" -H 'idempotency-key: sub-ana-1' \
  -d '{"customer_id":"<customer id>","items":[{"price_id":"<price id>","quantity":1}]}'

In NETOPIA_MODE=mock (the default) no real charges are made: a instrument token containing timeout simulates a provider timeout; otherwise pending returns an unresolved result, fail is declined, and anything else succeeds (checked in that order).