Thanks to visit codestin.com
Credit goes to github.com

Skip to content

osazeejedi/cryptoPayment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Setup for Crypto Payment API

This directory contains scripts to set up the necessary database tables for the Crypto Payment API.

Tables to Create

  1. virtual_accounts - Stores information about virtual accounts created for users
  2. pending_crypto_transfers - Tracks pending crypto transfers associated with virtual accounts

Setup Instructions

Prerequisites

  • Node.js installed
  • .env file with Supabase credentials (SUPABASE_URL and SUPABASE_SERVICE_KEY)

Option 1: Using the Supabase JavaScript Client

# Install dependencies if needed
npm install @supabase/supabase-js dotenv

# Run the script
node create_tables.js

Option 2: Using the Supabase REST API

# Install dependencies if needed
npm install axios dotenv

# Run the script
node create_tables_direct.js

Option 3: Using the Supabase SQL API

# Install dependencies if needed
npm install axios dotenv

# Run the script
node create_tables_sql.js

Table Schemas

virtual_accounts

CREATE TABLE public.virtual_accounts (
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id UUID NOT NULL REFERENCES public.users(id),
    reference VARCHAR NOT NULL,
    account_reference VARCHAR NOT NULL,
    status VARCHAR NOT NULL,
    account_details JSONB NOT NULL,
    is_permanent BOOLEAN DEFAULT false,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ,
    expires_at TIMESTAMPTZ,
    transaction_reference VARCHAR,
    paid_at TIMESTAMPTZ
);

pending_crypto_transfers

CREATE TABLE public.pending_crypto_transfers (
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    user_id UUID NOT NULL REFERENCES public.users(id),
    crypto_type VARCHAR NOT NULL,
    wallet_address VARCHAR,
    account_number VARCHAR NOT NULL,
    status VARCHAR NOT NULL DEFAULT 'pending',
    created_at TIMESTAMPTZ DEFAULT NOW(),
    completed_at TIMESTAMPTZ,
    transaction_id UUID,
    error_message TEXT
);

Troubleshooting

If you encounter errors when running the scripts:

  1. Make sure your Supabase URL and service key are correct in the .env file
  2. Check that you have the necessary permissions to create tables in the database
  3. Try running the SQL statements directly in the Supabase SQL editor
  4. If using the REST API, ensure your Supabase instance has the SQL API enabled

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •