VietBilling
VietBilling Docs

API Reference

Tham chiếu các endpoint Public API cần cho subscription integration.

Base URL và xác thực

Base URL production là https://api.vietbilling.com/public/v2. Tất cả endpoint dưới đây dùng Authorization: Bearer <organization-api-key> và JSON. API key xác định Organization nên URL không chứa Organization ID.

MethodEndpointMục đích
POST/customersTạo Customer
POST/checkoutsTạo Checkout và có thể tự tạo Customer
GET/checkouts/{checkoutId}Đọc Checkout
GET/subscriptions/{subscriptionId}Đọc Subscription
PATCH/subscriptions/{subscriptionId}Đổi Product hoặc lên lịch/hủy lịch cancel
GET/benefit-grantsLiệt kê BenefitGrants đang hoạt động của Customer

Ví dụ request

curl -X GET \
  "https://api.vietbilling.com/public/v2/subscriptions/sub_123" \
  -H "Authorization: Bearer $VIETBILLING_API_KEY" \
  -H "Accept: application/json"

Quy ước lỗi

Kiểm tra HTTP status trước khi đọc dữ liệu. Lỗi validation cần được sửa tại request; lỗi xác thực cần dừng ngay; lỗi mạng và 5xx có thể retry với backoff và giới hạn số lần.