Get the FREE Ultimate OpenClaw Setup Guide →

bog-payment-gateway

npx machina-cli add skill furkha/claude-skill-bog-payment-gateway/bog-payment-gateway --openclaw
Files (1)
SKILL.md
3.9 KB

BOG Payment Gateway Integration

This skill provides guidance for integrating with the Bank of Georgia (BOG) Online Payment API.

Quick Reference

ItemValue
Auth URLhttps://oauth2.bog.ge/auth/realms/bog/protocol/openid-connect/token
API Basehttps://api.bog.ge/payments/v1
Auth MethodOAuth 2.0 Client Credentials
Data FormatJSON

IMPORTANT:

  • All callback URLs MUST use HTTPS
  • All API requests MUST include Accept-Language: ka or Accept-Language: en header

Integration Flow

  1. Authenticate - Get access token using client credentials
  2. Create Order - Submit order with basket items and callbacks
  3. Redirect - Send customer to payment page (URL from response)
  4. Handle Callback - Receive payment result at callback URL
  5. Verify - Check payment status via API

Authentication

const getAccessToken = async (clientId: string, clientSecret: string) => {
  const credentials = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');

  const response = await fetch(
    'https://oauth2.bog.ge/auth/realms/bog/protocol/openid-connect/token',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': `Basic ${credentials}`
      },
      body: 'grant_type=client_credentials'
    }
  );

  const { access_token, expires_in } = await response.json();
  return { access_token, expires_in };
};

Core Endpoints

Create Order

POST https://api.bog.ge/payments/v1/ecommerce/orders
Authorization: Bearer {access_token}
Content-Type: application/json

Request body:

{
  "callback_url": "https://example.com/callback",
  "external_order_id": "ORDER-123",
  "purchase_units": {
    "currency": "GEL",
    "total_amount": 100.00,
    "basket": [
      {
        "product_id": "PROD-1",
        "quantity": 1,
        "unit_price": 100.00
      }
    ]
  },
  "redirect_urls": {
    "success": "https://example.com/success",
    "fail": "https://example.com/fail"
  }
}

Response includes _links.redirect.href for payment page URL.

Get Payment Details

GET https://api.bog.ge/payments/v1/receipt/{order_id}
Authorization: Bearer {access_token}

Refund Payment

POST https://api.bog.ge/payments/v1/payment/refund/{order_id}
Authorization: Bearer {access_token}
Content-Type: application/json

{"amount": 50.00}  // Optional - omit for full refund

Response Codes

CodeMeaning
100Successful payment
200Successful preauthorization
101Card usage limited
102Saved card not found
103Invalid card
104Transaction limit exceeded
105Card expired
106Amount limit exceeded
107Insufficient funds
108Authentication declined
109Technical issue
110Transaction expired
111Authentication timeout
112General error

Detailed References

Implementation Checklist

  1. Store client_id and client_secret securely (env vars)
  2. Implement token caching with expiry handling
  3. Use HTTPS for all callback URLs
  4. Implement idempotency keys for order creation
  5. Handle all response codes appropriately
  6. Log transaction IDs for debugging

Source

git clone https://github.com/furkha/claude-skill-bog-payment-gateway/blob/main/skills/bog-payment-gateway/SKILL.mdView on GitHub

Overview

This skill guides integrating Bank of Georgia's Online Payment API for accepting online payments. It covers creating orders, processing refunds, checking payment status, and authenticating via OAuth 2.0, with HTTPS callbacks and language headers.

How This Skill Works

Authenticate with client credentials to obtain an access token, then create an order via the ecommerce/orders endpoint with basket items and callback/redirect URLs. Redirect the customer to the payment page using the URL from the response, handle the payment callback, and verify status via the receipt endpoint.

When to Use It

  • Building an online checkout flow for a Georgian e-commerce site.
  • Processing full or partial refunds through the BOG API.
  • Implementing OAuth 2.0 client credentials authentication for BOG.
  • Redirecting customers to the BOG-hosted payment page after order creation.
  • Verifying and reconciling payment status after callback.

Quick Start

  1. Step 1: Obtain an access token using client_id and client_secret via the OAuth token endpoint.
  2. Step 2: Create an order with basket items and callback/redirect URLs at POST https://api.bog.ge/payments/v1/ecommerce/orders.
  3. Step 3: Redirect the customer to the payment page URL from the response, handle the callback, then verify status with the receipt endpoint.

Best Practices

  • Use HTTPS for all callback URLs and ensure redirect URLs are secure.
  • Store and cache access tokens with proper expiry handling to minimize token requests.
  • Include Accept-Language: ka or Accept-Language: en in all API requests.
  • Implement idempotency keys for order creation to avoid duplicate charges.
  • Log transaction IDs and responses for tracing, debugging, and reconciliation.

Example Use Cases

  • Georgian e-commerce site implementing BOG to accept online payments and handle redirects to the BOG payment page.
  • Refund workflow demonstrating full and partial refunds via /payment/refund/{order_id}.
  • Callback handler that processes payment results and triggers order status updates.
  • OAuth 2.0 client credentials flow to obtain and refresh access tokens for API calls.
  • End-to-end flow for a single order: create order, redirect, callback, verify status.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers