Plan

Recurring payment plans that are used to create subscriptions.

Plan / Create

Create | Delete | List | Find | Update

Examples

Create Plan
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Plan plan = Plan.create(new PaymentsMap()
        .set("amount", 1000L)
        .set("billingCycle", "FIXED")
        .set("billingCycleLimit", 4L)
        .set("frequency", "WEEKLY")
        .set("frequencyPeriod", 2L)
        .set("name", "plan2")
        .set("renewalReminderLeadDays", 7L)
);

System.out.println(plan);
require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

plan = Simplify::Plan.create({
        "amount" => "1000",
        "billingCycleLimit" => "4",
        "billingCycle" => "FIXED",
        "renewalReminderLeadDays" => "7",
        "name" => "plan2",
        "frequencyPeriod" => "2",
        "frequency" => "WEEKLY"
})

puts plan.inspect
import simplify

simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"

plan = simplify.Plan.create({
        "amount" : "1000",
        "billingCycleLimit" : "4",
        "billingCycle" : "FIXED",
        "renewalReminderLeadDays" : "7",
        "name" : "plan2",
        "frequencyPeriod" : "2",
        "frequency" : "WEEKLY"

})

print(plan)
<?php

require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$plan = Simplify_Plan::createPlan(array(
        'amount' => '1000',
        'billingCycleLimit' => '4',
        'billingCycle' => 'FIXED',
        'renewalReminderLeadDays' => '7',
        'name' => 'plan2',
        'frequencyPeriod' => '2',
        'frequency' => 'WEEKLY'
));

print_r($plan);

?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";

my $plan = Net::Simplify::Plan->create({
    amount => "1000",
    billingCycleLimit => "4",
    billingCycle => "FIXED",
    renewalReminderLeadDays => "7",
    name => "plan2",
    frequencyPeriod => "2",
    frequency => "WEEKLY"
});

print "Plan ID ", $plan->{id}, "\n";
using SimplifyCommerce.Payments;

PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";

PaymentsApi api = new PaymentsApi();

Plan plan = new Plan();
plan.Amount = 1000;
plan.BillingCycle = "FIXED";
plan.BillingCycleLimit = 4;
plan.Frequency = "WEEKLY";
plan.FrequencyPeriod = 2;
plan.Name = "plan2";
plan.RenewalReminderLeadDays = 7;

try
{
    plan = (Plan)api.Create(plan);
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_PUBLIC_API_KEY',
        privateKey: 'YOUR_PRIVATE_API_KEY'
    });

client.plan.create({
    amount : "1000",
    billingCycleLimit : "4",
    billingCycle : "FIXED",
    renewalReminderLeadDays : "7",
    name : "plan2",
    frequencyPeriod : "2",
    frequency : "WEEKLY"
}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error.message);
        // handle the error
        return;
    }

    console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
[min value: 50, max value: 9999900]
required
billingCycle How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles).
[default: AUTO]
optional
billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4 optional
currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
[default: USD]
required
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
[default: MONTHLY]
required
frequencyPeriod Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
[min value: 1, default: 1]
required
name Name of the plan
[max length: 50, min length: 2]
required
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set. optional
trialPeriod Plan free trial period selection. Must be Days, Weeks, or Month
[default: NONE]
required
trialPeriodQuantity Quantity of the trial period. Must be greater than 0 and a whole number.
[min value: 1]
optional
OUTPUT
id Unique id of the plan in the subscription for the customer
amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
billingCycle How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles).
billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
dateCreated Date in UTC millis the plan was created in the subscription for the customer
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
frequencyPeriod Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
name Name of the plan
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
trialPeriod Type of trial period for the plan
trialPeriodQuantity Quantity of trial period. Example: 10

Plan / Delete

Create | Delete | List | Find | Update

Examples

Delete Plan
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Plan plan = Plan.find("4TR6Bc");

plan = plan.delete();

System.out.println(plan);
require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

plan = Simplify::Plan.find('4TR6Bc')

plan = plan.delete()

puts plan.inspect
import simplify

simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"

plan = simplify.Plan.find('4TR6Bc')
plan.delete()
<?php

require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$obj  = Simplify_Plan::findPlan('4TR6Bc');

$obj = $obj->deletePlan();

?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";

$plan = Net::Simplify::Plan->find('4TR6Bc');

$plan->delete();

using SimplifyCommerce.Payments;

PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";

PaymentsApi api = new PaymentsApi();


try
{
    String id = "1234";

    Plan plan = (Plan)api.Find(typeof(Plan), id);

    plan = (Plan)api.Delete(typeof(Plan), plan.Id);

    Console.WriteLine (plan.Id);
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}

var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_PUBLIC_API_KEY',
        privateKey: 'YOUR_PRIVATE_API_KEY'
    });

client.plan.delete("4TR6Bc", function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error.message);
        // handle the error
        return;
    }

    console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id Object ID required
OUTPUT
id Unique id of the plan in the subscription for the customer
amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
billingCycle How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles).
billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
dateCreated Date in UTC millis the plan was created in the subscription for the customer
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
frequencyPeriod Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
name Name of the plan
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
trialPeriod Type of trial period for the plan
trialPeriodQuantity Quantity of trial period. Example: 10

Plan / List

Create | Delete | List | Find | Update

Examples

List Plan
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

ResourceList<Plan> plan = Plan.list(new PaymentsMap("max", 30));

System.out.println ("Total: " + plan.getTotal());
for (Plan o: plan.getList()) {
    System.out.println(o.toString());
}
require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

val = Simplify::Plan.list({"max" => 30})

puts "Total: #{val['total']}"
val['list'].each do |o|
    puts o.inspect
end
import simplify

simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"

plans = simplify.Plan.list({"max": 30})

print "Total: " + str(plans.total)
for o in plans.list:
    print(o)
<?php

require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$plan = Simplify_Plan::listPlan(array("max" => 30));

print "Total: " . $plan->total . "\n";
foreach ($plan->list as $o) {
    print_r($o);
}

?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";

$plans = Net::Simplify::Plan->list({max => 30});

print "Total: ", $plans->total, "\n";
foreach my $plan ($plans->list) {
    print $plan->{id}, "\n";
}
using SimplifyCommerce.Payments;

PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";

PaymentsApi api = new PaymentsApi();


try
{
    ResourceList<Plan> plan = (ResourceList<Plan>)api.List(typeof(Plan));

    Console.WriteLine ("Total: " + plan.Total);
    Console.WriteLine ("List: " + plan.List.ToString());

}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}

var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_PUBLIC_API_KEY',
        privateKey: 'YOUR_PRIVATE_API_KEY'
    });

client.plan.list({max: 30}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error.message);
        // handle the error
        return;
    }

    console.log("Total: " + data.total);

    for(var i=0; i < data.list.length; i++){
        console.log("Amount: " + data.list[i].amount);
    }
});
INPUT PARAMETERS
filter
filter.idFilter by the plan Id
filter.textFilter by the name of the plan
filter.frequencyFilter by the frequency of the plan
filter.amountMin & filter.amountMaxThe filter amountMin must be used with amountMax to find plans with plan values between the min and max figures
filter.dateCreatedMin*Filter by the minimum created date you are searching for - Date in UTC millis
filter.dateCreatedMax*Filter by the maximum created date you are searching for - Date in UTC millis
filter.qYou can use this to filter by the Id, the name or the amount of the plan

*Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates
optional
max Allows up to a max of 50 list items to return.
[min value: 0, max value: 50, default: 20]
optional
offset Used in paging of the list. This is the start offset of the page.
[min value: 0, default: 0]
optional
sorting Allows for ascending or descending sorting of the list. The value is a map between the property name and the sorting direction (either 'asc' for ascending or 'desc' for descending). Sortable properties are:dateCreated, amount, frequency, name, id optional
OUTPUT
filter Filters to apply to the list.
list Object list
max Allows up to a max of 50 list items to return.
offset Used in paging of the list. This is the start offset of the page.
sorting Allows for ascending or descending sorting of the list.
total Total number of records available

Plan / Find

Create | Delete | List | Find | Update

Examples

Find Plan
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Plan plan = Plan.find("4TR6Bc");

System.out.println (plan);
require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"

plan = Simplify::Plan.find('4TR6Bc')

puts plan.inspect

import simplify

simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"

plan = simplify.Plan.find('4TR6Bc')

print(plan)
<?php

require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$obj  = Simplify_Plan::findPlan('4TR6Bc');

print_r($obj);

?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";

$plan = Net::Simplify::Plan->find('4TR6Bc');

print $plan->{id}, "\n";
using SimplifyCommerce.Payments;
using Newtonsoft.Json;

PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";

PaymentsApi api = new PaymentsApi();


try
{
    String id = "1234";

    Plan plan = (Plan)api.Find(typeof(Plan), id);

    // output all properties
    Console.WriteLine(JsonConvert.SerializeObject(plan).ToString());
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}

var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_PUBLIC_API_KEY',
        privateKey: 'YOUR_PRIVATE_API_KEY'
    });

client.plan.find("4TR6Bc", function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error.message);
        // handle the error
        return;
    }

    console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id Object ID required
OUTPUT
id Unique id of the plan in the subscription for the customer
amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
billingCycle How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles).
billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
dateCreated Date in UTC millis the plan was created in the subscription for the customer
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
frequencyPeriod Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
name Name of the plan
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
trialPeriod Type of trial period for the plan
trialPeriodQuantity Quantity of trial period. Example: 10

Plan / Update

Create | Delete | List | Find | Update

Examples

Update Plan
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Plan plan = Plan.find("4TR6Bc");

plan.set("name", "plan2");

plan.update();

require 'simplify'

Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"


plan = Simplify::Plan.find('4TR6Bc')

updates = {
        "name" => "plan2"

}

plan.merge!(updates)

plan = plan.update()
puts plan.inspect
import simplify

simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"

plan = simplify.Plan.find('4TR6Bc')

plan["name"] = 'plan2'

plan.update()
<?php

require_once("./lib/Simplify.php");

Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';

$plan  = Simplify_Plan::findPlan('4TR6Bc');

$updates = array(
        'name' => 'plan2'

);

$plan->setAll($updates);

$plan->updatePlan();

?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";

$plan = Net::Simplify::Plan->find('4TR6Bc');

$plan->{name} = "plan2";

$plan->update();
using SimplifyCommerce.Payments;

PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";

PaymentsApi api = new PaymentsApi();

string id = "1234";

Plan plan = (Plan)api.Find(typeof(Plan), id);

plan.Name = "plan2";


try
{
    plan = (Plan)api.Update(plan);
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}


var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_PUBLIC_API_KEY',
        privateKey: 'YOUR_PRIVATE_API_KEY'
    });

client.plan.update({
    id: "4TR6Bc", // ID of object to update
    name : "plan2"
}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error.message);
        // handle the error
        return;
    }

    console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id Unique ID of the plan. required
name Name of the plan.
[min length: 2]
required
OUTPUT
id Unique id of the plan in the subscription for the customer
amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
billingCycle How the plan is billed to the customer. Values must be AUTO (indefinitely until the customer cancels) or FIXED (a fixed number of billing cycles).
billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
dateCreated Date in UTC millis the plan was created in the subscription for the customer
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
frequencyPeriod Period of frequency of payment for the plan. Example: if the frequency is weekly, and periodFrequency is 2, then the subscription is billed bi-weekly.
name Name of the plan
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null, then no emails are sent. Minimum value is 7 if set.
trialPeriod Type of trial period for the plan
trialPeriodQuantity Quantity of trial period. Example: 10