Get Paid (Payment Links)

What is in a payment link?

A payment link is a Loop-hosted payment form that allows a customer to purchase one or many products, start a subscriptions or pay an invoice. Your customers click a button on your site and get redirected to a payment page hosted by Loop. Payment links are designed to be a customizable and reduce your development time.

To create a payment link, merchants define the Stripe products (using Stripe’s price-ids) they would like the customer to see and purchase. Payment links can be created with no-code by using the company dashboard or by calling the Checkout Sessions Endpoint.

Payment links can:

  • Take an immediate payment for an invoice, product purchase, or subscription purchase and record the customer, invoice, and subscription in Stripe
  • Take immediate payment for an existing Stripe subscription and set future invoices for that subscription to be paid by crypto
  • Collect a payment method to charge a customer in the future for an existing Stripe subscription or invoice

Payment links are completely configurable. Below we outline the various configurations a payment link can have, from free trials to acceptable tokens to pre-filled coupons and emails.

What happens when a payment link is used?

When a payment link is used:

  1. Loop creates a new customer in Stripe or find an existing customer, and tells Stripe about the purchase
  2. Stripe creates an invoice based on the billing settings associated with the products and/or subscription purchased
  3. Loop charges the customer onchain based on the Stripe bill
  4. Loop marks the invoice in Stripe as paid, adding the tx hash, wallet address and amount to the invoice's metadata and saves this data in our backend for easy querying

These steps happen within a matter of seconds, with any delays due to chain confirmation times. The customer will be held on the payment page until the payment is confirmed.


Important Notes

  1. Every checkout session will be a unique ID regardless if the details are the same
  2. By default checkout sessions expire in 1 year.
  3. Currently, the tokens that a payment link can be paid with are defined at the product level. By default all items accept USDC on the networks that are deployed for your account. If you’d like to accept additional tokens, you can add them while creating the payment link on the dashboard or via API call to the update _items_ endpoint for all the products contained in the link. A link for multiple products will accept the subset of tokens that both products accept.
  4. To apply a free trial to a subscription, you must set this as a parameter in the checkout sessions creation. This can be done with no-code or by API.

Architecture

The base URL for all Loop payment links is:

checkout.loopcrypto.xyz/<checkout-sessions-id>

Where a checkout-session-id looks like cs_01jtnkb6gafqfvhq4j37xydxdr This id is provided in the response to the Checkout Sessions enpoint and the full link is provided on the company dashboard.

For demo accounts, the environment is defined by adding demo to the link:

demo.checkout.loopcrypto.xyz/<checkout-sessions-id>

Verion 1 link archeticture

V1 of Loop payment links had the format:

checkout.loopcrypto.xyz/<entity-id>/<item-id>

These link are automatically converted to the latest version.


Creating a payment link

No-code

Loop’s dashboard makes it easy to create a payment link. You can create two types of links:

  1. General purpose link: For new customers. Reusable across multiple customers, like on your website or in marketing emails.
  2. Link for a specific customer: Tied to an existing customer in Stripe. Useful for sending personalized links or managing subscriptions.

Loop’s dashboard will guide you through creating a payment link.

For Developers

Payment links can be made by calling the Checkout Sessions endpoint. Below we go through some example links to help outline how to use the endpoint.

Take payment for a new subscription or purchase

To take a payment for a new subscription or purchase, you will need to define the element(s). An element is the Stripe products (sometimes referred to as items in Loop) the customer is purchasing. Elements are defined by using either Stripe’s price-id or Loop’s internal item-id. You can combine multiple items in one payment link.

In Stripe, price-ids can be found under Product Catalogue -> Products -> Price, in the top right corner. They started with price_

When combining multiple products with recurring payment terms, the combination of products must follow Stripe rules for a valid subscription. Thus, the products must have the same payment frequency (e.g. monthly payments). Products that take a one-time payment can be combined with any frequency.

Take a payment for a new subscription or purchase for an existing Stripe customer

To take a payment for an existing Stripe customer, pass in the externalCustomerId along with the elements.

The externalCustomerId looks like cus_SEQNcTSJ7jSktU. This id can be found by clicking on the specific customer you want to charge, under details.

<h4>To take a payment for a new subscription that you want to start on a specific date<h4>

To take a payment for a new subscription that you want to start on a specific date (e.g. Jan 1), use the billDate in conjunction with the elements.

Switch an existing Stripe customer with an existing Stripe subscription to crypto

To switch an existing Stripe customer with an existing Stripe subscription to pay in crypto, create a link using the externalSubscriptionId. There is no need to pass in any elements, invoice-id/number or customer-id - we will automatically grab the products for you based on the subscription's details.

Example sub-id: sub_1RJwTRPRR297Cb62I2FSWjgi

When switching a customer from fiat to crypto, Loop will charge the customer on the billDate for the next upcoming invoice, using the exact due date to the minute.

If you are modifying a subscription (i.e. changing the products), resetting the billing cycle, and moving the customer to crypto, you should use the payInvoiceImmediately in conjunction with the sub-id. The payInvoiceImmediately parameter will ignore the Stripe bill date and process the invoice immediately. This is important because when you reset the billing cycle, Stripe will finalize the invoice in 1 hour and by default set the bill date to midnight UTC (it will display the bill date in your account's timezone - i.e. you may see a time that is the next day or before midnight if your account is not in UTC). Thus, if you want to get paid immediately, you can override this by using the payInvoiceImmediately: true parameter.

Charging for an invoice that is not tied to a Stripe subscription

To charge for an invoice that is not tied to a Stripe subscription, you can create a Checkout Session using either the externalInvoiceId or the externalInvoiceNumber.

Example externalInvoiceId: in_1RJwTRPRR297Cb62OuQn6ogQ
Example externalInvoiceNumber: A3XRD8ZK-0004

Additional parameters

Loop provides several additional parameters:

ParameterDescription
freeTrialDaysOnly for subscriptions. If provided, the Stripe subscription will be created with this trial period.
couponCodeIf provided, the coupon will automatically be applied to the payment link. We only support certain coupon parameters defined here
emailIf provided, the customer will not be able to change this email. If a Stripe customer does not exist, it will be created with this email.
referenceIdThis will be included in all webhooks
cartEnabledEnable or disable cart on the checkout page
MetadataInfo that will be included on the Agreement Created webhook (Loop webhook) that is sent when someone uses the payment link to attach a payment method
minimumAllowanceAmountBy default loop requires payers to have enough to make the first payment made via loop. You can require an amount higher than the 1st payment using this parameter.
minimumBalanceAmountBy default loop requires the customer to have enough to cover the first payment made via loop, you can require a higher amount using this parameter.