Quickstart

This guide will help you start receiving payments with Devdraft API quickly and securely. Follow these steps to begin processing transactions and managing your business.

Step 1: Create Your AccountCopied!

Create your Devdraft business account:

Production Console

https://console.devdraft.ai

Sign up with your business email to get started immediately.

Step 2: Get Your API KeysCopied!

After signing up and accessing your dashboard:

  1. Navigate to App Settings

2. Navigat to → API Keys

3. Generate new API keys for your application

4. Store keys securely - never expose them in client-side code

You'll need these headers for all API requests:

x-client-key: your_client_key_here
x-client-secret: your_client_secret_here

Step 3: Make Your First API CallCopied!

Test your integration by fetching your app information:

curl -X GET 'https://api.devdraft.ai/api/v0/health' \
  -H 'x-client-key: your_client_key' \
  -H 'x-client-secret: your_client_secret'

Expected Response:

{
  "status": "ok",
  "timestamp": "2024-01-15T10:30:00Z"
}

Step 4: Create Your First CustomerCopied!

Before receiving payments, create a customer:

curl -X POST 'https://api.devdraft.ai/api/v0/customers' \
  -H 'Content-Type: application/json' \
  -H 'x-client-key: your_client_key' \
  -H 'x-client-secret: your_client_secret' \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com",
    "phoneNumber": "+1234567890"
  }'

Step 5: Create a Payment LinkCopied!

Generate a payment link to start receiving money:

curl -X POST 'https://api.devdraft.ai/api/v0/payment-links' \
  -H 'Content-Type: application/json' \
  -H 'x-client-key: your_client_key' \
  -H 'x-client-secret: your_client_secret' \
  -d '{
    "name": "Service Payment",
    "description": "Payment for consulting services",
    "amount": 100.00,
    "currency": "USD",
    "customerId": "customer_id_from_step_4"
  }'

Response:

{
  "id": "pl_1234567890",
  "url": "https://checkout.devdraft.ai/pl_1234567890",
  "status": "active",
  "amount": 100.00,
  "currency": "USD"
}

Step 6: Set Up WebhooksCopied!

Configure webhooks to receive real-time payment notifications:

In Your Dashboard:

  1. Go to App Settings → Webhooks

2. Add your webhook URL: https://yourapp.com/webhooks/devdraft

3.Select events: payment.completed, payment.failed, invoice.paid

Create Webhook via API:

curl -X POST 'https://api.devdraft.ai/api/v0/webhooks' \
  -H 'Content-Type: application/json' \
  -H 'x-client-key: your_client_key' \
  -H 'x-client-secret: your_client_secret' \
  -d '{
    "name": "Payment Notifications",
    "url": "https://yourapp.com/webhooks/devdraft",
    "isActive": true,
    "events": ["payment.completed", "payment.failed"]
  }'

Handle Webhook Events:

// Express.js example
app.post('/webhooks/devdraft', (req, res) => {
  const event = req.body;
  
  switch (event.type) {
    case 'payment.completed':
      console.log('Payment received:', event.data);
      // Update your database, send confirmation email, etc.
      break;
    case 'payment.failed':
      console.log('Payment failed:', event.data);
      // Handle failed payment
      break;
  }
  
  res.status(200).send('Webhook received');
});

Step 7: Create an Invoice (Optional)Copied!

For more formal billing, create and send invoices:

curl -X POST 'https://api.devdraft.ai/api/v0/invoices' \
  -H 'Content-Type: application/json' \
  -H 'x-client-key: your_client_key' \
  -H 'x-client-secret: your_client_secret' \
  -d '{
    "customerId": "customer_id_from_step_4",
    "name": "Your Business Name",
    "email": "billing@yourbusiness.com",
    "items": [
      {
        "product_id": "prod_123",
        "quantity": 1
      }
    ],
    "dueDate": "2024-02-15T00:00:00Z",
    "delivery": "EMAIL",
    "paymentMethods": ["BANK_TRANSFER", "STABLECOIN"],
    "status": "OPEN"
  }'

Next StepsCopied!

You're now ready to receive payments!

Explore More Features:

Advanced Integration:

Need Help?Copied!

Congrats you are officially part of the Devship!

You're now ready to start receiving payments with Devdraft. Your customers can pay you via bank transfers or digital wallets, and you'll receive real-time notifications about every transaction.