Need clarification on API error - subscriptions API

Hi just need some clarification on an error that I received. In my code I have the following

if result.is_success():
  print('success create subscription ',result.body)
elif result.is_error():
  print('error create subscription ',result.errors)

what I see in the terminal now is

error create subscription  [{'category': 'API_ERROR', 'code': 'INTERNAL_SERVER_ERROR', 'detail': 'An internal error has occurred, and the API was unable to service your request.'}]

but when I look in the dashboard (see screenshot)

the invoice was created in spite of the error? Can someone clarify the error above and/or why the invoice exists if it generated an error when created? Thanks

Are you also subscribed to webhooks?

Thanks @Bryan-Square for replying. Not subscribed, just following the subscription walkthrough. Didn’t know the webhook option existed or was necessary? After some looking through the docs I came to the page found here which shows 2 events (subscription updated & created). So I’ll try it & follow up if there are more errors…

OK @Bryan-Square I’ve added a webhook & tested it with success. Just finished trying to create a subscription & I’m stuck at the same place with the same error. I thought I’d see something different in the terminal from the line

print('error create subscription ',result.errors)

but once again it’s the same

error create subscription  [{'category': 'API_ERROR', 'code': 'INTERNAL_SERVER_ERROR', 'detail': 'An internal error has occurred, and the API was unable to service your request.'}]

Are there additional changes I need to make to the code (all taken from the subscriptions API walkthrough) to see what/why the error happens & why I still see invoices in the dashboard? Thanks

We’re still looking into this but webhooks aren’t required but if they are helpful. I’ll reach out when I have an update :slightly_smiling_face: