Payment Integration
Kortana payments run on our native DNR ledger. This guide shows how to initiate checkout billing intents, capture payouts, and listen to transaction status hooks safely.
Create a Payment Intent
Payment Intents represent transaction requests. To generate an active intent, specify the amount in wei (1 DNR = 1018 wei):
// Initialize payment intent of 100 DNR
const intent = await client.payments.createIntent({
amount_wei: "100000000000000000000", // 100 DNR in Wei
currency: "DNR",
customer_name: "Alice Mercer",
customer_email: "alice@mercer.com",
description: "Bespoke Yacht Charter Deposit"
});
console.log(`Payment Intent Created: ${intent.id} - Status: ${intent.status}`);Verify Webhook Signatures
When transactions succeed, our system sends POST hooks to your endpoints. To prevent spoofing, compute the HMAC-SHA256 signature using the raw payload body and verify it against the x-kortana-signature header:
import crypto from 'crypto';
// Verify signature header
function verifySignature(payload, signatureHeader, secret) {
const hash = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return hash === signatureHeader;
}