Skip to content

Integration Getting Started ​

This guide helps developers set up their environment and make their first API call to GovPayPlan.

Prerequisites ​

  • GovPayPlan account with API access
  • Basic understanding of REST APIs
  • Development environment with HTTP client

Step 1: Get API Credentials ​

Sandbox Credentials ​

For testing, use sandbox credentials:

  1. Log in to the Admin Portal
  2. Navigate to Settings > API
  3. Find your Sandbox API Key

Production Credentials ​

Production keys are provided separately after integration review.

WARNING

Never use production credentials for testing. Always use the sandbox environment during development.

Step 2: Understand the API ​

Base URLs ​

EnvironmentBase URL
Sandboxhttps://sandbox-api.govpayplan.com/v1
Productionhttps://api.govpayplan.com/v1

Authentication ​

All requests require authentication via API key:

Authorization: Bearer YOUR_API_KEY

Request Format ​

  • Content-Type: application/json
  • All request bodies should be JSON

Response Format ​

All responses are JSON:

json
{
  "success": true,
  "data": { ... },
  "meta": { ... }
}

Step 3: Make Your First Request ​

Health Check ​

Verify your setup with a simple health check:

bash
curl -X GET https://sandbox-api.govpayplan.com/v1/health \
  -H "Authorization: Bearer YOUR_API_KEY"

Expected response:

json
{
  "success": true,
  "data": {
    "status": "healthy",
    "version": "1.0.0"
  }
}

Get Account Info ​

Retrieve your account information:

bash
curl -X GET https://sandbox-api.govpayplan.com/v1/account \
  -H "Authorization: Bearer YOUR_API_KEY"

Step 4: Create a Test Payment ​

Payment Request ​

bash
curl -X POST https://sandbox-api.govpayplan.com/v1/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 100.00,
    "currency": "USD",
    "payment_type": "permit_fee",
    "payer": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "payment_method": {
      "type": "card",
      "card_number": "4242424242424242",
      "exp_month": 12,
      "exp_year": 2025,
      "cvv": "123"
    }
  }'

Response ​

json
{
  "success": true,
  "data": {
    "id": "pay_abc123",
    "status": "completed",
    "amount": 100.00,
    "currency": "USD",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

API Resources ​

Core Endpoints ​

EndpointMethodDescription
/paymentsPOSTCreate a payment
/payments/{id}GETGet payment details
/payments/{id}/refundPOSTRefund a payment
/transactionsGETList transactions

Webhooks ​

Set up webhooks to receive real-time notifications:

SDKs and Libraries ​

Official SDKs ​

  • JavaScript/Node.js
  • Python
  • PHP
  • Ruby

Installation (Node.js example) ​

bash
npm install @govpayplan/sdk

Usage ​

javascript
const GovPayPlan = require('@govpayplan/sdk');

const client = new GovPayPlan({
  apiKey: 'YOUR_API_KEY',
  sandbox: true
});

const payment = await client.payments.create({
  amount: 100.00,
  currency: 'USD',
  // ...
});

Error Handling ​

Error Response Format ​

json
{
  "success": false,
  "error": {
    "code": "invalid_request",
    "message": "Amount must be greater than 0",
    "details": { ... }
  }
}

Common Error Codes ​

CodeDescription
invalid_requestRequest validation failed
authentication_errorInvalid or missing API key
payment_failedPayment was declined
not_foundResource not found
rate_limitedToo many requests

Rate Limits ​

EnvironmentLimit
Sandbox100 requests/minute
Production1000 requests/minute

Next Steps ​

GovPayPlan - Secure Payment Processing for Government Agencies