Write
Subs sdk write methods
Create Plan
Initialize Subs Client
import { SubsSDK, PaymentType, PeriodType, SubsPayment, Keypair } from 'subs-sdk';
// Initialize with wallet private key (keep this secure!)
const subsClient = new SubsSDK("YOUR_WALLET_PRIVATE_KEY", "testnet"); // "testnet" or "public"Payment Configuration
// Get creator keypair
const creatorKeypair = Keypair.fromSecret("OWNER_SECRET_KEY");
const creatorAddress = creatorKeypair.publicKey();
// Configure payment type
const paymentType: PaymentType = {
tag: "ERC20", // Only ERC20 for the moment.
values: undefined // For simple payment types
};
// Configure period type
const periodType: PeriodType = {
tag: "DAYS", // Other options: ONETIME | MINUTES | HOURS | WEEK | MONTH | YEAR
values: undefined
};Payment Plans Setup
Execute Creation
Returns App Url
Payment Struct
1. name
name2. owner
owner3. fee
fee4. payment_type
payment_type5. payment_tokens
payment_tokens6. period_type
period_type7. trial_period
trial_period8. limit_period
limit_period9. loading_time
loading_timeLast updated