Skip to content

Instantly share code, notes, and snippets.

@exonomyapp
Created January 10, 2025 20:22
Show Gist options
  • Save exonomyapp/aaf9d2e0e9bd71731c5d635ebbbdd79a to your computer and use it in GitHub Desktop.
Save exonomyapp/aaf9d2e0e9bd71731c5d635ebbbdd79a to your computer and use it in GitHub Desktop.
Functional Specification For Voucher - Stripe Integration

Functional Specification for Exonomy Voucher Payment and Redemption Feature

Overview

This feature enables Exonomists to use vouchers for payments, handle optional cash redemptions, and persist transaction and voucher data using IPFS/OrbitDB for replication and offline functionality. The app will integrate with Stripe for payments, webhook handling, and custom receipts, while leveraging Nuxt3, TypeScript, Ionic for UI, and Capacitor for cross-platform deployment.


Feature Details

Voucher Management

  1. Voucher Metadata

    • Unique Identifier: UUID for each voucher.
    • Value: Monetary value of the voucher in the specified currency.
    • Expiration Date: Expiry timestamp.
    • Redeemable: Boolean to indicate if the voucher is available for cash redemption.
    • Owner History: Array of transaction hashes, showing the chain of ownership.
  2. Voucher Generation

    • Vouchers are generated in the app by the issuing Exonomist and stored in OrbitDB.
    • Persisted vouchers will include metadata and be synchronized across the network for availability to relevant Exonomists.

Real-Time Notifications

  • Email Notifications: Send through a transactional email service (e.g., SendGrid or AWS SES).
  • App Notifications: Implement using Capacitor Push Notifications plugin for mobile platforms.

Offline Functionality

  • Enable offline access to vouchers and transactions by replicating data via OrbitDB.
  • Any updates made offline (e.g., new vouchers or redeemed vouchers) will be synchronized when the app reconnects to the internet.

Stripe Integration

  1. Stripe Features

    • Account Linking: Enable Exonomists to link their Stripe accounts via OAuth flow.
    • Payments: Process voucher-based transactions and initiate cash redemption payments.
    • Webhook Handling: Use Stripe webhooks to monitor transaction statuses.
    • Custom Receipts: Generate custom receipts for all transactions and store them in OrbitDB.
  2. Stripe API Workflow

    • Voucher payment uses the PaymentIntent API.
    • Cash redemption initiates a Transfer API call with the redeemer as the recipient.
    • Webhook events (e.g., payment success, transfer completed) update voucher statuses in the app.

UI Requirements

  • Basic voucher and transaction management screens using Ionic components.
  • Multilingual support for localization (e.g., i18n plugin in Nuxt3).

Platform-Specific Features

  • Camera Access: Use Capacitor Camera or Barcode Scanner plugin for scanning QR codes to redeem vouchers.
  • No other customizations specific to Android or iOS are currently required.

Development Details

Technology Stack

  1. Frontend: Nuxt3, TypeScript, and Ionic components.
  2. Data Persistence: IPFS/OrbitDB for decentralized, replicable storage.
  3. Backend: Stripe APIs for payment and webhook handling.
  4. Mobile Features: Capacitor for cross-platform compatibility and access to native device capabilities.

Endpoints and Functions

  1. Voucher Functions

    • createVoucher(metadata: object): Promise<string>: Generate a new voucher with metadata.
    • redeemVoucher(voucherId: string): Promise<void>: Trigger redemption process for a specific voucher.
    • getVoucherById(voucherId: string): Promise<Voucher>: Retrieve voucher details.
  2. Stripe Functions

    • linkStripeAccount(): Promise<void>: Initiate OAuth flow for Stripe account linking.
    • processVoucherPayment(voucherId: string): Promise<void>: Deduct the voucher’s value and complete the payment.
    • initiateCashRedemption(voucherId: string): Promise<void>: Transfer funds for cash redemption.
  3. Notification Functions

    • sendEmailNotification(event: string, data: object): Promise<void>: Send real-time email updates.
    • pushAppNotification(event: string, data: object): Promise<void>: Trigger app notifications.

Dependencies

  1. Nuxt3 Plugins: i18n for localization.
  2. Stripe SDK: For all payment and webhook integrations.
  3. OrbitDB: For decentralized data storage and synchronization.
  4. Capacitor Plugins: Push Notifications, Camera, and QR Scanner.

Next Steps

The development team should:

  1. Set up the base Nuxt3 application with Capacitor integration for Android and iOS.
  2. Implement Stripe OAuth and payment workflows.
  3. Create OrbitDB schemas for voucher and transaction data.
  4. Build UI components for voucher management and redemption.
  5. Configure localization and implement multilingual support.
  6. Add QR code scanning functionality for voucher redemption.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment