Quick Start

Get up and running with Hedge Payments in 5 minutes

🤖 Using AI Tools?

Hedge Payments works seamlessly with Claude, Claude Code, ChatGPT, Codex, and other AI platforms. Check out our AI Integration Guide for AI-specific setup instructions.

📋 Before you begin

  • Create a Hedge Payments account at hedgepayments.com/signup
  • Obtain your API credentials from the dashboard
  • Have Node.js 16+ or Python 3.8+ installed

Step 1: Install the SDK

Install the Hedge Payments SDK for your preferred language:

Node.js

npm install @hedgepayments/sdk

Python

pip install hedgepayments

Step 2: Initialize the Client

Create a new instance of the Hedge Payments client with your API credentials:

Node.js

import { HedgePayments } from '@hedgepayments/sdk'

const hedge = new HedgePayments({
  apiKey: 'your_api_key_here',
  environment: 'sandbox' // or 'production'
})

Python

from hedgepayments import HedgePayments

hedge = HedgePayments(
    api_key='your_api_key_here',
    environment='sandbox'  # or 'production'
)

🔐 Keep your API key secure:
Never commit API keys to version control. Use environment variables instead.

Step 3: Create Your First Payment

Create a payment request to accept crypto or fiat:

Node.js

const payment = await hedge.payments.create({
  amount: 100.00,
  currency: 'USD',
  customerEmail: 'user@example.com',
  description: 'Premium subscription',
  metadata: {
    orderId: 'order_123'
  }
})

console.log('Payment URL:', payment.url)
console.log('Payment ID:', payment.id)

Python

payment = hedge.payments.create(
    amount=100.00,
    currency='USD',
    customer_email='user@example.com',
    description='Premium subscription',
    metadata={
        'order_id': 'order_123'
    }
)

print('Payment URL:', payment.url)
print('Payment ID:', payment.id)

Step 4: Redirect to Payment Page

Redirect your customer to the payment URL returned in the response. Hedge Payments will handle the entire payment flow, including:

  • ✓ Currency selection (crypto or fiat)
  • ✓ Secure payment processing
  • ✓ Transaction confirmations
  • ✓ Automatic redirect back to your app
// Redirect user to payment page
window.location.href = payment.url

Step 5: Handle Payment Confirmation

Set up a webhook endpoint to receive payment confirmation notifications:

Node.js (Express)

app.post('/webhooks/hedge', async (req, res) => {
  const signature = req.headers['x-hedge-signature']
  const event = hedge.webhooks.verify(req.body, signature)

  if (event.type === 'payment.completed') {
    const payment = event.data
    console.log('Payment completed:', payment.id)

    // Update your database, send confirmation email, etc.
  }

  res.status(200).send('OK')
})

Python (Flask)

@app.route('/webhooks/hedge', methods=['POST'])
def hedge_webhook():
    signature = request.headers.get('X-Hedge-Signature')
    event = hedge.webhooks.verify(request.data, signature)

    if event.type == 'payment.completed':
        payment = event.data
        print(f'Payment completed: {payment.id}')

        # Update your database, send confirmation email, etc.

    return 'OK', 200