Billing

Package: agentrouter.billing.v1 Service: BillingService

Endpoints

Get your balance

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Returns the caller's balance.

Request body: None.

Response fields:

FieldRequiredDescription
balancenoundocumented
currencynoundocumented
{"signatures":{"go":"c.Billing().GetMyBalance(ctx, \u0026billingv1.GetMyBalanceRequest{...})","python":"client.billing.getmybalance(...)","typescript":"client.billing.getmybalance({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"get-your-balance"}

List your transactions

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Pages through the caller's ledger, newest first.

Request fields:

FieldRequiredDescription
pageno1-based. Zero means the first page.
page_sizenoAt most 100. Zero means 10.
typeno"credit" or "debit". Empty means both.

Response fields:

FieldRequiredDescription
transactionsnoundocumented
total_countnoundocumented
{"signatures":{"go":"c.Billing().ListMyTransactions(ctx, \u0026billingv1.ListMyTransactionsRequest{...})","python":"client.billing.listmytransactions(...)","typescript":"client.billing.listmytransactions({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"list-your-transactions"}

List your top-ups

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Pages through the caller's top-up attempts, newest first.

Request fields:

FieldRequiredDescription
pagenoundocumented
page_sizenoundocumented
typeno"manual" or "auto". Empty means both.
statusno"pending", "success", "failed" or "cancelled". Empty means all.

Response fields:

FieldRequiredDescription
topupsnoundocumented
total_countnoundocumented
{"signatures":{"go":"c.Billing().ListMyTopups(ctx, \u0026billingv1.ListMyTopupsRequest{...})","python":"client.billing.listmytopups(...)","typescript":"client.billing.listmytopups({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"list-your-top-ups"}

Get a receipt

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Returns the Stripe receipt of one of the caller's card payments. receipt_url is empty when the transaction has no receipt.

Request fields:

FieldRequiredDescription
transaction_idnoundocumented

Response fields:

FieldRequiredDescription
receipt_urlnoundocumented
transactionnoThe transaction the receipt is for.
{"signatures":{"go":"c.Billing().GetMyReceiptUrl(ctx, \u0026billingv1.GetMyReceiptUrlRequest{...})","python":"client.billing.getmyreceipturl(...)","typescript":"client.billing.getmyreceipturl({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"get-a-receipt"}

Get your auto top-up settings

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Returns the caller's auto top-up settings. It writes nothing: a caller with no Stripe customer gets no settings.

Request body: None.

Response fields:

FieldRequiredDescription
settingsnoAbsent when the caller has no Stripe customer yet.
{"signatures":{"go":"c.Billing().GetMyAutoTopupSettings(ctx, \u0026billingv1.GetMyAutoTopupSettingsRequest{...})","python":"client.billing.getmyautotopupsettings(...)","typescript":"client.billing.getmyautotopupsettings({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"get-your-auto-top-up-settings"}

List your payment methods

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Lists the caller's saved cards. It writes nothing: a caller with no Stripe customer gets an empty list.

Request body: None.

Response fields:

FieldRequiredDescription
payment_methodsnoundocumented
{"signatures":{"go":"c.Billing().ListMyPaymentMethods(ctx, \u0026billingv1.ListMyPaymentMethodsRequest{...})","python":"client.billing.listmypaymentmethods(...)","typescript":"client.billing.listmypaymentmethods({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"list-your-payment-methods"}

Start a top-up

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Starts a manual top-up. With use_saved_card, Stripe charges the caller's default card now. Without it, the response carries the client secret of a payment intent that the browser confirms. The credit lands when Stripe reports the payment. A second manual top-up while one is pending gets FAILED_PRECONDITION; more manual top-ups in an hour than the deployment allows get RESOURCE_EXHAUSTED.

Request fields:

FieldRequiredDescription
amount_centsnoWhole cents, from 1000 to 1000000 ($10 to $10,000).
use_saved_cardnoCharge the default saved card now instead of returning a client secret.
save_payment_methodnoFor a new card: keep it for later payments and make it the default.

Response fields:

FieldRequiredDescription
topup_idnoThe pending top-up attempt.
payment_intent_idnoundocumented
client_secretnoFor a new card: the browser confirms this with Stripe.
succeedednoFor a saved card: whether Stripe accepted the charge. False means the card was declined; the attempt is failed.
{"signatures":{"go":"c.Billing().StartTopup(ctx, \u0026billingv1.StartTopupRequest{...})","python":"client.billing.starttopup(...)","typescript":"client.billing.starttopup({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"start-a-top-up"}

Cancel a pending top-up

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Cancels one of the caller's pending top-ups, for a browser payment the user abandoned.

Request fields:

FieldRequiredDescription
topup_idnoundocumented
{"signatures":{"go":"c.Billing().CancelPendingTopup(ctx, \u0026billingv1.CancelPendingTopupRequest{...})","python":"client.billing.cancelpendingtopup(...)","typescript":"client.billing.cancelpendingtopup({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"cancel-a-pending-top-up"}

Update your auto top-up settings

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Changes the caller's auto top-up settings.

Request fields:

FieldRequiredDescription
enablednoWith enabled false and both amounts zero, auto top-up turns off and keeps its stored amounts.
threshold_centsnoWhole cents, from 1000 to 100000. With enabled, above zero.
target_balance_centsnoWhole cents, from 100 to 1000000. With enabled, at least $5 above the threshold.

Response fields:

FieldRequiredDescription
settingsnoundocumented
{"signatures":{"go":"c.Billing().UpdateMyAutoTopupSettings(ctx, \u0026billingv1.UpdateMyAutoTopupSettingsRequest{...})","python":"client.billing.updatemyautotopupsettings(...)","typescript":"client.billing.updatemyautotopupsettings({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"update-your-auto-top-up-settings"}

Start saving a card

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Starts saving a new card: the browser confirms the returned client secret with Stripe.

Request body: None.

Response fields:

FieldRequiredDescription
client_secretnoundocumented
{"signatures":{"go":"c.Billing().CreateMySetupIntent(ctx, \u0026billingv1.CreateMySetupIntentRequest{...})","python":"client.billing.createmysetupintent(...)","typescript":"client.billing.createmysetupintent({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"start-saving-a-card"}

Set your default card

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Makes one of the caller's saved cards the default.

Request fields:

FieldRequiredDescription
payment_method_idnoundocumented
{"signatures":{"go":"c.Billing().SetMyDefaultPaymentMethod(ctx, \u0026billingv1.SetMyDefaultPaymentMethodRequest{...})","python":"client.billing.setmydefaultpaymentmethod(...)","typescript":"client.billing.setmydefaultpaymentmethod({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"set-your-default-card"}

Remove a card

Changed in v0.11.0 (new features): Self-service balance, top-ups, auto top-up and cards through the API.

Connect / gRPC only

What it does: Removes one of the caller's saved cards.

Request fields:

FieldRequiredDescription
payment_method_idnoundocumented
{"signatures":{"go":"c.Billing().DeleteMyPaymentMethod(ctx, \u0026billingv1.DeleteMyPaymentMethodRequest{...})","python":"client.billing.deletemypaymentmethod(...)","typescript":"client.billing.deletemypaymentmethod({...})"},"examples":{"go":"// No Go SDK wrapper for BillingService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for BillingService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for BillingService yet -- use the CLI or curl example below."},"persona":"Dashboard user (session token)","slug":"remove-a-card"}