Skip to content

Billing ​

Gommo Developer client

Official Gommo Developer TypeScript client — npm alias @ai-gateway/client. Calls Gommo public API (api.gommo.net, v2.api.gommo.net).

→ Gommo public API · Roadmap

Coming to Gommo platform

client.billing requires self-hosted gateway (transport: 'gateway', gatewayBaseUrl). Gommo platform billing SDK is on the roadmap.

Gommo billing API — credit top-up via bank transfer (gateway proxy today).

Status and packages ​

typescript
const status = await client.billing.status();
const packages = await client.billing.packages();
typescript
const me = await client.auth.me();
const username = me.userInfo?.username!;

const payment = await client.billing.createPayment({
  username,
  packageId: 'basic-member',
  invoiceBuyer: {
    type: 'consumer',
    name: 'Bán cho người tiêu dùng',
    email: '',
  },
  promoCode: 'OPTIONAL',
});

const orderCode = payment.data?.content ?? payment.data?.orderCode;
console.log(payment.data?.qrImage);

Poll until paid ​

typescript
const sync = await client.billing.syncPayment({ orderCode: String(orderCode) });
if (sync.data?.paid) console.log('Credits applied by Gommo');

Order history ​

typescript
const orders = await client.billing.listOrders(username, 20);

Legacy PayOS ​

typescript
const order = await client.billing.createTopup({ username, packageId: 'basic-member' });

Requires server PAYOS_* + merchant token.

See Billing reference and Cookbook: Gommo credit top-up.