Skip to content

Direct API Integration

When to use direct integration

Direct API integration gives you full control over the payment UI — useful for native mobile apps or highly custom checkout flows. If you handle raw card numbers, your integration becomes in-scope for PCI DSS. See Security & PCI Compliance for details.

For most web integrations, the widget handles card data and keeps you out of PCI scope.

Create and confirm in sequence

Use a tokenised pm_xxx ID to create and immediately confirm a payment intent server-side:

Terminal window
# 1. Create payment intent
curl -X POST https://api.elasticpay.co/api/v1/payment_intents \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"amount": 3500, "currency": "AUD"}'
# 2. Confirm with tokenised payment method
curl -X POST https://api.elasticpay.co/api/v1/payment_intents/pi_0abc123/confirm \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"payment_method": "pm_0xyz789abc123def456ghi012jkl"}'

Idempotency

Add an Idempotency-Key header to safely retry requests without risk of double-charging:

Terminal window
curl -X POST https://api.elasticpay.co/api/v1/payment_intents \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_9a8b7c6d-unique-key-here" \
-d '{"amount": 3500, "currency": "AUD"}'
  • The same key returns the same response within the TTL window
  • Default TTL: 900 seconds; maximum: 1800 seconds
  • Keys are scoped per biller account
  • Use a UUID or a unique order/transaction identifier as the key