Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@alexa-skill-components/in-skill-purchase
Advanced tools
Alexa skill component for in-skill purchase
Gather feedback on interactions to help drive skill development.
Please note: Alexa Skill Components are provided as a pre-production alpha release in developer preview with limited support. Our goal is to solicit feedback on our approach and design building towards their broader general availability in the future. While we will make every effort to minimize it, we do not make any backwards compatibility or rapid turn-around bug-fix promises with this pre-production alpha release. You can sign up for the developer preview to use these components.
Amazon is actively making updates to these components and looks forward to your feedback. Check back to get the latest version.
Sign up to join us in our effort to help you build more engaging Alexa skills faster!
In-skill purchasing (ISP) lets you sell premium digital content, such as hints in a trivia skill or additional lives in custom skills. ISP supports three payment models: one-time purchases, consumables, and subscriptions. The ISP skill component lets you add in-skill purchasing workflow to your skill as a pre-built voice experience. At this time, the component supports subscriptions only. Subscriptions offer access to premium content or features for a period of time, charged on a recurring basis until the user cancels the subscription.
Alexa Skill Components encapsulate best customer experience design practices to reduce your development time. To learn more about Skill Components, see Alexa Skill Components Getting Started.
Are you building an app in which you would like the customer to add the in-skill purchasing workflow into the skill, which lets Alexa Skill developers to sell premium content, such as game features or any other subscription in custom skills. Use the pre-built interaction patterns within the In-Skill Purchase Component to build out and customize such interactions.
The following interactions show a skill that offers three types of in-skill products: value subscription, premium subscription, and elite subscription.
The following example shows a purchase suggestion.
User > What can I buy?
Alexa > With our value subscription, you can access 45+ mindful
sessions; with our premium subscription, you can add 150+ guided
workouts, and with our elite subscription, you can set up dedicated
sessions with our certified trainers. Which one would you like to learn
more about?
User > Tell me more about the elite subscription
Alexa > Elite subscription is free for 7 days. Then, you’ll be
charged \$0.99 a month plus tax. Cancel anytime. Check the Alexa app for
terms. Should I start your free trial?
User > Yes
Alexa > Great! You're signed up.
The following example shows a cancellation.
User > Cancel elite subscription
Alexa > Okay! As a reminder, with elite subscription you can set up
dedicated sessions with our certified trainers. Are you sure you want to
cancel your subscription?
User > Yes
Alexa > Okay, I've canceled elite subscription, and you'll no longer
be charged. You can continue to use it until the end of this
subscription period.
Read the Skill Components Getting Started guide. If you're unfamiliar with skill development, the flight search example skill tutorial is a good starting place.
a. Make sure that you have an existing ACDL Alexa Skill or Get Started with ACDL Alexa Skill
b. Create and Manage In-Skill Products
Note: For this version Amazon supports the subscription payment model only.
Make sure that the package.json file exists in the skill's root directory. You can create a package.json file with the following command:
npm init
You can install the component from the public release or a local build of the component.
Public Release
npm install --save @alexa-skill-components/in-skill-purchase
npm install
npm install --save @alexa-skill-components/in-skill-purchase
npm install
Local Build
git clone git@github.com:alexa/skill-components.git
cd skill-components
cd in-skill-purchase
npm run clean-build
npm install --save "<path>/skill-components/in-skill-purchase"
npm install
npm install --save "<path>/skill-components/in-skill-purchase"
npm install
1. Invoke the purchase suggestion dialog in your existing ACDL dialog. Choose where you want to direct the user to select a product or start the purchase flow with a product specified. To do this, import the ISP component, and then call buySpecificProduct. The following example code shows the purchase dialog invocation.
namespace com.example.skill.name
import com.amazon.alexa.skill.components.inSkillPurchase.purchase.buySpecificProduct
dialog Nothing GameDialog {
dialog Nothing RideHailerDialog {
sample {
...
...
buySpecificProduct()
...
...
}
}
2. Invoke the upsell reusable dialog in your existing ACDL dialog at the point where you want to promote a product to user. To do this, import the ISP component, and then call upsell . The following example code shows the upsell dialog invocation.
namespace com.example.skill.name
import com.amazon.alexa.skill.components.inSkillPurchase.upsell.upsell
dialog Nothing GameDialog {
dialog Nothing RideHailerDialog {
sample {
...
...
upsell(upsellMessage, productName)
...
...
}
}
3. Invoke the cancel reusable dialog in your existing ACDL dialog at the point where you want to allow the user to cancel the purchase of any product. To do this, import the ISP component, and then call cancelPurchase. The following example code shows the cancel dialog invocation.
namespace com.example.skill.name
import com.amazon.alexa.skill.components.inSkillPurchase.cancel.cancelPurchase
dialog Nothing GameDialog {
dialog Nothing RideHailerDialog {
sample {
...
...
cancelPurchase()
...
...
}
}
4. Invoke the resume reusable dialog in your existing ACDL dialog at the point where you want to resume the skill after the purchase, cancel, and upsell dialogs complete. To do this, import the ISP component, and then call resumeAfterPurchase. The following example code shows the resume dialog invocation.
namespace com.example.skill.name
import com.alexa.reusable.component.inSkillPurchase.resume.resumeAfterPurchase
dialog Nothing GameDialog {
dialog Nothing RideHailerDialog {
sample {
...
...
buySpecificProduct()
...
resumeAfterPurchase()
...
...
}
}
1. Register API handlers
Import the API handlers into your main Lambda index.js file.
TypeScript
import { InSkillPurchase } from '@alexa-skill-components/in-skill-purchase';
exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
// your existing handler declarations
...InSkillPurchase.createHandlers(),
)
.withApiClient(new DefaultApiClient()) // for monetizationServiceClient
.lambda();
JavaScript
const isp = require('@alexa-skill-components/in-skill-purchase')
const DefaultApiClient = require('ask-sdk-core').DefaultApiClient;
exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
// your existing handler declarations
...isp.InSkillPurchase.createHandlers()
)
.withApiClient(new DefaultApiClient()) // for monetizationServiceClient
.lambda();
Build your skill as normal. The component's dialogs samples and API handlers that you integrated into the skill are built along-side your skill's own custom dialog samples and handlers. To build and deploy your skill, run the following command:
askx compile && askx deploy
Note: An Alexa Conversations skill deployment can take 20-40 minutes to complete.
To simulate your Alexa device, you can test your skill in the Alexa Developer Console on the Test tab Or, you can test your skill by using the Alexa Skills Kit CLI.
To test your skill by using the CLI, run the following command:
askx dialog -s <YOUR_SKILL_ID> -l en-US -g development
After you test the default behavior of the component, you can customize the ISP component. For details about customizations, see ACDL Reusable Dialogs reference.
To compile and deploy changes, run the following command:
askx compile && askx deploy
Details on all dialogs can be found in the Reference doc
Amazon welcomes your feedback. Connect with us on here.
Copyright 2022 Amazon.com, Inc., or its affiliates. All rights reserved. You may not use this file except in compliance with the terms and conditions set forth in the accompanying LICENSE file. THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
FAQs
Alexa skill component for in-skill purchase
The npm package @alexa-skill-components/in-skill-purchase receives a total of 7 weekly downloads. As such, @alexa-skill-components/in-skill-purchase popularity was classified as not popular.
We found that @alexa-skill-components/in-skill-purchase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.