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:
- WooCommerce/WordPress: create a payment gateway plugin that calls your server (or WordPress server-side hook) to create a Tempest Pay charge, stores order reference, redirects to
hosted_url, and marks paid only from a verified webhook. - Shopify/custom app: create charge in your backend app, redirect buyer to hosted checkout, verify webhook, then update order/payment state through Shopify/admin APIs.
- Custom checkout snippet: button submits to your backend endpoint; backend returns
hosted_url; frontend redirects. Never create charges from the browser with a secret key.
<form method="post" action="/checkout/tempest-pay">
<input type="hidden" name="reference" value="ORDER123" />
<button type="submit">Pay with crypto</button>
</form>