Subscriptions

Below are directions on how to use Stripe as your subscription management platform and thus leverage the subscription management capabilities of Stripe while accepting crypto payments.

Overview

Steps

1. Get setup using the automated setup

Get setup in minutes by simply providing Loop with a Stripe API key. Don't want to do this? Reach out to Loop for directions on our manual setup.

2. Add a product in Stripe

At integration, Loop will pull in any “products” already configured. Going forward, as products are made in Stripe, they will automatically be created in Loop. You can see how to add products in Stripe here.

3. Edit which tokens and networks you want to accept

By default, any product brought in from these systems will have ALL the tokens saved in the contract enabled. If you would like to limit the tokens, you will need to edit the item's accepted tokens list. Here are directions.

4. Provide a method for collecting authorization

Companies have two ways to collect authorization for subscriptions, via the hosted checkout page or the checkout modal.

By default, Loop collects emails which companies can use as an identifier to link the customer or companies can also choose to pass through an external reference ID.

Checkout page

Loop provides a custom checkout page for each item with the type of "subscription". This page can be sent directly to the end customer via email, telegram, or an externally generated invoice, or it can be embedded directly on your site in a "pay with crypto" button.

Checkout widget

For those that prefer, Loop provides a checkout widget that can be integrated in the context of your company's website or application, to enable your customers to pay with crypto. The modal allows end users to give Loop authorization to enable autopay.

Existing customers in Stripe

If you are collecting authorization from an existing customer that is already subscribed to a Stripe plan and wants to pay in crypto, you can append the subscription ID to the end of the hosted checkout page URL. You can find details on appending the ID to the hosted checkout page here and to the modal in the NPM readme here.

Invoice payment timing

After your customer provides authorization, Loop will process payments for all finalized Invoices related to that authorization. Additionally, Loop will the Draft invoices related to that authorization in the Transfers table, for tracking purposes. Note, when Stripe finalizes invoices, Stripe's system changes the time that the invoice is due to the end of that day, which is when Loop will process the payment. Loop always updates the due date and time for the Transfer based on the current due date for the invoice in Stripe. When payments are processed, Loop marks the invoice as paid in Stripe.

5. Provide access to your end-product

Since Loop marks invoices in Stripe as paid, you can continue to use any integrations you've built off of Stripe as the method for providing access. No need to change anything.

However, if you want to provide access to your users based on a reference ID you pass to Loop or the end customer's wallet address, you can listen to Loop webhook events.

The AgreementSignedUp event lets you know that a wallet provided authorization to be billed - it does not mean you have been paid yet, but it does indicate the user has set an allowance for payments. The TransferProcessed event is the payment notification and indicates funds have been sent to the receiving wallet. If there is a trial or coupon, there is no TransferProcessed event until the amount due is > 0 and the due date has passed.

You can use an external reference ID field that you can pass to Loop during checkout, which is also returned in the AgreementSignedUp and TransferProcessedevents if it's set during checkout, to provide access to your system. You can alternatively use the wallet address or email provided in the Loop webhook AgreementSignedUp and TransferProcessed events to map to users in your system to provide access to your system.

Even with immediate invoicing, there will be a delay between the webhook events, as the transaction must be confirmed on-chain. Companies can decide to grant access based on the AgreementSignedUp event and take action if you do not hear about the TransferProcessed event within a certain amount of time, (e.g. show a warning, etc). We built Loop to be flexible, so companies can decide how "aggressive" they want to be about payment confirmation.

There are a few reasons why the TransferProcessed event would not occur:

  • The wallet does not have enough balance to cover the payment

  • The wallet does not have enough token allowance to cover the payment

  • The transaction is stuck in the mempool

  • Loop's relay network is down

Wallet amount and balance information can be found on our company dashboard for all active subscribers if you are troubleshooting a late payment.

6. Provide method for cancelation

Loop and Stripe will talk back and forth: when you cancel in Loop, it will be directly reflected in Stripe and visa versa.

  • Customers can cancel a subscription on our Loop Portal. This will cancel the customer in both Loop and in Stripe.

  • You can cancel a subscription in Stripe and the subscription will be canceled in Loop as well.

Regardless of method, when a subscription is canceled, just like Stripe, we will cancel all future invoices, including draft invoices, but not any invoices that are due / past due. You must cancel these invoices individually either in Stripe or Loop.

  • You can cancel these scheduled payments in Loop without code by canceling the transaction on the company dashboard or via API using the PATCH Transfer call.

  • Please note, if you cancel a draft invoice in Stripe, it will also cancel in Loop. However, canceling a draft invoice in Loop does not result in it being canceled in Stripe.

Last updated