import Natural from "@naturalpay/sdk";
// One client per run: instanceId names the run, and the SDK sends it
// as X-Instance-ID on every call this client makes.
const client = new Natural({ instanceId: "invoice-run-1234" }); // agent key from NATURAL_API_KEY
// Create a payment on behalf of a customer
const payment = await client.payments.create({
amount: 10000, // cents - $100.00
currency: "USD",
counterparty: { type: "email", value: "contractor@example.com" },
description: "Invoice #1234",
customerPartyId: "pty_019cd34e27c179bfbbe6870486b11b67",
idempotencyKey: "pay-invoice-1234",
});
console.log(payment.data.id);
console.log(payment.data.attributes.status);