---
title: Extension Stripe Skill for Claude Code
canonical: https://skillselion.com/skills/caffeinelabs/skills/extension-stripe
content_type: text/markdown
description: extension-stripe is a Caffeine AI Build skill that adds Stripe card checkout via Motoko createCheckoutSession and getSessionStatus over HTTP outcalls.
---

# Extension Stripe Skill

Title: Extension Stripe Skill for Claude Code

> extension-stripe is a Caffeine AI Build skill that adds Stripe card checkout via Motoko createCheckoutSession and getSessionStatus over HTTP outcalls.

Canonical: https://skillselion.com/skills/caffeinelabs/skills/extension-stripe

extension-stripe is a Caffeine AI Build skill that adds Stripe card checkout via Motoko createCheckoutSession and getSessionStatus over HTTP outcalls.

This Caffeine AI extension skill adds Stripe payment support for credit and debit card checkout on Internet Computer applications built with caffeine.ai. It uses HTTP outcalls through the prefabricated caffeineai-stripe/stripe.mo module, which exposes createCheckoutSession and getSessionStatus against admin-configured secretKey and allowedCountries. The skill requires extension-authorization first and depends on caffeineai-http-outcalls and caffeineai-authorization MOPs; no Caffeine subscription tier is required. Backend actor code shows admin-gated setStripeConfiguration, product CRUD, session creation with ShoppingItem line items, and payment status polling. Frontend guidance covers a PaymentSetup admin panel when Stripe is not configured, a TanStack Query checkout hook that JSON-parses the session URL, Payment redirect via window.location.href, and /payment-success plus /payment-failure routes. Docs stress validating a non-empty session.url before redirect and avoiding router navigation to Stripe hosted checkout. Use when wiring card payments, shopping carts, or paid product flows into Caffeine AI backends without custom Stripe HTTP plumbing.

## Key facts

- Installs: 31,980
- GitHub stars: 2
- Author: caffeinelabs
- Repository: caffeinelabs/skills
- Works in Grok Bot: yes
- Install command: `npx skills add https://github.com/caffeinelabs/skills --skill extension-stripe`
- Last updated: November 16, 2026

## What Extension Stripe does

Caffeine AI extension for Stripe checkout sessions, payment status checks, and card payments via Motoko HTTP outcalls.

How do Caffeine AI apps accept credit and debit card payments without hand-rolling Stripe HTTP outcall and checkout session logic?

Admin-configured Stripe checkout sessions, hosted payment redirect, and session status polling wired through prefabricated stripe.mo and frontend result pages.

Best for: Caffeine AI projects needing admin-gated Stripe configuration, shopping cart checkout, and payment success or failure handling on Internet Computer backends.

Not for: Non-Caffeine stacks, crypto-native payments without Stripe, or checkout flows that skip extension-authorization prerequisites.

- Prefabricated stripe.mo creates checkout sessions and polls payment status via HTTP outcalls
- Admin configures Stripe secret key and allowed countries before checkout goes live
- Backend pairs createCheckoutSession with extension-authorization admin gates
- Frontend checkout hook parses session JSON and redirects with window.location.href
- Payment success and failure routes map to dedicated result page components

## SKILL.md

## Stripe Payment Integration
Stripe payment extension for [Caffeine AI](https://caffeine.ai?utm_source=caffeine-skill&utm_medium=referral).

### Overview

This skill adds Stripe payment support using HTTP outcalls. The `MixinStripe` mixin provides configuration, checkout session creation, payment status checks, and the HTTP outcall `transform` callback. The frontend handles checkout flow and payment result pages.

Inbound Stripe webhooks (an external `POST` to the canister) are not covered here  -  use [`extension-http-endpoints`](../extension-http-endpoints/SKILL.md) for the `http_request` / `http_request_update` handlers, then verify Stripe signatures in the update path.

Prerequisite: You must follow [extension-authorization](../extension-authorization/SKILL.md) first, as this integration depends on it.

## Backend

### Module API

The prefabricated module `mo:caffeineai-stripe/stripe.mo` provides low-level Stripe HTTP helpers. Do not modify it.

```mo:caffeineai-stripe/stripe.mo
import OutCall "mo:caffeineai-http-outcalls/outcall";

module {
  public type StripeConfiguration = {
    secretKey : Text;
    allowedCountries : [Text];
  };

  public type StripeState = {
    var configuration : ?StripeConfiguration;
  };

  public func initState() : StripeState;

  public type ShoppingItem = {
    currency : Text;
    productName : Text;
    productDescription : Text;
    priceInCents : Nat;
    quantity : Nat;
  };

  public func createCheckoutSession(configuration : StripeConfiguration, caller : Principal, items : [ShoppingItem], successUrl : Text, cancelUrl : Text, transform : OutCall.Transform) : async Text;

  public type StripeSessionStatus = {
    #failed : { error : Text };
    #completed : { response : Text; userPrincipal : ?Text };
  };

  public func getSessionStatus(configuration : StripeConfiguration, sessionId : Text, transform : OutCall.Transform) : async StripeSessionStatus;
};
```

### Setup in main.mo

`include MixinStripe(accessControlState, stripeState)` MUST be placed in `main.mo`, not in a custom mixin file. The mixin provides these public endpoints automatically:

- `isStripeConfigured()`
- `setStripeConfiguration(config)`
- `createCheckoutSession(items, successUrl, cancelUrl)`
- `getStripeSessionStatus(sessionId)`
- `transform(input)`  -  required for HTTP outcall response transformation

Do NOT redeclare any of these functions. They are provided exclusively by `MixinStripe`.

```motoko filepath=src/backend/main.mo
import Stripe "mo:caffeineai-stripe/stripe";
import AccessControl "mo:caffeineai-authorization/access-control";
import MixinAuthorization "mo:caffeineai-authorization/MixinAuthorization";
import MixinStripe "mo:caffeineai-stripe/MixinStripe";
import Map "mo:core/Map";
import Iter "mo:core/Iter";
import Text "mo:core/Text";
import Runtime "mo:core/Runtime";

actor {
  // Include authorization
  let accessControlState : AccessControl.AccessControlState;
  include MixinAuthorization(accessControlState, null);
  let stripeState : Stripe.StripeState;
  include MixinStripe(accessControlState, stripeState);

  public type Product = {
    id : Text;
    // add custom fields
  };

  let products : Map.Map<Text, Product>;

  public query func getProducts() : async [Product] {
    products.values().toArray();
  };

  public shared ({ caller }) func addProduct(product : Product) : async () {
    if (not (AccessControl.hasPermission(accessControlState, caller, #admin))) {
      Runtime.trap("Unauthorized: Only admins can add products");
    };
    products.add(product.id, product);
  };

  public shared ({ caller }) func updateProduct(product : Product) : async () {
    if (not (AccessControl.hasPermission(accessControlState, caller, #admin))) {
      Runtime.trap("Unauthorized: Only admins can update products");
    };
    products.add(product.id, product);
  };

  public shared ({ caller }) func deleteProduct(productId : Text) : async () {
    if (not (AccessControl.hasPermission(accessControlState, caller, #admin))) {
      Runtime.trap("Unauthorized: Only admins can delete products");
    };
    products.remove(productId);
  };

  // Add more data and functions as needed
};
```

The migration chain head:

```motoko filepath=src/backend/migrations/00000000_000000.mo
import Map "mo:core/Map";
import AccessControl "mo:caffeineai-authorization/access-control";

module {
  type Product = {
    id : Text;
  };

  type StripeConfiguration = {
    secretKey : Text;
    allowedCountries : [Text];
  };

  type StripeState = {
    var configuration : ?StripeConfiguration;
  };

  type NewActor = {
    accessControlState : AccessControl.AccessControlState;
    products : Map.Map<Text, Product>;
    stripeState : StripeState;
  };

  public func migration(_old : {}) : NewActor {
    {
      accessControlState = AccessControl.initState();
      products = Map.empty<Text, Product>();
      stripeState = { var configuration = null };
    };
  };
};
```

### Upgrading from the previous version

An app built with `caffeineai-stripe` 1.0.0 re-pins with `mops add caffeineai-stripe@1.0.1` and `mops add caffeineai-http-outcalls@0.1.5` before it moves to `ic` 5.0.0, where 1.0.0 fails to compile. Nothing in the app code changes.

## Frontend

For Stripe payment integration:

Usage:

1. Implement a PaymentSetup component with:
    * Use `isStripeConfigured()` and `setStripeConfiguration()`
    * Checks whether Stripe payment is configured.
    * If not, opens an admin panel and asks the user to initialze Stripe with `StripeConfiguration`.
      - Stripe secret key
      - List of allowed countries, notation ["US", "CA", "GB"] etc., see the Stripe documentation.
    * Do not show the payment setup when it has already been configured!

2. Implement a checkout hook:
    * Note that JSON parsing of backend `createCheckoutSession` result is needed.
    * Validate that the parsed session includes a non-empty `url`. If missing, throw an error and do not redirect.
    
    ```
    import { useMutation } from '@tanstack/react-query';
    import { useActor } from '@caffeineai/core-infrastructure';
    import { createActor, type ShoppingItem } from '@/backend';

    export type CheckoutSession = {
        id: string;
        url: string;
    };

    export function useCreateCheckoutSession() {
        const { actor } = useActor(createActor);

        return useMutation({
            mutationFn: async (items: ShoppingItem[]): Promise<CheckoutSession> => {
                if (!actor) throw new Error('Actor not available');
                const baseUrl = `${window.location.protocol}//${window.location.host}`;
                const successUrl = `${baseUrl}/payment-success`;
                const cancelUrl = `${baseUrl}/payment-failure`;
                const result = await actor.createCheckoutSession(items, successUrl, cancelUrl);
                // JSON parsing is important!
                const session = JSON.parse(result) as CheckoutSession;
                if (!session?.url) {
                    throw new Error('Stripe session missing url');
                }
                return session;
            }
        });
    }
    ```

3. Implement a Payment component with:
    * `useCreateCheckoutSession()`
    * Pass `ShoppingItem[]` as input.
    * Anaylze the `CheckoutSession` result.
    * Redirect webpage to url in `CheckoutSession`: This allows the user to complete the payment.
    * Do NOT use router navigation for the Stripe URL. Use `window.location.href`.
    * Never navigate to `/undefined`; if `session.url` is missing, show an error and stop.

    ```
    const session = await createCheckoutSession.mutateAsync(shoppingItems);
    if (!session?.url) throw new Error('Stripe session missing url');
    window.location.href = session.url;
    ```

4. Implement a PaymentSuccess and PaymentFailure component to handle payment success or failure, respectively.

5. Route two specific paths to the payment status components:
   * Path "/payment-success" to PaymentSuccess.
   * Path "/payment-failure" to PaymentFailure.
   You need to use @tanstack router.

6. The admin view offers a menu to configure Stripe. If not yet configured, it asks the admin to configure Stripe on login.

Side note: Make sure that product images are properly rendered and resized inside the product canvas.

## Extension Stripe FAQ

### Which extension must be implemented before extension-stripe?

Docs require extension-authorization first because the Stripe integration depends on its access control patterns.

### How should the frontend send users to Stripe checkout?

Parse createCheckoutSession JSON, confirm session.url is non-empty, then set window.location.href. Do not use router navigation.

### What does the admin configure before payments work?

Admins set StripeConfiguration with secretKey and allowedCountries such as US, CA, or GB through setStripeConfiguration.

### Is Extension Stripe safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

## Machine access

- [Sitemap](https://skillselion.com/sitemap.xml)
- [llms.txt](https://skillselion.com/llms.txt)
- [llms-full.txt](https://skillselion.com/llms-full.txt)
- [Developer resources](https://skillselion.com/developers)
- [OpenAPI spec](https://skillselion.com/openapi.json)
- [MCP handshake](https://skillselion.com/.well-known/mcp)
- [API catalog](https://skillselion.com/.well-known/api-catalog)
- [AI catalog](https://skillselion.com/.well-known/ai-catalog.json)
- [Pricing](https://skillselion.com/pricing.md)
- [Auth](https://skillselion.com/auth.md)
- [AGENTS.md](https://skillselion.com/AGENTS.md)
- [Contact](https://skillselion.com/contact)
- [Home](https://skillselion.com/)
