ICRC-79 Secure Subscription Canister Standard

Introducing the ICRC-79 Secure Subscription Canister Standard and Library for Internet Computer

Hello Internet Computer developers,

We are excited to announce the release of the ICRC-79 Secure Subscription Canister Standard, along with its accompanying library! This new standard is designed to streamline subscription management and periodic payment solutions on the Internet Computer (IC).

Why ICRC-79?

Subscriptions are central to many modern digital services. The ICRC-79 standard takes the concept of recurring payments further by enabling secure, automated, and customizable subscription payments between IC canisters. This provides developers with an efficient framework to manage payment intervals, dynamic pricing, and will eventually even handle payments in multiple currencies, thanks to integration with the Exchange Rate Canister.

Here are some of the key features:

  • Flexible Payment Intervals: The ICRC-79 supports various pre-defined intervals (hourly, daily, monthly, yearly) and allows for custom intervals (such as every 17 days). This flexibility means developers can tailor subscriptions to fit different business models.

  • Dynamic Exchange Rate Integration: (Not Yet Implemented) - With the global economy relying on multiple currencies, ICRC-79 incorporates real-time exchange rates from the XRC, allowing services to convert between cryptocurrencies and fiat currencies. This ensures subscribers pay the correct amount, even if market prices fluctuate.

  • Enhanced Error Handling and Notifications: Subscription management can be tricky, but ICRC-79 includes detailed error reporting for things like insufficient balances, missing exchange rates, and network issues. The standard also includes built-in notifications(Not Yet Implemented in the Library) to inform service providers when issues arise, like subscription cancellations or payment failures.

  • Secure Subscription Management: Subscriptions can be paused, resumed, or canceled programmatically, and all transaction states are securely logged in the subscription ledger, ensuring transparency and auditability. Developers have full control over the lifecycle of a subscription, allowing for a tailored user experience.

Example Use Cases

ICRC-79 is perfect for a variety of applications, including:

  • Software-as-a-Service (SaaS): Automate your subscription billing for services that are charged on a regular basis.
  • Media Platforms: Charge for recurring content access, like streaming or magazine subscriptions.
  • Gaming: Set up in-game item rental systems or memberships that renew periodically.

How it Works

The standard defines the core data types required to manage subscriptions, including intervals, payment amounts, exchange rates, and more. The subscription canister can handle complex billing setups, including immediate payments, delayed payments, and recurring transactions. It supports any ICRC-2 or (Not Yet Implemented) ICRC-80 token.

For example, you can set up a subscription to charge a user 50 tokens every 2 weeks for a premium service:

let subscriptionRequest = [[
    #tokenCanister(Principal.fromText("ryjl3-tyaaa-aaaaa-aaaba-cai")), //ICP
    #serviceCanister(Principal.fromText("{your dapp}")),
    #interval(#Weeks(2)), 
    #amountPerInterval(50_0000_0000); //50 ICP
    #productId(123);
    ]]
};

let subResult = await icrc79_subscribe(subscriptionRequest);

Why This Matters

The ICRC-79 standard is more than just a billing tool—it empowers developers to create sophisticated subscription models with minimal friction. By leveraging blockchain’s transparency and the Internet Computer’s decentralized infrastructure, you can ensure secure, tamper-proof financial operations for your users.

We believe this will open up new possibilities for subscription-based services on the IC. The standard is still in draft, and we invite the developer community to provide feedback, suggest improvements, and explore its potential.

For more details, check out the draft here: ICRC-79 Draft

Adding to your motoko project

mops add icrc79-mo

Code

https://github.com/PanIndustrial-Org/icrc79.mo

Happy coding, and we look forward to seeing what you build with ICRC-79!

2 Likes