Offer free trials to your customers
Offering trials for your service is a great way to make your customers able to test your service before buying it. ProcessOut makes it easy to provide trial periods when using subscriptions.
How trial periods work
A trial period on a Subscription
↗ is defined by a date at which the trial period
will end. This field is the attribute trial_end_at
of a subscription, and can
be null
if you don’t want to allow any trial period for a given subscription.
Behind the hood, ProcessOut’s workers will pull any transaction with a trial date
that is set in the past and set this field to null
. Any subscription with a
subscription’s attribute trial_end_at
containing a date is therefore
considered as being in trial. Customers do not get charged when a subscription
is still in its trial period.
Additionnaly, when a subscription trial period gets to an end, the iterate_at
attribute of the subscription gets set to the current time to effectively start
the next iteration immediately.
Apply a trial to a subscription
Trials can be applied at any given time in a subscription life-cycle. However,
if applied when the subscription is active, the current subscription period will
be overwritten, meaning that the iterate_at
date set on the subscription will
be ignored and reset when the trial gets to an end.
curl -X PUT https://api.processout.com/subscriptions/sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR \
-u test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x:key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB \
-d trial_end_at="2022-10-02T15:00:00Z"
var ProcessOut = require("processout");
var client = new ProcessOut(
"test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
"key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB");
client.newSubscription().find("sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR").then(
function(subscription) {
subscription.setTrialEndAt("2022-10-02T15:00:00Z");
subscription.save().then(function(subscription) {
// The trial was correctly set on the subscription
}, function(err) {
// An error occured
});
}, function(err) {
// Could not find the subscription
});
import processout
client = processout.ProcessOut(
"test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
"key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB")
subscription = client.new_subscription().find("sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR")
subscription.trial_end_at = "2022-10-02T15:00:00Z"
subscription.save()
# The trial was correctly set on the subscription
require "processout"
client = ProcessOut::Client.new(
"test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
"key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB")
subscription = client.subscription.find("sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR")
subscription.trial_end_at = "2022-10-02T15:00:00Z"
subscription.save
# The trial was correctly set on the subscription
<?php
$client = new \ProcessOut\ProcessOut(
"test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
"key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB");
$subscription = $client->newSubscription()->find("sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR");
$subscription->setTrialEndAt("2022-10-02T15:00:00Z");
$subscription->save();
// The trial was correctly set on the subscription
import "github.com/processout/processout-go"
var client = processout.New(
"test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
"key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB",
)
sub, _ := client.NewSubscription().Find("sub_SSpcwpKNSa2WT2pixBRNyOnCrftmJeqR")
sub.TrialEndAt = processout.Time(time.Now())
sub, err = sub.Save()
if err != nil {
panic(err)
}
// The trial was correctly set on the subscription