Skip to main content

Payment Integration Deployment Guide

Ready to Deploy!​

The payment integration is complete and ready for deployment. Here's your step-by-step guide:

πŸ“‹ Deployment Checklist​

βœ… Phase 1: Deploy toto-wallet APIs​

  1. Navigate to toto-wallet functions:

    cd ../toto-wallet/functions
  2. Install dependencies:

    npm install
  3. Deploy Firebase Functions:

    firebase deploy --only functions

βœ… Phase 2: Configure Environment Variables​

  1. In Firebase Console (toto-wallet project):

    • Go to Functions > Configuration
    • Add environment variables:
      FIREBASE_PROJECT_ID=toto-wallet
      FIREBASE_REGION=us-central1
  2. In toto-bo .env.local:

    NEXT_PUBLIC_TOTO_WALLET_URL=https://us-central1-toto-wallet.cloudfunctions.net
    NEXT_PUBLIC_TOTO_WALLET_API_KEY=your-api-key-here

βœ… Phase 3: Deploy toto-bo Updates​

  1. Build and deploy toto-bo:
    cd toto-bo
    npm run build
    firebase deploy --only hosting

βœ… Phase 4: Test Payment Integration​

  1. Test toto-wallet APIs:

    curl https://us-central1-toto-wallet.cloudfunctions.net/health
  2. Test toto-bo integration:

    curl https://bo.betoto.pet/api/payments/stats

πŸ— Architecture Deployed​

User (toto-app) β†’ Payment Request β†’ toto-wallet β†’ Payment Processing β†’ Storage
↓
toto-bo ← Payment Updates ← toto-wallet ← Payment Confirmation

πŸ”— API Endpoints Available​

toto-wallet (Firebase Functions)​

  • GET /health - Health check
  • GET /payments - Get all payments
  • GET /payments/stats - Get payment statistics
  • GET /payments/:id - Get payment by ID
  • POST /payments - Create new payment
  • PUT /payments/:id/status - Update payment status
  • POST /payments/donation - Process donation

toto-bo (App Hosting)​

  • GET /api/payments - Get payments from toto-wallet
  • GET /api/payments/stats - Get payment stats from toto-wallet
  • POST /api/payments - Create payment in toto-wallet

🎯 What You Need to Do​

  1. Deploy toto-wallet functions (Firebase Functions)
  2. Configure environment variables (Firebase Console + .env.local)
  3. Deploy toto-bo updates (Firebase App Hosting)
  4. Test the payment flow (End-to-end testing)
  5. Set up monitoring (Firebase Monitoring)

πŸš€ Quick Start Commands​

# 1. Deploy toto-wallet functions
cd ../toto-wallet/functions
npm install
firebase deploy --only functions

# 2. Deploy toto-bo updates
cd ../../toto-bo
npm run build
firebase deploy --only hosting

# 3. Test integration
curl https://us-central1-toto-wallet.cloudfunctions.net/health
curl https://toto-bo-backend--toto-bo.us-central1.hosted.app/api/payments/stats

πŸŽ‰ Success Criteria​

  • βœ… toto-wallet APIs deployed and accessible
  • βœ… toto-bo can communicate with toto-wallet
  • βœ… Payment creation and retrieval working
  • βœ… Payment statistics available
  • βœ… Cross-service communication established

πŸ“ž Need Help?​

If you encounter any issues during deployment:

  1. Check Firebase Console for function logs
  2. Verify environment variables are set correctly
  3. Test individual endpoints
  4. Check network connectivity between services

Ready to deploy! πŸš€