In the API, what is the best way to add a payment method to an account you are creating via the API?
There isn’t a best way, the available options are at https://sonar.software/apidoc/#api-Account_Payment_Methods
I’m aware of the the method but where I’m stumped is in providing an account ID to create payment for an account that isn’t yet created?!
When a new customer fills out a form to create their account (https://sonar.software/apidoc/#api-Accounts-PostAccount), how would they add their CC to their account without having the account ID?
You can’t. There needs to be an account. It’d be two API requests.
How would the page know what the newly created account’s ID is?
You’d get it from the API response when you create an account. The response JSON contains the account ID.