question

TommyS avatar image
TommyS asked

Error trying to use MonetizationServiceClient

Hi,

I am trying to use MonetizationServiceClient with Java SDK.

Attempting to use service client factory with no configured API client.


When I do:

MonetizationServiceClient client = input.getServiceClientFactory().getMonetizationService();
InSkillProduct product = client.getInSkillProduct("en-EN", "myid");

I am receiving:

java.lang.IllegalStateException: Attempting to use service client factory with no configured API client


What to I need to do in order to configure this API client?

Thanks!


javaisp
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Amazon_Bernardo Bezerra avatar image
Amazon_Bernardo Bezerra answered

Hi @TommyS and thanks for your post.

I used the sample code from the Alexa official GitHub repository over here to create and deploy a skill implementing ISP. The only difference I could see is that the sample uses the final keyword before declaring the client and product.

If you still encounter this problem after checking that code, feel free to share a bigger snippet of yours so I can help you better.

If you are not comfortable sharing your code in this open forum, you can always open a ticket with us in the alexa.design/contactus page. If you do so, please make sure to reference this thread.

Regards,
Barry

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kagey avatar image
kagey answered

en-EN isnt a valid locale. You should pull the user's locale from the input request. I've come across scenarios where the monetization service throws exceptions, i just prentend that purchases aren't available if that happens.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.