← All Payment Providers
Overview
Basis Theory Elements provides a secure method for tokenizing credit card information on the frontend. Card data is tokenized directly with Basis Theory — sensitive card details never touch your servers. This reduces your PCI scope by avoiding sensitive data transmission through your servers. When you pass a Basis Theory token to Rye, the payment is forwarded directly to the merchant’s payment vault. For Shopify merchants, the card is forwarded directly to Shopify’s payment vault, so Rye does not act as the merchant of record, eliminating duplicate transaction fees. For non-Shopify merchants, Rye is the merchant of record.Use Rye’s Basis Theory Key to Generate Card Tokens
To generate a Basis Theory card token for confirming a Rye checkout intent, you must use Rye’s Basis Theory public key, not your own Basis Theory key. This ensures the token is created under Rye’s account. Using your own key will cause the checkout intent to fail.Generate a Token Using Demo App
You can use the demo app to generate a Basis Theory token for testing:- Production: mcp.rye.com/bt-card-capture
- Staging: staging.mcp.rye.com/bt-card-capture
4242 4242 4242 4242 with any future expiration date and any 3-digit CVC.
Alternatively, you can use the steps below to create a simple React app to generate the token.
Generate a Token Using React App
This guide walks through the Basis Theory React Elements approach, including a React demo app. For a complete example, see rye-com/basis-theory-cc-capture-ui.Create a New React App
Install Basis Theory Dependencies
React Example Code
- Replace the code in src/App.jsx with the code below.
- For testing in Rye staging: use the key
key_test_us_pub_Gtquo4kCeDkj2hTFWJSYCX(line 8). - For testing in Rye production: use the key
key_prod_us_pub_F4RCCEspEdE5hdtQnFfAFx(line 11).
Run the App Locally
The app will run locally at http://localhost:5173. Open that page in your browser to enter card details and generate a Basis Theory token. The token will be returned in the formatxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
For testing in the Rye staging environment, use the test card number 4242 4242 4242 4242 with any future expiration date and any 3-digit CVC.
Generate a Token Using Other Basis Theory SDKs
In addition to React, Basis Theory provides SDKs for other platforms, including vanilla JavaScript, iOS, and Android. The flow is similar across SDKs: initialize Basis Theory with Rye’s public key, present the card entry UI, and Basis Theory will return a token that you can pass to Rye.Use the Token with Rye
Once you have a Basis Theory token, you can use it to complete a purchase through the Rye API. There are two flows available: a single-step purchase and a two-step flow.Single-Step Purchase
Submit a complete purchase in one call by providing the product, buyer details, and payment method together:Two-Step Flow
If you have already created a checkout intent, you can submit payment separately using the intent ID:Notes
- Basis Theory tokens can be reused, but the CVC may need to be refreshed for subsequent orders.
- Sensitive card data is handled entirely by Basis Theory and never touches your servers, reducing your PCI scope.

