# Migration guide from Vonage Node SDK 2.x to 3.x
The package name has changed and is now a companion to the core Vonage Node SDK. You can continue to use the @vonage/server-sdk
package or now use the Numbers SDK as a standalone package. If you would like to continue to use the full SDK, update the version number to ^3.0
and follow this migration guide.
If you would like to use this SDK as a standalone package, you can install it using:
$ npm install @vonage/pricing
If you are using the main Vonage Node Server SDK, you will need to configure it using a Vonage API Key and Secret. The setup is the same for any other key/secret-based application. The applications client will then be available as vonage.pricing
.
const Vonage = require('@vonage/server-sdk');
const vonage = new Vonage({
apiKey: API_KEY,
apiSecret: API_SECRET,
});
vonage.pricing.listCountryPricing()
.then(resp => console.log(resp))
.catch(err => console.error(err));
This module is also capable of working as a standalone module. The only difference is that you create an Pricing
object and pass the credentials there.
const { pricing } = require('@vonage/pricing');
Functionality-wise, the standalone version works just as the wrapped SDK version.
The Node SDK v3.x uses Promises instead of callbacks. Customers need to convert their callbacks to work with the responses returned from the calls.
The module is fully written in TypeScript. While the users will interact with the transpired JavaScript code, IDEs and TypeScript compilers should provide a better experience than previous versions of the Vonage Node Server SDK.
2.x Method | 3.x Method | Notes |
---|---|---|
vonage.pricing.get() |
vonage.pricing.listCountryPricing |
This method has been renamed |
vonage.pricing.getFull() |
vonage.pricing.listAllCountriesPricing() |
This method has been renamed |
vonage.pricing.getPrefix() |
vonage.pricing.listPrefixPricing() |
This method has been renamed |
vonage.pricing.getPhone() |
Removed | This has been removed |