I'm trying to to test my in-skill purchasable subcription in the Alexa simulator, but am running into problems on the Alexa server side.
Here my the status of my created subscription in the ASK-CLI:
[ { "editableState": "EDITABLE", "lastUpdated": "2018-07-29T16:09:21.073Z", "nameByLocale": { "en-US": "my product" }, "pricing": { "amazon.com": { "defaultPriceListing": { "currency": "USD", "price": 4.99, "primeMemberPrice": 4 }, "releaseDate": "2018-07-28T00:00:00Z" } }, "productId": "amzn1.adg.product.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "purchasableState": "PURCHASABLE", "referenceName": "my-product", "stage": "development", "status": "COMPLETE", "type": "SUBSCRIPTION" } ]
I've used the command 'ask deploy' around 20 times at this point and it successfully uploads to my alexa skill and Lambda.
I'm following the template from here when implementing my BuyHandler for this purchasable: https://github.com/alexa/skill-sample-nodejs-fact-in-skill-purchases
In my buy handler, when a user has confirmed their BuyIntent I run the following code to get my subscription object in Lambda:
const locale = handlerInput.requestEnvelope.request.locale; const ms = handlerInput.serviceClientFactory.getMonetizationServiceClient(); return ms.getInSkillProducts(locale).then(function initiatePurchase(result) { ... rest of code below ...
However in my result object that gets returned in initiatePurchase, here is my subscription obejct:
[{ "productId": "amzn1.adg.product.amzn1.adg.product.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "referenceName": "my-product", "type": "SUBSCRIPTION", "name": "my product", "summary": "This is a valuable product. ", "entitled": "NOT_ENTITLED", "purchasable": "NOT_PURCHASABLE" } ]
At this point I'm hesitant because my subscription is "PURCHASABLE" in my ASK-CLI, but not here. To create my 'Buy' directive, I still proceed and enter the 'productId' in the 'Connections.SendRequest' directive. Here is the code:
return handlerInput.responseBuilder .addDirective({ type: 'Connections.SendRequest', name: 'Buy', payload: { InSkillProduct: { productId: subcriptionId, // Insert my productId here }, }, token: 'correlationToken', }) .getResponse();
And alas I receive this response:
"request": { "type": "Connections.Response", "requestId": "amzn1.echo-api.request.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX", "timestamp": "2018-07-29T17:07:01Z", "locale": "en-US", "status": { "code": "400", "message": "BAD REQUEST" }, "name": "Buy", "payload": { "message": "This feature is not supported." }, "token": "correlationToken" }
This time the error is saying the entire feature of purchasing a subscription is not supported. For further testing I cloned the entire test repo here: https://github.com/alexa/skill-sample-nodejs-fact-in-skill-purchases, ran it, and got the same error at the same spot.
I'm working currently in Canada but have all my account settings set to the US. I'm just trying to test, not certify/publish my skill. Any ideas? My tin foil theory is that I need to change my IP address to the US but I doubt that is the case.
Thank you for all ideas/feedback.