Subscription

Subscriptions to recurring plans for a particular customer.

Subscription / Create

Create | Delete | List | Find | Update

Examples

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

Subscription subscription = Subscription.create(new PaymentsMap()
        .set("customer", "[CUSTOMER ID]")
        .set("plan", "[PLAN ID]")
);

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

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

subscription = Simplify::Subscription.create({
        "plan" => "[PLAN ID]",
        "customer" => "[CUSTOMER ID]"
})

puts subscription.inspect
import simplify

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

subscription = simplify.Subscription.create({
        "plan" : "[PLAN ID]",
        "customer" : "[CUSTOMER ID]"

})

print subscription
<?php

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

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

$subscription = Simplify_Subscription::createSubscription(array(
        'plan' => '[PLAN ID]',
        'customer' => '[CUSTOMER ID]'
));

print_r($subscription);

?>
use Net::Simplify;

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

my $subscription = Net::Simplify::Subscription->create({
    plan => "[PLAN ID]",
    customer => "[CUSTOMER ID]"
});

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

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

PaymentsApi api = new PaymentsApi();

Subscription subscription = new Subscription();
subscription.Customer = new Customer("[CUSTOMER ID]");
subscription.Plan = new Plan("[PLAN ID]");

try
{
    subscription = (Subscription)api.Create(subscription);
}
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.subscription.create({
    plan : "[PLAN ID]",
    customer : "[CUSTOMER ID]"
}, function(errData, data){

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

    console.log("Success Response: " + JSON.stringify(data));
});
Create Subscription
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Subscription subscription = Subscription.create(new PaymentsMap()
        .set("coupon", "[COUPON ID]")
        .set("customer", "[CUSTOMER ID]")
        .set("plan", "[PLAN ID]")
);

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

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

subscription = Simplify::Subscription.create({
        "plan" => "[PLAN ID]",
        "customer" => "[CUSTOMER ID]",
        "coupon" => "[COUPON ID]"
})

puts subscription.inspect
import simplify

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

subscription = simplify.Subscription.create({
        "plan" : "[PLAN ID]",
        "customer" : "[CUSTOMER ID]",
        "coupon" : "[COUPON ID]"

})

print subscription
<?php

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

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

$subscription = Simplify_Subscription::createSubscription(array(
        'plan' => '[PLAN ID]',
        'customer' => '[CUSTOMER ID]',
        'coupon' => '[COUPON ID]'
));

print_r($subscription);

?>
use Net::Simplify;

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

my $subscription = Net::Simplify::Subscription->create({
    plan => "[PLAN ID]",
    customer => "[CUSTOMER ID]",
    coupon => "[COUPON ID]"
});

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

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

PaymentsApi api = new PaymentsApi();

Subscription subscription = new Subscription();
subscription.Coupon = new Coupon("[COUPON ID]");
subscription.Customer = new Customer("[CUSTOMER ID]");
subscription.Plan = new Plan("[PLAN ID]");

try
{
    subscription = (Subscription)api.Create(subscription);
}
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.subscription.create({
    plan : "[PLAN ID]",
    customer : "[CUSTOMER ID]",
    coupon : "[COUPON ID]"
}, function(errData, data){

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

    console.log("Success Response: " + JSON.stringify(data));
});
Create a custom subscription for a customer.
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Subscription subscription = Subscription.create(new PaymentsMap()
        .set("amount", 1234L)
        .set("customer", "[CUSTOMER ID]")
        .set("frequency", "MONTHLY")
        .set("frequencyPeriod", 1L)
        .set("name", "Custom Subscription")
);

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

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

subscription = Simplify::Subscription.create({
        "amount" => "1234",
        "name" => "Custom Subscription",
        "frequency" => "MONTHLY",
        "customer" => "[CUSTOMER ID]",
        "frequencyPeriod" => "1"
})

puts subscription.inspect
import simplify

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

subscription = simplify.Subscription.create({
        "amount" : "1234",
        "name" : "Custom Subscription",
        "frequency" : "MONTHLY",
        "customer" : "[CUSTOMER ID]",
        "frequencyPeriod" : "1"

})

print subscription
<?php

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

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

$subscription = Simplify_Subscription::createSubscription(array(
        'amount' => '1234',
        'name' => 'Custom Subscription',
        'frequency' => 'MONTHLY',
        'customer' => '[CUSTOMER ID]',
        'frequencyPeriod' => '1'
));

print_r($subscription);

?>
use Net::Simplify;

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

my $subscription = Net::Simplify::Subscription->create({
    amount => "1234",
    name => "Custom Subscription",
    frequency => "MONTHLY",
    customer => "[CUSTOMER ID]",
    frequencyPeriod => "1"
});

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

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

PaymentsApi api = new PaymentsApi();

Subscription subscription = new Subscription();
subscription.Amount = 1234;
subscription.Customer = new Customer("[CUSTOMER ID]");
subscription.Frequency = "MONTHLY";
subscription.FrequencyPeriod = 1;
subscription.Name = "Custom Subscription";

try
{
    subscription = (Subscription)api.Create(subscription);
}
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.subscription.create({
    amount : "1234",
    name : "Custom Subscription",
    frequency : "MONTHLY",
    customer : "[CUSTOMER ID]",
    frequencyPeriod : "1"
}, 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 the payment in the smallest unit of your currency. Example: 100 = $1.00
[min value: 50, max value: 9999900]
optional
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
coupon Coupon ID associated with the subscription optional
currency Currency code (ISO-4217). Must match the currency associated with your account.
[valid values: EUR, INR, USD, GBP]
optional
customer Customer that is enrolling in the subscription. optional
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". optional
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. optional
name Name describing subscription optional
plan The ID of the plan that should be used for the subscription. optional
quantity Quantity of the plan for the subscription.
[min value: 1]
optional
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
OUTPUT
coupon.id Unique ID of the coupon
customer.id Customer ID
id Unique id of the subscription
latestInvoice.id Unique id of the invoice
latestInvoice.payment.authorization.id Authorization ID
latestInvoice.payment.card.customer.id Customer ID
latestInvoice.payment.card.id Unique ID of the card associated with the payment
latestInvoice.payment.customer.id Customer ID
latestInvoice.payment.id Payment ID
latestInvoice.payment.refunds.id Unique id of the refund
latestInvoice.payment.transactionDetails.id Transaction details id
plan.id Unique id of the plan in the subscription for the customer
amount Amount of subscription 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
coupon Coupon assigned to the subscription.
coupon.amountOff Amount off of the price of the product in the smallest unit of your currency in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00
coupon.couponCode Code that identifies the coupon to be used.
coupon.dateCreated Date in UTC millis the coupon was created in the system
coupon.description A brief section that describes the coupon.
coupon.durationInMonths DEPRECATED - Duration in months that the coupon will be applied after it has first been selected.
coupon.endDate Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
coupon.maxRedemptions Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.numTimesApplied The number of times a coupon will be applied on a customer's subscription.
coupon.percentOff Percentage off of the price of the product. The percent off is a whole number.
coupon.startDate First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone.
coupon.timesRedeemed Number of times the coupon has been redeemed. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.total Total amount of the coupon in the smallest unit of your currency. Example: 100 = $1.00
currency Currency of payment
currentPeriodEnd End date in UTC millis of the current period
currentPeriodStart Start date in UTC millis of the current period
custom Indicates whether the subscription was created using a custom plan
customer The customer that the subscription belongs to
customer.email Email address of the customer
customer.name Name of the customer
dateCreated Date in UTC millis the subscription was created in the system
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.
latestInvoice Latest invoice associated with this subscription
latestInvoice.payment Payment for the invoice
latestInvoice.payment.amount Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.amountEstimated Flag indicating whether the settlement amount is estimated, or is the actual settled amount.
latestInvoice.payment.amountRemaining Amount of the payment less any refunds that have been applied in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.authCode Payment authorization code
latestInvoice.payment.authorization Authorization associated with a payment if the payment was not captured immediately.
latestInvoice.payment.card Credit or debit card being used to apply the payment to.
latestInvoice.payment.card.addressCity City of the cardholder.
latestInvoice.payment.card.addressCountry Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
latestInvoice.payment.card.addressLine1 Address of the cardholder.
latestInvoice.payment.card.addressLine2 Address of the cardholder if needed.
latestInvoice.payment.card.addressState State of residence of the cardholder. State abbreviations should be used.
latestInvoice.payment.card.addressZip Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
latestInvoice.payment.card.customer Customer associated with the card
latestInvoice.payment.card.customer.email Email address of the customer
latestInvoice.payment.card.customer.name Name of the customer
latestInvoice.payment.card.dateCreated Creation date in UTC millis of the card in the system
latestInvoice.payment.card.expMonth Expiration month of the card. Format is MM. Example: January = 01
latestInvoice.payment.card.expYear Expiration year of the card. Format is YY. Example: 2013 = 13
latestInvoice.payment.card.indicator Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
latestInvoice.payment.card.indicatorSource Card indicator source.
latestInvoice.payment.card.last4 Last 4 digits of the card number
latestInvoice.payment.card.name Name as appears on the card.
latestInvoice.payment.card.type Type of credit or debit card
latestInvoice.payment.currency Currency code (ISO-4217) for the transaction. Must match the currency associated with your account.
latestInvoice.payment.customer Customer associated with the payment
latestInvoice.payment.customer.email Email address of the customer
latestInvoice.payment.customer.name Name of the customer
latestInvoice.payment.dateCreated Date the payment occurred in UTC millis
latestInvoice.payment.declineReason Decline Reason.
latestInvoice.payment.description Description of payment
latestInvoice.payment.disputed Flag to indicate if there is a dispute on this payment
latestInvoice.payment.fee The fee charged for processing the transaction. This is the summation of a percentage of the transaction's value and a per transaction fee.
latestInvoice.payment.feeCurrency ISO4217 Currency code for the fee.
latestInvoice.payment.feeEstimated Flag indicating whether fees provided are estimated or actual.
latestInvoice.payment.paymentDate Date of payment in UTC millis.
latestInvoice.payment.paymentStatus Payment status.
latestInvoice.payment.reference Custom reference field to be used with outside systems
latestInvoice.payment.refunded Boolean if the payment was refunded or not
latestInvoice.payment.refundedFees The total amount of fees refunded as a result of refund(s) on a payment.
latestInvoice.payment.refunds Refunds associated with this payment
latestInvoice.payment.replayId The replayId that was submitted with the payment create request.
latestInvoice.payment.settlementAmount Amount of the payment converted to your currency.
latestInvoice.payment.settlementCurrency ISO4217 Currency code for the settlement currency.
latestInvoice.payment.source The source of the payment (one of ECOMMERCE or VIRTUAL_TERMINAL)
latestInvoice.payment.taxExempt Specify true to indicate that the payment is tax-exempt.
latestInvoice.payment.transactionData Level 2 and 3 data associated with the payment.
latestInvoice.payment.transactionDetails Raw response from the payment processor.
latestInvoice.payment.transactionDetails.data Raw response data from the acquirer.
name Name of subscription
plan Description of the plan in the subscription for a customer
plan.amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
plan.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).
plan.billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
plan.currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
plan.dateCreated Date in UTC millis the plan was created in the subscription for the customer
plan.frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
plan.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.
plan.name Name of the plan
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.
plan.trialPeriod Type of trial period for the plan
plan.trialPeriodQuantity Quantity of trial period. Example: 10
quantity Quantity of the plan for the subscription.
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.
start Date in UTC millis the subscription was signed up for by the customer
status Status of the subscription. Example: ACTIVE = The subscription is active and can be processed. CANCELED = The subscription has been cancelled and will no longer be processed.

Subscription / Delete

Create | Delete | List | Find | Update

Examples

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

Subscription subscription = Subscription.find("4TR6Bc");

subscription = subscription.delete();

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

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

subscription = Simplify::Subscription.find('4TR6Bc')

subscription = subscription.delete()

puts subscription.inspect
import simplify

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

subscription = simplify.Subscription.find('4TR6Bc')
subscription.delete()
<?php

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

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

$obj  = Simplify_Subscription::findSubscription('4TR6Bc');

$obj = $obj->deleteSubscription();

?>
use Net::Simplify;

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

$subscription = Net::Simplify::Subscription->find('4TR6Bc');

$subscription->delete();

using SimplifyCommerce.Payments;

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

PaymentsApi api = new PaymentsApi();


try
{
    String id = "1234";

    Subscription subscription = (Subscription)api.Find(typeof(Subscription), id);

    subscription = (Subscription)api.Delete(typeof(Subscription), subscription.Id);

    Console.WriteLine (subscription.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.subscription.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
coupon.id Unique ID of the coupon
customer.id Customer ID
id Unique id of the subscription
latestInvoice.id Unique id of the invoice
latestInvoice.payment.authorization.id Authorization ID
latestInvoice.payment.card.customer.id Customer ID
latestInvoice.payment.card.id Unique ID of the card associated with the payment
latestInvoice.payment.customer.id Customer ID
latestInvoice.payment.id Payment ID
latestInvoice.payment.refunds.id Unique id of the refund
latestInvoice.payment.transactionDetails.id Transaction details id
plan.id Unique id of the plan in the subscription for the customer
amount Amount of subscription 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
coupon Coupon assigned to the subscription.
coupon.amountOff Amount off of the price of the product in the smallest unit of your currency in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00
coupon.couponCode Code that identifies the coupon to be used.
coupon.dateCreated Date in UTC millis the coupon was created in the system
coupon.description A brief section that describes the coupon.
coupon.durationInMonths DEPRECATED - Duration in months that the coupon will be applied after it has first been selected.
coupon.endDate Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
coupon.maxRedemptions Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.numTimesApplied The number of times a coupon will be applied on a customer's subscription.
coupon.percentOff Percentage off of the price of the product. The percent off is a whole number.
coupon.startDate First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone.
coupon.timesRedeemed Number of times the coupon has been redeemed. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.total Total amount of the coupon in the smallest unit of your currency. Example: 100 = $1.00
currency Currency of payment
currentPeriodEnd End date in UTC millis of the current period
currentPeriodStart Start date in UTC millis of the current period
custom Indicates whether the subscription was created using a custom plan
customer The customer that the subscription belongs to
customer.email Email address of the customer
customer.name Name of the customer
dateCreated Date in UTC millis the subscription was created in the system
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.
latestInvoice Latest invoice associated with this subscription
latestInvoice.payment Payment for the invoice
latestInvoice.payment.amount Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.amountEstimated Flag indicating whether the settlement amount is estimated, or is the actual settled amount.
latestInvoice.payment.amountRemaining Amount of the payment less any refunds that have been applied in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.authCode Payment authorization code
latestInvoice.payment.authorization Authorization associated with a payment if the payment was not captured immediately.
latestInvoice.payment.card Credit or debit card being used to apply the payment to.
latestInvoice.payment.card.addressCity City of the cardholder.
latestInvoice.payment.card.addressCountry Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
latestInvoice.payment.card.addressLine1 Address of the cardholder.
latestInvoice.payment.card.addressLine2 Address of the cardholder if needed.
latestInvoice.payment.card.addressState State of residence of the cardholder. State abbreviations should be used.
latestInvoice.payment.card.addressZip Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
latestInvoice.payment.card.customer Customer associated with the card
latestInvoice.payment.card.customer.email Email address of the customer
latestInvoice.payment.card.customer.name Name of the customer
latestInvoice.payment.card.dateCreated Creation date in UTC millis of the card in the system
latestInvoice.payment.card.expMonth Expiration month of the card. Format is MM. Example: January = 01
latestInvoice.payment.card.expYear Expiration year of the card. Format is YY. Example: 2013 = 13
latestInvoice.payment.card.indicator Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
latestInvoice.payment.card.indicatorSource Card indicator source.
latestInvoice.payment.card.last4 Last 4 digits of the card number
latestInvoice.payment.card.name Name as appears on the card.
latestInvoice.payment.card.type Type of credit or debit card
latestInvoice.payment.currency Currency code (ISO-4217) for the transaction. Must match the currency associated with your account.
latestInvoice.payment.customer Customer associated with the payment
latestInvoice.payment.customer.email Email address of the customer
latestInvoice.payment.customer.name Name of the customer
latestInvoice.payment.dateCreated Date the payment occurred in UTC millis
latestInvoice.payment.declineReason Decline Reason.
latestInvoice.payment.description Description of payment
latestInvoice.payment.disputed Flag to indicate if there is a dispute on this payment
latestInvoice.payment.fee The fee charged for processing the transaction. This is the summation of a percentage of the transaction's value and a per transaction fee.
latestInvoice.payment.feeCurrency ISO4217 Currency code for the fee.
latestInvoice.payment.feeEstimated Flag indicating whether fees provided are estimated or actual.
latestInvoice.payment.paymentDate Date of payment in UTC millis.
latestInvoice.payment.paymentStatus Payment status.
latestInvoice.payment.reference Custom reference field to be used with outside systems
latestInvoice.payment.refunded Boolean if the payment was refunded or not
latestInvoice.payment.refundedFees The total amount of fees refunded as a result of refund(s) on a payment.
latestInvoice.payment.refunds Refunds associated with this payment
latestInvoice.payment.replayId The replayId that was submitted with the payment create request.
latestInvoice.payment.settlementAmount Amount of the payment converted to your currency.
latestInvoice.payment.settlementCurrency ISO4217 Currency code for the settlement currency.
latestInvoice.payment.source The source of the payment (one of ECOMMERCE or VIRTUAL_TERMINAL)
latestInvoice.payment.taxExempt Specify true to indicate that the payment is tax-exempt.
latestInvoice.payment.transactionData Level 2 and 3 data associated with the payment.
latestInvoice.payment.transactionDetails Raw response from the payment processor.
latestInvoice.payment.transactionDetails.data Raw response data from the acquirer.
name Name of subscription
plan Description of the plan in the subscription for a customer
plan.amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
plan.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).
plan.billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
plan.currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
plan.dateCreated Date in UTC millis the plan was created in the subscription for the customer
plan.frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
plan.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.
plan.name Name of the plan
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.
plan.trialPeriod Type of trial period for the plan
plan.trialPeriodQuantity Quantity of trial period. Example: 10
quantity Quantity of the plan for the subscription.
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.
start Date in UTC millis the subscription was signed up for by the customer
status Status of the subscription. Example: ACTIVE = The subscription is active and can be processed. CANCELED = The subscription has been cancelled and will no longer be processed.

Subscription / List

Create | Delete | List | Find | Update

Examples

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

ResourceList<Subscription> subscription = Subscription.list(new PaymentsMap("max", 30));

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

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

val = Simplify::Subscription.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"

subscriptions = simplify.Subscription.list({"max": 30})

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

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

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

$subscription = Simplify_Subscription::listSubscription(array("max" => 30));

print "Total: " . $subscription->total . "\n";
foreach ($subscription->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";

$subscriptions = Net::Simplify::Subscription->list({max => 30});

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

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

PaymentsApi api = new PaymentsApi();


try
{
    ResourceList<Subscription> subscription = (ResourceList<Subscription>)api.List(typeof(Subscription));

    Console.WriteLine ("Total: " + subscription.Total);
    Console.WriteLine ("List: " + subscription.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.subscription.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.customerFilter by the Id of the customer with the subscription
filter.planFilter by the Id of the plan linked to the subscription
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 subscription

*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, id, plan 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

Subscription / Find

Create | Delete | List | Find | Update

Examples

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

Subscription subscription = Subscription.find("4TR6Bc");

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

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

subscription = Simplify::Subscription.find('4TR6Bc')

puts subscription.inspect

import simplify

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

subscription = simplify.Subscription.find('4TR6Bc')

print subscription
<?php

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

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

$obj  = Simplify_Subscription::findSubscription('4TR6Bc');

print_r($obj);

?>
use Net::Simplify;

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

$subscription = Net::Simplify::Subscription->find('4TR6Bc');

print $subscription->{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";

    Subscription subscription = (Subscription)api.Find(typeof(Subscription), id);

    // output all properties
    Console.WriteLine(JsonConvert.SerializeObject(subscription).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.subscription.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
None
OUTPUT
coupon.id Unique ID of the coupon
customer.id Customer ID
id Unique id of the subscription
latestInvoice.id Unique id of the invoice
latestInvoice.payment.authorization.id Authorization ID
latestInvoice.payment.card.customer.id Customer ID
latestInvoice.payment.card.id Unique ID of the card associated with the payment
latestInvoice.payment.customer.id Customer ID
latestInvoice.payment.id Payment ID
latestInvoice.payment.refunds.id Unique id of the refund
latestInvoice.payment.transactionDetails.id Transaction details id
plan.id Unique id of the plan in the subscription for the customer
amount Amount of subscription 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
coupon Coupon assigned to the subscription.
coupon.amountOff Amount off of the price of the product in the smallest unit of your currency in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00
coupon.couponCode Code that identifies the coupon to be used.
coupon.dateCreated Date in UTC millis the coupon was created in the system
coupon.description A brief section that describes the coupon.
coupon.durationInMonths DEPRECATED - Duration in months that the coupon will be applied after it has first been selected.
coupon.endDate Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
coupon.maxRedemptions Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.numTimesApplied The number of times a coupon will be applied on a customer's subscription.
coupon.percentOff Percentage off of the price of the product. The percent off is a whole number.
coupon.startDate First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone.
coupon.timesRedeemed Number of times the coupon has been redeemed. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.total Total amount of the coupon in the smallest unit of your currency. Example: 100 = $1.00
currency Currency of payment
currentPeriodEnd End date in UTC millis of the current period
currentPeriodStart Start date in UTC millis of the current period
custom Indicates whether the subscription was created using a custom plan
customer The customer that the subscription belongs to
customer.email Email address of the customer
customer.name Name of the customer
dateCreated Date in UTC millis the subscription was created in the system
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.
latestInvoice Latest invoice associated with this subscription
latestInvoice.payment Payment for the invoice
latestInvoice.payment.amount Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.amountEstimated Flag indicating whether the settlement amount is estimated, or is the actual settled amount.
latestInvoice.payment.amountRemaining Amount of the payment less any refunds that have been applied in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.authCode Payment authorization code
latestInvoice.payment.authorization Authorization associated with a payment if the payment was not captured immediately.
latestInvoice.payment.card Credit or debit card being used to apply the payment to.
latestInvoice.payment.card.addressCity City of the cardholder.
latestInvoice.payment.card.addressCountry Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
latestInvoice.payment.card.addressLine1 Address of the cardholder.
latestInvoice.payment.card.addressLine2 Address of the cardholder if needed.
latestInvoice.payment.card.addressState State of residence of the cardholder. State abbreviations should be used.
latestInvoice.payment.card.addressZip Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
latestInvoice.payment.card.customer Customer associated with the card
latestInvoice.payment.card.customer.email Email address of the customer
latestInvoice.payment.card.customer.name Name of the customer
latestInvoice.payment.card.dateCreated Creation date in UTC millis of the card in the system
latestInvoice.payment.card.expMonth Expiration month of the card. Format is MM. Example: January = 01
latestInvoice.payment.card.expYear Expiration year of the card. Format is YY. Example: 2013 = 13
latestInvoice.payment.card.indicator Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
latestInvoice.payment.card.indicatorSource Card indicator source.
latestInvoice.payment.card.last4 Last 4 digits of the card number
latestInvoice.payment.card.name Name as appears on the card.
latestInvoice.payment.card.type Type of credit or debit card
latestInvoice.payment.currency Currency code (ISO-4217) for the transaction. Must match the currency associated with your account.
latestInvoice.payment.customer Customer associated with the payment
latestInvoice.payment.customer.email Email address of the customer
latestInvoice.payment.customer.name Name of the customer
latestInvoice.payment.dateCreated Date the payment occurred in UTC millis
latestInvoice.payment.declineReason Decline Reason.
latestInvoice.payment.description Description of payment
latestInvoice.payment.disputed Flag to indicate if there is a dispute on this payment
latestInvoice.payment.fee The fee charged for processing the transaction. This is the summation of a percentage of the transaction's value and a per transaction fee.
latestInvoice.payment.feeCurrency ISO4217 Currency code for the fee.
latestInvoice.payment.feeEstimated Flag indicating whether fees provided are estimated or actual.
latestInvoice.payment.paymentDate Date of payment in UTC millis.
latestInvoice.payment.paymentStatus Payment status.
latestInvoice.payment.reference Custom reference field to be used with outside systems
latestInvoice.payment.refunded Boolean if the payment was refunded or not
latestInvoice.payment.refundedFees The total amount of fees refunded as a result of refund(s) on a payment.
latestInvoice.payment.refunds Refunds associated with this payment
latestInvoice.payment.replayId The replayId that was submitted with the payment create request.
latestInvoice.payment.settlementAmount Amount of the payment converted to your currency.
latestInvoice.payment.settlementCurrency ISO4217 Currency code for the settlement currency.
latestInvoice.payment.source The source of the payment (one of ECOMMERCE or VIRTUAL_TERMINAL)
latestInvoice.payment.taxExempt Specify true to indicate that the payment is tax-exempt.
latestInvoice.payment.transactionData Level 2 and 3 data associated with the payment.
latestInvoice.payment.transactionDetails Raw response from the payment processor.
latestInvoice.payment.transactionDetails.data Raw response data from the acquirer.
name Name of subscription
plan Description of the plan in the subscription for a customer
plan.amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
plan.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).
plan.billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
plan.currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
plan.dateCreated Date in UTC millis the plan was created in the subscription for the customer
plan.frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
plan.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.
plan.name Name of the plan
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.
plan.trialPeriod Type of trial period for the plan
plan.trialPeriodQuantity Quantity of trial period. Example: 10
quantity Quantity of the plan for the subscription.
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.
start Date in UTC millis the subscription was signed up for by the customer
status Status of the subscription. Example: ACTIVE = The subscription is active and can be processed. CANCELED = The subscription has been cancelled and will no longer be processed.

Subscription / Update

Create | Delete | List | Find | Update

Examples

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

Subscription subscription = Subscription.find("4TR6Bc");

subscription.set("plan", "[PLAN ID]");

subscription.update();

require 'simplify'

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


subscription = Simplify::Subscription.find('4TR6Bc')

updates = {
        "plan" => "[PLAN ID]"

}

subscription.merge!(updates)

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

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

subscription = simplify.Subscription.find('4TR6Bc')

subscription["plan"] = '[PLAN ID]'

subscription.update()
<?php

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

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

$subscription  = Simplify_Subscription::findSubscription('4TR6Bc');

$updates = array(
        'plan' => '[PLAN ID]'

);

$subscription->setAll($updates);

$subscription->updateSubscription();

?>
use Net::Simplify;

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

$subscription = Net::Simplify::Subscription->find('4TR6Bc');

$subscription->{plan} = "[PLAN ID]";

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

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

PaymentsApi api = new PaymentsApi();

string id = "1234";

Subscription subscription = (Subscription)api.Find(typeof(Subscription), id);

subscription.Plan = new Plan("[PLAN ID]");


try
{
    subscription = (Subscription)api.Update(subscription);
}
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.subscription.update({
    id: "4TR6Bc", // ID of object to update
    plan : "[PLAN ID]"
}, function(errData, data){

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

    console.log("Success Response: " + JSON.stringify(data));
});
Update a custom subscription for a customer.
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";

Subscription subscription = Subscription.find("4TR6Bc");

subscription.set("amount", 2345L);
subscription.set("frequency", "MONTHLY");
subscription.set("frequencyPeriod", 1L);
subscription.set("name", "Custom Subscription");

subscription.update();

require 'simplify'

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


subscription = Simplify::Subscription.find('4TR6Bc')

updates = {
        "amount" => "2345",
        "name" => "Custom Subscription",
        "frequency" => "MONTHLY",
        "frequencyPeriod" => "1"

}

subscription.merge!(updates)

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

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

subscription = simplify.Subscription.find('4TR6Bc')

subscription["amount"] = '2345'
subscription["name"] = 'Custom Subscription'
subscription["frequency"] = 'MONTHLY'
subscription["frequencyPeriod"] = '1'

subscription.update()
<?php

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

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

$subscription  = Simplify_Subscription::findSubscription('4TR6Bc');

$updates = array(
        'amount' => '2345',
        'name' => 'Custom Subscription',
        'frequency' => 'MONTHLY',
        'frequencyPeriod' => '1'

);

$subscription->setAll($updates);

$subscription->updateSubscription();

?>
use Net::Simplify;

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

$subscription = Net::Simplify::Subscription->find('4TR6Bc');

$subscription->{amount} = "2345";
$subscription->{name} = "Custom Subscription";
$subscription->{frequency} = "MONTHLY";
$subscription->{frequencyPeriod} = "1";

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

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

PaymentsApi api = new PaymentsApi();

string id = "1234";

Subscription subscription = (Subscription)api.Find(typeof(Subscription), id);

subscription.Amount = 2345;
subscription.Frequency = "MONTHLY";
subscription.FrequencyPeriod = 1;
subscription.Name = "Custom Subscription";


try
{
    subscription = (Subscription)api.Update(subscription);
}
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.subscription.update({
    id: "4TR6Bc", // ID of object to update
    amount : "2345",
    name : "Custom Subscription",
    frequency : "MONTHLY",
    frequencyPeriod : "1"
}, 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 ID of the subscription to be updated. required
amount Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00
[min value: 50, max value: 9999900]
optional
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
coupon Coupon being assigned to this subscription optional
currency Currency code (ISO-4217). Must match the currency associated with your account.
[valid values: EUR, INR, USD, GBP]
optional
frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY". optional
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]
optional
name Name describing subscription optional
plan Plan that should be used for the subscription. optional
prorate Whether to prorate existing subscription.
[default: true]
required
quantity Quantity of the plan for the subscription.
[min value: 1]
optional
renewalReminderLeadDays If set, how many days before the next billing cycle that a renewal reminder is sent to the customer. If null or 0, no emails are sent. Minimum value is 7 if set. optional
OUTPUT
coupon.id Unique ID of the coupon
customer.id Customer ID
id Unique id of the subscription
latestInvoice.id Unique id of the invoice
latestInvoice.payment.authorization.id Authorization ID
latestInvoice.payment.card.customer.id Customer ID
latestInvoice.payment.card.id Unique ID of the card associated with the payment
latestInvoice.payment.customer.id Customer ID
latestInvoice.payment.id Payment ID
latestInvoice.payment.refunds.id Unique id of the refund
latestInvoice.payment.transactionDetails.id Transaction details id
plan.id Unique id of the plan in the subscription for the customer
amount Amount of subscription 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
coupon Coupon assigned to the subscription.
coupon.amountOff Amount off of the price of the product in the smallest unit of your currency in the currency of the merchant. While this field is optional, you must provide either amountOff or percentOff for a coupon. Example: 100 = $1.00
coupon.couponCode Code that identifies the coupon to be used.
coupon.dateCreated Date in UTC millis the coupon was created in the system
coupon.description A brief section that describes the coupon.
coupon.durationInMonths DEPRECATED - Duration in months that the coupon will be applied after it has first been selected.
coupon.endDate Last date of the coupon in UTC millis that the coupon can be applied to a subscription. This ends at 23:59:59 of the merchant timezone.
coupon.maxRedemptions Maximum number of redemptions allowed for the coupon. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.numTimesApplied The number of times a coupon will be applied on a customer's subscription.
coupon.percentOff Percentage off of the price of the product. The percent off is a whole number.
coupon.startDate First date of the coupon in UTC millis that the coupon can be applied to a subscription. This starts at midnight of the merchant timezone.
coupon.timesRedeemed Number of times the coupon has been redeemed. A redemption is defined as when the coupon is applied to the subscription for the first time.
coupon.total Total amount of the coupon in the smallest unit of your currency. Example: 100 = $1.00
currency Currency of payment
currentPeriodEnd End date in UTC millis of the current period
currentPeriodStart Start date in UTC millis of the current period
custom Indicates whether the subscription was created using a custom plan
customer The customer that the subscription belongs to
customer.email Email address of the customer
customer.name Name of the customer
dateCreated Date in UTC millis the subscription was created in the system
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.
latestInvoice Latest invoice associated with this subscription
latestInvoice.payment Payment for the invoice
latestInvoice.payment.amount Amount of the payment in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.amountEstimated Flag indicating whether the settlement amount is estimated, or is the actual settled amount.
latestInvoice.payment.amountRemaining Amount of the payment less any refunds that have been applied in the smallest unit of your currency. Example: 100 = $1.00
latestInvoice.payment.authCode Payment authorization code
latestInvoice.payment.authorization Authorization associated with a payment if the payment was not captured immediately.
latestInvoice.payment.card Credit or debit card being used to apply the payment to.
latestInvoice.payment.card.addressCity City of the cardholder.
latestInvoice.payment.card.addressCountry Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
latestInvoice.payment.card.addressLine1 Address of the cardholder.
latestInvoice.payment.card.addressLine2 Address of the cardholder if needed.
latestInvoice.payment.card.addressState State of residence of the cardholder. State abbreviations should be used.
latestInvoice.payment.card.addressZip Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
latestInvoice.payment.card.customer Customer associated with the card
latestInvoice.payment.card.customer.email Email address of the customer
latestInvoice.payment.card.customer.name Name of the customer
latestInvoice.payment.card.dateCreated Creation date in UTC millis of the card in the system
latestInvoice.payment.card.expMonth Expiration month of the card. Format is MM. Example: January = 01
latestInvoice.payment.card.expYear Expiration year of the card. Format is YY. Example: 2013 = 13
latestInvoice.payment.card.indicator Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
latestInvoice.payment.card.indicatorSource Card indicator source.
latestInvoice.payment.card.last4 Last 4 digits of the card number
latestInvoice.payment.card.name Name as appears on the card.
latestInvoice.payment.card.type Type of credit or debit card
latestInvoice.payment.currency Currency code (ISO-4217) for the transaction. Must match the currency associated with your account.
latestInvoice.payment.customer Customer associated with the payment
latestInvoice.payment.customer.email Email address of the customer
latestInvoice.payment.customer.name Name of the customer
latestInvoice.payment.dateCreated Date the payment occurred in UTC millis
latestInvoice.payment.declineReason Decline Reason.
latestInvoice.payment.description Description of payment
latestInvoice.payment.disputed Flag to indicate if there is a dispute on this payment
latestInvoice.payment.fee The fee charged for processing the transaction. This is the summation of a percentage of the transaction's value and a per transaction fee.
latestInvoice.payment.feeCurrency ISO4217 Currency code for the fee.
latestInvoice.payment.feeEstimated Flag indicating whether fees provided are estimated or actual.
latestInvoice.payment.paymentDate Date of payment in UTC millis.
latestInvoice.payment.paymentStatus Payment status.
latestInvoice.payment.reference Custom reference field to be used with outside systems
latestInvoice.payment.refunded Boolean if the payment was refunded or not
latestInvoice.payment.refundedFees The total amount of fees refunded as a result of refund(s) on a payment.
latestInvoice.payment.refunds Refunds associated with this payment
latestInvoice.payment.replayId The replayId that was submitted with the payment create request.
latestInvoice.payment.settlementAmount Amount of the payment converted to your currency.
latestInvoice.payment.settlementCurrency ISO4217 Currency code for the settlement currency.
latestInvoice.payment.source The source of the payment (one of ECOMMERCE or VIRTUAL_TERMINAL)
latestInvoice.payment.taxExempt Specify true to indicate that the payment is tax-exempt.
latestInvoice.payment.transactionData Level 2 and 3 data associated with the payment.
latestInvoice.payment.transactionDetails Raw response from the payment processor.
latestInvoice.payment.transactionDetails.data Raw response data from the acquirer.
name Name of subscription
plan Description of the plan in the subscription for a customer
plan.amount Amount of payment for the plan in the smallest unit of your currency. Example: 100 = $1.00
plan.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).
plan.billingCycleLimit The number of fixed billing cycles for a plan. Only used if the billingCycle parameter is set to FIXED. Example: 4
plan.currency Currency code (ISO-4217) for the plan. Must match the currency associated with your account.
plan.dateCreated Date in UTC millis the plan was created in the subscription for the customer
plan.frequency Frequency of payment for the plan. Used in conjunction with frequencyPeriod. Valid values are "DAILY", "WEEKLY", "MONTHLY" and "YEARLY".
plan.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.
plan.name Name of the plan
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.
plan.trialPeriod Type of trial period for the plan
plan.trialPeriodQuantity Quantity of trial period. Example: 10
quantity Quantity of the plan for the subscription.
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.
start Date in UTC millis the subscription was signed up for by the customer
status Status of the subscription. Example: ACTIVE = The subscription is active and can be processed. CANCELED = The subscription has been cancelled and will no longer be processed.