Skip to main content

Developer Documentation

Step 2 of 3: Create subscription and customer

The next step is to create a subscription.

A subscription ties a subscription plan and a customer:

  1. A reference to an existing customer can be used

  2. or a new customer can be created when creating the subscription.

There are two options to create subscriptions:

  1. Use either the Billwerk+ Subscription Management (Lite/ Expert) administration website to do it manually:

    1. Go to the admin UI.

    2. Navigate to Customers and click on the relevant customer entry in the table.

    3. Click on Create Subscription, then choose the plan you created earlier.

      For more detailed information, read this help center article.

  2. or integrate them via API calls.

    If you instead wish to integrate directly with your system, you can do so using API calls. This allows you to seamlessly integrate the subscription into your website.

    Please find more information about the endpoint in our API documentation.

Billwerk+ Subscriptions (Lite/ Expert) has two models for creating subscriptions :

  1. Create an immediate active subscription and subsequently get payment information from the customer.

  2. Create a pending subscription that is activated once the customer enters payment information.

2a Create active subscription

An active subscription can be created in the administration as described above, or using API calls.

Here is example code in a number of languages :

Please see the full API documentation for creating subscriptions here: Create subscription.

Note

Notice the argument signup_method.

In the example link is used to indicate that payment information will be obtained using a Checkout Subscription session.

It is also possible to use email as signup method. In this case Billwerk+ will send a signup email with information on how to set payment information for the subscription.

2b Create pending subscription

If the subscription should only be active when the customer enters valid payment information, a pending subscription can be created.

A pending subscription is like a template for a subscription waiting to be activated.

Use this approach if you do not want to start billing the customer until payment information has been obtained.

Here is example code :

cURL :

curl --request POST \
  --url https://api.reepay.com/v1/subscription/prepare \
  --header 'Accept: application/json' \
  -u 'priv_11111111111111111111111111111111:' \
  --header 'Content-Type: application/json' \
  --data '{"plan":"plan-AAAAA",
           "handle": "subscription-101",
           "create_customer": {
              "handle": "customer-007",
              "email": "joe@example.com"
           }
          }'

See the full API documentation for creating a pending subscriptions here: Prepare Subscription .

Note

Please note:

  1. As the price of a potential initial invoice can depend on the time, when a subscription is created, e.g. prorated billing,

  2. and that the price needs to be known, when the customer enters payment information, as the initial invoice will be attempted paid,

the billing dates will be set from the time the pending subscription was created.