from naturalpay import Natural
# NATURAL_API_KEY=ak_ntl_sandbox_...
client = Natural(
instance_id="sandbox-run-1",
base_url="https://api.sandbox.natural.com",
)
# Invite a test customer; one pending invitation is created per agent
invited = client.simulations.invite_customer(
agent_ids=["agt_019cd1798d637a4da75dce386343931d"],
permissions=["payments.create", "payments.read", "wallets.read"],
idempotency_key="test-customer-1",
)
customer_id = invited.meta.customer.party_id
# Accept the invitation as the test customer
client.simulations.accept_customer_invitation(
invitation_id=invited.data[0].id,
party_id=customer_id,
idempotency_key="accept-invitation-1",
)
# Fund it so payments on its behalf can settle
client.simulations.fund_customer(
customer_id=customer_id,
amount=250000, # cents - $2,500.00
currency="USD",
idempotency_key="fund-customer-1",
)
# Run your integration exactly as it runs in production
payment = client.payments.create(
amount=10000,
currency="USD",
counterparty={"type": "email", "value": "payment-recipient@sandbox.natural.test"},
customer_party_id=customer_id,
idempotency_key="pay-1",
)