SDK and integration examples

Use these as backend-only examples. Never expose TEMPEST_SECRET_KEY or webhook secrets in browser/mobile code. Verify implementation details against OpenAPI and live API responses.

Node.js (fetch)

const BASE = 'https://tempesttouchwallet.com/api/v1';
export async function createCharge({ amount, reference, title }) {
  const res = await fetch(`${BASE}/charges`, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.TEMPEST_SECRET_KEY}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': reference,
    },
    body: JSON.stringify({ amount, currency: 'USD', title, reference }),
  });
  if (!res.ok) throw new Error(`Charge failed: ${res.status} ${await res.text()}`);
  return res.json(); // redirect customer to charge.hosted_url
}

PHP (cURL)

$ch = curl_init('https://tempesttouchwallet.com/api/v1/charges');
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer ' . getenv('TEMPEST_SECRET_KEY'),
    'Content-Type: application/json',
    'Idempotency-Key: ' . $reference,
  ],
  CURLOPT_POSTFIELDS => json_encode([
    'amount' => '25.00', 'currency' => 'USD', 'title' => 'Order', 'reference' => $reference,
  ]),
]);
$body = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch);
if ($status < 200 || $status >= 300) throw new Exception($body);
$charge = json_decode($body, true); header('Location: ' . $charge['hosted_url']);

Python (requests)

import os, requests
r = requests.post('https://tempesttouchwallet.com/api/v1/charges',
  headers={'Authorization': f"Bearer {os.environ['TEMPEST_SECRET_KEY']}", 'Content-Type':'application/json', 'Idempotency-Key': reference},
  json={'amount':'25.00','currency':'USD','title':'Order','reference':reference}, timeout=30)
r.raise_for_status()
charge = r.json()  # send customer to charge['hosted_url']

WooCommerce / Shopify / custom checkout

No official platform plugin is bundled in this repository yet. Recommended pattern:

<form method="post" action="/checkout/tempest-pay">
  <input type="hidden" name="reference" value="ORDER123" />
  <button type="submit">Pay with crypto</button>
</form>