サブアカウントの作成
このコード・スニペットでは、Subaccountsを作成する方法を説明します。
例
以下の変数が、便利な方法で必要な値に設定されていることを確認してください:
| キー | 説明 |
|---|---|
VONAGE_API_KEY | 親アカウントのAPIキー。 |
VONAGE_API_SECRET | 親アカウントのAPIシークレット。 |
NEW_SUBACCOUNT_NAME | 新しいSubaccountの名前。 |
NEW_SUBACCOUNT_SECRET | 新しいSubaccountのAPIシークレット。 |
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named create-subaccount.js and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk-kotlin:2.1.1'Create a class named CreateSubaccount and add the following code to the main method:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.subaccounts with the package containing CreateSubaccount:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk:9.3.1'Create a class named CreateSubaccount and add the following code to the main method:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.subaccounts with the package containing CreateSubaccount:
Prerequisites
Create a file named CreateSubAccountRequest.cs and add the following code:
Add the following to CreateSubAccountRequest.cs:
Prerequisites
Create a file named create-subaccount.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named create-subaccount.rb and add the following code:
Run your code
Save this file to your machine and run it:
試してみる
コードを実行すると、親アカウントの新しいSubaccountsが作成されます。
注: このコード・スニペットは、親アカウントと共有されるクレジットと残高機能を持つSubaccountsを作成します。親アカウントと共有されるクレジットと残高を持たないサブアカウントを作成したい場合は、次のように設定する必要があります。 use_primary_account_balance への false Subaccount を作成する際に使用します。