Skip to main content
This walks through everything a cart plugin needs, in plain PHP with cURL: create a checkout for an order, send the customer to pay, receive and verify the checkout.paid webhook, confirm the payment, and refund. It runs on PHP 7.4 or later and adapts directly to a WooCommerce payment gateway (process_payment for step 2, a woocommerce_api_* endpoint for step 3). Keep your API key and webhook secret in your server’s configuration, never in the browser.

1. A small API helper

Never send an Authorization header: the API key goes only in X-API-Key (see Authentication).

2. Create a checkout and redirect

If the request times out, call start_payment again with the same attempt number: the Idempotency-Key returns the first checkout instead of creating a second.

3. Receive the webhook

Register https://shop.example.com/?wc-api=platnova (or your own URL) under Settings → Webhooks in the dashboard and copy its secret.
Answer within 25 seconds. A non-2xx answer is retried; see Delivery.

4. Verify, then fulfil once

Never fulfil from the webhook body alone. Ask Platnova:
Run the same check when the customer lands on your success_url, so the order shows paid even if the webhook is still on its way.

5. Refund

The final result arrives as checkout.refunded or checkout.refund_failed. Codes and rules are on Refunds.

Checklist before you ship

  • Keys only on the server; X-API-Key only, no Authorization header.
  • Every create and refund carries an idempotency key tied to the order.
  • Webhook signature checked over the raw body with hash_equals; non-2xx on failure.
  • Orders marked paid only after POST /v1/payments/verify, compared on amount and currency (case-insensitive), and only once per checkout id.
  • A clear message when a merchant’s calls answer entity_not_active (see Going live).