Skip to main content
Gasless transactions are only available in Starknet Mainnet.
1

Configure your Authentication

You’ll need to add the JWKS Endpoint from your auth provider to authenticate gasless transactions.
With this JWKS Endpoint setup, you can now run secure code in your frontend using a rotating JWT token.

Getting your JWKS Endpoint

For these common auth providers, you can get your JWKS Endpoint like this:
  1. Go to your API Keys
  2. Copy your JWKS Endpoint and paste it into the JWKS Endpoint field in your Chipi Dashboard.
  3. Follow our documentation to add Clerk and Chipi to your application.
2

Get your Public Key

Now go to your API Keys and click on your project.Which will give you access to your Public Key (pk_prod_xxxx). Keep this handy as you’ll need it to initialize the SDK.
You won’t need the Secret Key (sk_prod_xxxx) for now.
3

Install the SDK

npm install @chipi-stack/chipi-expo@latest
4

Initialize the SDK

  1. Add your Public Key to your environment variables.
EXPO_PUBLIC_CHIPI_API_PUBLIC_KEY=pk_prod_xxxx
CHIPI_SECRET_KEY=secret_xxx
  1. Wrap your main _layout.tsx with the ChipiProvider component.
// app/_layout.tsx

import { ChipiProvider } from "@chipi-stack/chipi-expo";

const API_PUBLIC_KEY = process.env.EXPO_PUBLIC_CHIPI_API_PUBLIC_KEY;
if (!API_PUBLIC_KEY) throw new Error("API_PUBLIC_KEY is not set");


export default function RootLayout() {
  // ...
  return (
    <ChipiProvider
      config={{
        apiPublicKey: API_PUBLIC_KEY,
      }}
    >
      <Stack />
    </ChipiProvider>
  );
}

5

Start Using the SDK

You’re ready to use the SDK! We recommend starting with our convenience hooks that simplify common operations:

useChipiWallet - Unified Wallet Management

import { useChipiWallet } from "@chipi-stack/chipi-expo";
import { View, Text, TouchableOpacity } from "react-native";

function WalletComponent() {
  const { userId, getToken } = useYourAuthProvider();
  
  const {
    wallet,
    hasWallet,
    formattedBalance,
    createWallet,
    isLoadingWallet,
  } = useChipiWallet({
    externalUserId: userId,
    getBearerToken: getToken,
  });

  if (!hasWallet) {
    return (
      <TouchableOpacity onPress={() => createWallet({ encryptKey: "1234", chain: "STARKNET" })}>
        <Text>Create Wallet</Text>
      </TouchableOpacity>
    );
  }

  return <Text>Balance: ${formattedBalance} USDC</Text>;
}

useChipiWallet Documentation

Learn about all the options and return values

useChipiSession - Gasless Session Keys (CHIPI wallets only)

import { useChipiWallet, useChipiSession } from "@chipi-stack/chipi-expo";

function GaslessTransactions() {
  const { wallet } = useChipiWallet({ ... });
  
  const {
    hasActiveSession,
    createSession,
    registerSession,
    executeWithSession,
  } = useChipiSession({
    wallet,
    encryptKey: pin,
    getBearerToken: getToken,
  });

  // Setup session once
  const handleSetup = async () => {
    await createSession();
    await registerSession();
  };

  // Execute transactions without owner signature
  const handleTransfer = async () => {
    await executeWithSession([{
      contractAddress: USDC_CONTRACT,
      entrypoint: "transfer",
      calldata: [recipient, amount, "0x0"],
    }]);
  };
}

useChipiSession Documentation

Learn about session key management
6

Next Steps

That’s it! You should now have an initial working version of Chipi Pay integrated into your application. Explore more features:Need help? Join our Telegram Community to ask us anything on your mind.