from naturalpay import NaturalClient# API key created from dashboardclient = NaturalClient(api_key="sk_ntl_sandbox_...")# Create a payment on behalf of a customerpayment = await client.payments.create( recipient="contractor@example.com", amount=10000, # cents — $100.00 memo="Invoice #1234", agent_id="agt_019cd1798d637a4da75dce386343931d", customer_party_id="pty_019cd34e27c179bfbbe6870486b11b67", idempotency_key="pay_invoice_1234",)print(payment.transfer_id) # "xfr_..."print(payment.status) # "PENDING" or "PENDING_CLAIM"
Agents authenticate using API keys that belong to the developer’s party. When making payments on behalf of a customer, pass the agent ID and customer party ID:
# Payment using agent contextpayment = await client.payments.create( recipient="vendor@example.com", amount=50000, # cents — $500.00 memo="Vendor payment", agent_id="agt_019cd1798d637a4da75dce386343931d", # Your agent customer_party_id="pty_019cd34e27c27605a92edc2c7d1a5b34", # Customer who delegated idempotency_key="vendor_payment_001",)