Skip to main content
Card-not-required trials give customers full access to a paid plan for a limited time without requiring payment information upfront. Customers can optionally add a payment method during the trial to continue using the plan after it expires. After the trial period, if no payment method is provided, customers lose access to the plan. If they add a payment method, billing begins automatically when the trial ends. Companies using this model include Cursor, Greptile and Vercel.

Configure Pricing

You can toggle on a trial for a plan when creating it, or in the “plan settings” section. Switch off the “card required” flag.
The “card required” flag will only be visible if the plan is a paid plan. However, you can also add a limited-time trial to a free plan.This is similar to a card-not-required trial, but there will be no automatic billing when the trial ends. Instead, you can manually attach the plan to the customer to bill them.
Since no card is required, you can choose whether the plan is enabled automatically when a customer is created, or if you want to manually attach the plan to a customer (eg, when they opt-in to the trial).If you switch the “auto-enable” flag to true, the trial plan will be automatically applied to newly created customers. The plan will be labelled as an auto-trial plan. Customers will only be able to access this trial once.You can also create another free auto-enable plan without a trial. This will be enabled if the customer does not add a payment method during the trial, or if they cancel their plan later on.

Implementation

Enabling the trial

Attach the plan to the customer to enable the trial. Since no card is required, no checkout is needed. If you switched the “auto-enable” flag to true, you can skip the attach step as the trial will be automatically applied to newly created customers.
import { useCustomer } from "autumn-js/react";

const { attach } = useCustomer();

const handleStartTrial = async () => {
    await attach({ productId: "pro" });
    console.log("Trial started");
};

<Button onClick={handleStartTrial}>Start Trial</Button>;
The trial will only be applied once per customer.

Adding a payment method

Customers can add a payment method and transition to the paid version of the plan using the setup payment endpoint. Once the trial ends, they will be charged for the plan. If the customer does not add a payment method, the trial will expire and they will lose access to the plan.
import { useCustomer } from "autumn-js/react";

const { setupPayment } = useCustomer();

const handleSetupPayment = async () => {
    await setupPayment();
};

<Button onClick={handleSetupPayment}>Add Payment Method</Button>;
If there’s a payment method on file, the customer will be charged. Otherwise, the trial plan will expire. If there’s another non-trial auto-enable plan (like a free tier), it will be automatically enabled.

Ending the trial early

You can end the trial early by cancelling the plan immediately, and attaching it again. You may want to pass in a reward into the attach request to give the customer a discount for upgrading early.
Make sure to warn the user that this action will cancel their current trial before proceeding.
import { useCustomer } from "autumn-js/react";

const { cancel, attach } = useCustomer();

const handleEarlyEnd = async () => {
    await cancel({
        productId: "pro",
        cancelImmediately: true,
    });
    await attach({
        productId: "pro",
        // give the customer a discount for upgrading early
        reward: "early_end",
    });
    
    console.log("Trial ended early");
};

<Button onClick={handleEarlyEnd}>Upgrade Now</Button>;