Integrating Payment Processing
Ready to start accepting payments in your ValkyrAI app? Whether you're building an online store, a subscription service, or just need to process occasional payments, ValkyrAI makes it easy!
Payment Processing Options
ValkyrAI offers two main ways to handle payments:
- Stripe Integration (via StripeModule) - Our recommended payment solution
- Shopify Integration (via ShopifyComponent) - For connecting to an existing Shopify store
Let's explore both options in detail!
Option 1: Stripe Integration
Stripe is one of the most popular payment processors for online businesses. With ValkyrAI's StripeModule, you can integrate Stripe payments into your application.
Setting Up Stripe Integration
Step 1: Select the eCommerce Bundle
When creating your ValkyrAI project:
- Choose your base template (e.g., "Product Catalog")
- In the template configuration screen, select the "eCommerce Bundle"
- Make sure "Stripe Payments" is checked
- Complete your project setup
This adds the StripeModule to your generated application, which includes:
- Pre-configured Stripe API connections
- Payment processing components
- Order management system
- Security best practices for handling payments
Step 2: Configure Your Stripe Account
After generating your application:
- Create a Stripe account if you don't have one
- Get your API keys from the Stripe Dashboard
- In your ValkyrAI project, ask ValorIDE:
Configure Stripe with my API keys:
Public key: pk_test_your_public_key
Secret key: sk_test_your_secret_key - ValorIDE will securely store your keys and set up the connection
Step 3: Add Payment UI Components
Now you can add payment forms to your application. Ask ValorIDE:
Add a payment form to the checkout page that collects
credit card details and processes payments through Stripe.
ValorIDE will create:
- A secure payment form
- Card validation
- Error handling
- Success confirmation
What Can You Do With Stripe Integration?
With the StripeModule, your app can:
- Process one-time payments for product purchases
- Handle subscriptions with recurring billing
- Save customer payment methods for faster checkout
- Issue refunds when needed
- Track payment status in your database
- Generate receipts and invoices
- Handle international payments in multiple currencies
Behind the Scenes: How It Works
The StripeModule connects your ThorAPI-generated backend to Stripe's services:
- Your frontend collects payment details using Stripe Elements (secure forms)
- The data is tokenized (converted to a secure token) in the customer's browser
- Your backend sends the token to Stripe's API
- Stripe processes the payment and returns the result
- Your app updates order status and database records
This flow ensures payment data never touches your servers directly, keeping you compliant with security standards.
Option 2: Shopify Integration
If you already have a Shopify store or prefer to use Shopify's platform, ValkyrAI's ShopifyComponent lets you connect your custom app to Shopify.
Setting Up Shopify Integration
Step 1: Select the Shopify Component
When creating your ValkyrAI project:
- Choose your base template
- In the components selection screen, select "ShopifyComponent"
- Complete your project setup
Step 2: Connect to Your Shopify Store
After generating your application:
- Set up a Shopify store if you don't have one
- Create a private app in your Shopify admin to get API credentials
- Ask ValorIDE:
Configure Shopify integration with my store URL: your-store.myshopify.com
and API key: your_api_key - ValorIDE will set up the connection
Step 3: Use Shopify Components
Now you can build custom UI that works with your Shopify products and checkout:
Create a product page that shows my Shopify products
and adds them to my Shopify cart when purchased.
What Can You Do With Shopify Integration?
With the ShopifyComponent, your app can:
- Display products from your Shopify store
- Use Shopify's checkout for processing payments
- Sync inventory between your app and Shopify
- Access order history and customer data
- Create custom shopping experiences while using Shopify's backend
Choosing Between Stripe and Shopify
Here's a quick comparison to help you decide:
| Feature | Stripe Integration | Shopify Integration |
|---|---|---|
| Best for | Custom checkout experiences | Using existing Shopify store |
| Control | Full control over UI and flow | Limited by Shopify's capabilities |
| Complexity | More to configure | Simpler if you already use Shopify |
| Fees | Stripe transaction fees | Shopify subscription + transaction fees |
| Features | Highly customizable | Limited to Shopify's features |
Best Practices for Payment Processing
No matter which option you choose, follow these tips:
- Always test thoroughly using test API keys before going live
- Implement proper error handling for failed payments
- Send confirmation emails for successful purchases
- Keep detailed transaction records in your database
- Secure all payment-related communication with HTTPS
- Follow PCI compliance guidelines for handling payment data
- Add fraud prevention measures like address verification
Advanced Payment Features
As your business grows, you might want to add:
Multiple Payment Methods
Ask ValorIDE:
Add support for Apple Pay and Google Pay in addition to credit cards.
Subscription Management
Ask ValorIDE:
Create a subscription management page where users can view,
update, or cancel their subscription plans.
International Support
Ask ValorIDE:
Add support for multiple currencies and automatic currency conversion.
Next Steps
Once you've set up payment processing, consider:
- Implementing tax calculation
- Setting up shipping options
- Adding email notifications
Remember: Always prioritize security and compliance when handling payments!