Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Payment support based on Stripe, supporting credit cards and debit cards
.claude/skills/aiskillstore-extension-stripe/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-17 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 45% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -2% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -2% | 0% |
Stripe payment extension for Caffeine AI.
This skill adds Stripe payment support using HTTP outcalls. The backend manages Stripe configuration, creates checkout sessions, and checks payment status. The frontend handles checkout flow and payment result pages.
For Stripe payment integration:
Prerequisite: You must follow extension-authorization first, as this integration depends on it.
There is the prefabricated module mo:caffeineai-stripe/stripe.mo that that cannot be modified. It provides fundamental functionality for making HTTP GET or PUT requests in the backend.
mo:caffeineai-stripe/stripe.moimport OutCall "mo:caffeineai-http-outcalls/outcall"; module { public type StripeConfiguration = { secretKey : Text; allowedCountries : [Text]; }; public type ShoppingItem = { currency : Text; productName : Text; productDescription : Text; priceInCents : Nat; quantity : Nat; }; /// Initiate payment session for shopping items. /// Returns Stripe JSON reply message. 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 }; }; /// Check payment status. public func getSessionStatus(configuration : StripeConfiguration, sessionId : Text, transform : OutCall.Transform) : async StripeSessionStatus; };
Usage:
motoko filepath=src/backend/main.moimport Stripe "mo:caffeineai-stripe/stripe"; import AccessControl "mo:caffeineai-authorization/access-control"; import MixinAuthorization "mo:caffeineai-authorization/MixinAuthorization"; import OutCall "mo:caffeineai-http-outcalls/outcall"; 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.initState(); include MixinAuthorization(accessControlState, null); // Shopping data public type Product = { id : Text; // add custom fields }; let products = Map.empty<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); }; // Stripe integration var configuration : ?Stripe.StripeConfiguration = null; public query func isStripeConfigured() : async Bool { configuration != null; }; public shared ({ caller }) func setStripeConfiguration(config : Stripe.StripeConfiguration) : async () { if (not (AccessControl.hasPermission(accessControlState, caller, #admin))) { Runtime.trap("Unauthorized: Only admins can perform this action"); }; configuration := ?config; }; func getStripeConfiguration() : Stripe.StripeConfiguration { switch (configuration) { case (null) { Runtime.trap("Stripe needs to be first configured") }; case (?value) { value }; }; }; public func getStripeSessionStatus(sessionId : Text) : async Stripe.StripeSessionStatus { await Stripe.getSessionStatus(getStripeConfiguration(), sessionId, transform); }; public shared ({ caller }) func createCheckoutSession(items : [Stripe.ShoppingItem], successUrl : Text, cancelUrl : Text) : async Text { await Stripe.createCheckoutSession(getStripeConfiguration(), caller, items, successUrl, cancelUrl, transform); }; public query func transform(input : OutCall.TransformationInput) : async OutCall.TransformationOutput { OutCall.transform(input); }; // Add more data and functions as needed };
For Stripe payment integration:
Usage:
isStripeConfigured() and setStripeConfiguration()StripeConfiguration.createCheckoutSession result is needed.url. If missing, throw an error and do not redirect. import { useMutation } from '@tanstack/react-query'; import { useActor } from '@caffeineai/core-infrastructure'; import { ShoppingItem } from '../backend';
export type CheckoutSession = { id: string; url: string; };
export function useCreateCheckoutSession() { const { actor } = useActor();
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; } }); }
useCreateCheckoutSession()ShoppingItem[] as input.CheckoutSession result.CheckoutSession: This allows the user to complete the payment.window.location.href./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;
You need to use @tanstack router.
Side note: Make sure that product images are properly rendered and resized inside the product canvas.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-17 | fail→pass | 11,765 | 7,416 | -37% | 1 | 1 | 0% | 2,018 | 2,285 | +13% | 0 | 0 | — |
case-01 | fail→pass | 26,435 | 31,352 | +19% | 1 | 1 | 0% | 4,361 | 6,322 | +45% | 0 | 0 | — |
case-02 | fail→pass | 28,314 | 28,495 | +1% | 1 | 1 | 0% | 4,539 | 7,276 | +60% | 0 | 0 | — |
case-03 | fail→pass | 27,935 | 17,512 | -37% | 1 | 1 | 0% | 4,839 | 4,749 | -2% | 0 | 0 | — |
case-04 | pass→pass | 17,745 | 17,494 | -1% | 1 | 1 | 0% | 2,421 | 4,196 | +73% | 0 | 0 | — |
case-05 | fail→fail | 22,607 | 20,996 | -7% | 1 | 1 | 0% | 3,231 | 4,822 | +49% | 0 | 0 | — |
case-06 | pass→pass | 18,322 | 27,210 | +49% | 1 | 1 | 0% | 3,709 | 4,905 | +32% | 0 | 0 | — |
case-07 | fail→pass | 24,556 | 13,578 | -45% | 1 | 1 | 0% | 3,604 | 3,534 | -2% | 0 | 0 | — |
case-08 | fail→pass | 14,913 | 11,271 | -24% | 1 | 1 | 0% | 1,672 | 3,033 | +81% | 0 | 0 | — |
case-09 | fail→pass | 21,081 | 8,646 | -59% | 1 | 1 | 0% | 1,472 | 2,446 | +66% | 0 | 0 | — |
case-10 | fail→pass | 14,992 | 3,202 | -79% | 1 | 1 | 0% | 2,312 | 2,369 | +2% | 0 | 0 | — |
case-11 | fail→pass | 20,717 | 5,223 | -75% | 1 | 1 | 0% | 2,279 | 2,563 | +12% | 0 | 0 | — |
case-12 | fail→pass | 16,869 | 9,992 | -41% | 1 | 1 | 0% | 2,175 | 2,819 | +30% | 0 | 0 | — |
case-13 | pass→pass | 11,280 | 10,919 | -3% | 1 | 1 | 0% | 2,458 | 3,070 | +25% | 0 | 0 | — |
case-14 | fail→pass | 18,673 | 9,566 | -49% | 1 | 1 | 0% | 2,301 | 2,733 | +19% | 0 | 0 | — |
case-15 | pass→pass | 10,941 | 9,433 | -14% | 1 | 1 | 0% | 1,826 | 2,669 | +46% | 0 | 0 | — |
case-16 | pass→pass | 11,092 | 4,978 | -55% | 1 | 1 | 0% | 1,895 | 2,800 | +48% | 0 | 0 | — |
case-18 | fail→pass | 10,558 | 8,094 | -23% | 1 | 1 | 0% | 1,596 | 2,411 | +51% | 0 | 0 | — |
case-19 | pass→pass | 20,052 | 10,755 | -46% | 1 | 1 | 0% | 2,389 | 4,033 | +69% | 0 | 0 | — |
case-20 | pass→pass | 15,936 | 17,384 | +9% | 1 | 1 | 0% | 2,372 | 4,295 | +81% | 0 | 0 | — |
case-21 | fail→pass | 24,479 | 11,521 | -53% | 1 | 1 | 0% | 3,433 | 3,040 | -11% | 0 | 0 | — |
case-22 | pass→pass | 13,557 | 3,688 | -73% | 1 | 1 | 0% | 2,487 | 2,629 | +6% | 0 | 0 | — |
case-23 | fail→pass | 16,534 | 7,412 | -55% | 1 | 1 | 0% | 1,975 | 2,303 | +17% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +61 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.