Skip to content

Conversation

@edobranov
Copy link
Member

@edobranov edobranov commented Nov 12, 2025

Ticket

https://viam.atlassian.net/browse/APP-10017

Dependencies before merging

Manual testing

Ran this Python script against the temp environment in https://github.com/viamrobotics/app/pull/10331:

import asyncio

from viam.rpc.dial import DialOptions, Credentials
from viam.app.viam_client import ViamClient

async def main():
    viam_client = await connect()
    cloud = viam_client.billing_client

    invoice_id_response = await cloud.create_invoice_and_charge_immediately(
        "d8f70806-0a66-44a3-b229-813273e8b31b",
        1,
        "A short description.",
    )
    print(invoice_id_response)

    viam_client.close()

async def connect() -> ViamClient:
    dial_options = DialOptions.with_api_key(api_key="...", api_key_id="...")

    return await ViamClient.create_from_dial_options(
        dial_options,
        app_url="https://pr-10331-appmain-bplesliplq-uc.a.run.app",
    )

if __name__ == '__main__':
    asyncio.run(main())

And it printed the expected invoice ID:

$ python3 ./invoice-test.py

invoice_id: "ac73874b-a4fc-44d2-87a0-f0cd80bd52c9"

image

@edobranov edobranov requested a review from a team as a code owner November 12, 2025 14:44
@edobranov edobranov requested review from njooma and stuqdog and removed request for a team November 12, 2025 14:44
Base automatically changed from workflow/update-proto to main November 17, 2025 16:15
@edobranov edobranov force-pushed the APP-10017-return-invoice-id branch from cb90cd2 to a54afd1 Compare November 17, 2025 16:50
Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor question (feel free to leave as-is if that makes the most sense), otherwise lgtm!

org_id_for_branding: Optional[str] = None,
disable_email: bool = False,
) -> None:
) -> CreateInvoiceAndChargeImmediatelyResponse:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(q) Would it make sense to return the inner ID so a user just gets the string and doesn't have to index into it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant since that makes it harder to return another value without a backwards breaking change. There was some talk in another channel about returning the invoice status too, so I think it's better if we leave the door open for something like that.

@edobranov edobranov merged commit 2969616 into main Nov 17, 2025
13 checks passed
@edobranov edobranov deleted the APP-10017-return-invoice-id branch November 17, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants