Files
pos-system/services/ads-billing-service-net/docs/vi

Ads Billing Service - Dịch vụ Thanh toán Quảng cáo

Microservice xử lý thanh toán, tín dụng và hóa đơn cho hệ thống quảng cáo.

Tổng Quan

Ads Billing Service quản lý toàn bộ tài chính của hệ thống quảng cáo:

  • Prepaid/Postpaid - Nạp tiền trước hoặc chạy trước trả sau
  • Credit Lines - Cấp hạn mức tín dụng tự động
  • Threshold Billing - Tự động charge khi đạt ngưỡng
  • Invoice Generation - Xuất hóa đơn VAT tự động

Yêu Cầu

Yêu cầu Phiên bản
.NET SDK 10.0.101+
Docker 24.0+
PostgreSQL 15+

Bắt Đầu Nhanh

cd services/ads-billing-service-net
docker-compose up -d

Cấu Trúc Dự Án

ads-billing-service-net/
├── src/
│   ├── AdsBillingService.API/
│   │   ├── Controllers/
│   │   │   ├── BillingAccountsController.cs
│   │   │   ├── CreditLinesController.cs
│   │   │   └── InvoicesController.cs
│   │   └── Application/
│   │
│   ├── AdsBillingService.Domain/
│   │   └── AggregatesModel/
│   │       ├── BillingAccountAggregate/
│   │       ├── CreditLineAggregate/
│   │       ├── InvoiceAggregate/
│   │       └── ChargeAggregate/
│   │
│   └── AdsBillingService.Infrastructure/
│
└── AdsBillingService.slnx

Mô Hình Thanh Toán

Prepaid (Trả trước)

Advertiser nạp $100 → Wallet → Campaigns sử dụng → Hết tiền = Pause

Postpaid (Trả sau)

Advertiser chạy ads → Tích lũy chi phí → Đạt $25 → Auto-charge → Invoice

API Endpoints

Billing Accounts

Method Endpoint Mô tả
GET /api/v1/ads-billing/accounts/{advertiserId} Thông tin tài khoản
POST /api/v1/ads-billing/accounts/{id}/add-funds Nạp tiền
GET /api/v1/ads-billing/accounts/{id}/balance Số dư hiện tại

Credit Lines

Method Endpoint Mô tả
GET /api/v1/ads-billing/credit-lines/{advertiserId} Hạn mức tín dụng
POST /api/v1/ads-billing/credit-lines/request Yêu cầu tăng hạn mức

Invoices

Method Endpoint Mô tả
GET /api/v1/ads-billing/invoices Danh sách hóa đơn
GET /api/v1/ads-billing/invoices/{id} Chi tiết hóa đơn
GET /api/v1/ads-billing/invoices/{id}/download Tải PDF hóa đơn

Billing Thresholds

Threshold Điều kiện
$25 Tài khoản mới
$50 Đã thanh toán 2 lần đúng hạn
$250 Đã thanh toán 5 lần đúng hạn
$500 Tài khoản uy tín cao

Tích Hợp

Service Tích hợp
Wallet Service Xử lý thanh toán
ads-serving-service Consume charge events
IAM Service Thông tin Advertiser

Cấu Hình

Biến Mô tả
DATABASE_URL PostgreSQL connection
WALLET_SERVICE_URL URL Wallet Service
RABBITMQ_URL RabbitMQ connection

Giấy Phép

Độc quyền - GoodGo Platform