Skip to content

JohnFingWick/bitrefill-extension

Repository files navigation

Bitrefill Crypto Checkout Chrome Extension

A Chrome extension that enhances online shopping by detecting supported merchants and offering seamless crypto payments via Bitrefill gift cards.

Features

  • Automatic Merchant Detection: Detects when you're browsing a supported merchant website
  • Location-Based Product Filtering: Automatically detects your country from the domain TLD
  • Real-Time Gift Card Delivery: Instantly receive gift card codes after payment
  • Multiple Cryptocurrency Support: Pay with Bitcoin, Lightning, Ethereum, and more
  • Seamless Integration: Floating checkout button that appears on supported sites
  • Modern UI: Beautiful, responsive interface with smooth animations

Installation

Prerequisites

  1. Bitrefill API Token: Get your API token from Bitrefill Developers
  2. Chrome Browser: Version 88 or higher (Manifest V3 support)

Setup Instructions

  1. Clone or Download this repository to your local machine

  2. Load Extension in Chrome:

    • Open Chrome and go to chrome://extensions/
    • Enable "Developer mode" in the top right
    • Click "Load unpacked" and select the extension folder
  3. Configure API Token:

    • Click the extension icon in your browser toolbar
    • Enter your Bitrefill API token in the setup section
    • Click "Save Token" and test the connection
  4. Start Shopping:

    • Visit any supported merchant website (e.g., amazon.com, adidas.com)
    • Look for the floating "Pay with Crypto" button
    • Click to browse available gift cards and complete your purchase

Supported Merchants

The extension automatically detects and supports merchants that have gift cards available on Bitrefill, including:

  • Retail: Amazon, Walmart, Target, Best Buy
  • Fashion: Adidas, Nike, H&M, Zara
  • Food & Dining: Starbucks, McDonald's, Subway
  • Entertainment: Netflix, Spotify, iTunes
  • Gaming: Steam, PlayStation, Xbox
  • And many more...

How It Works

1. Merchant Detection

  • Extracts domain name from current website URL
  • Searches Bitrefill API for available gift cards
  • Injects checkout button if supported

2. Location Detection

  • Analyzes top-level domain (TLD) for country code
  • Filters products by country for better relevance
  • Supports major countries: US, UK, SG, CA, AU, DE, FR, etc.

3. Payment Flow

  • Step 1: Select gift card product
  • Step 2: Choose denomination and payment method
  • Step 3: Pay with cryptocurrency
  • Step 4: Receive gift card instantly

4. Gift Card Delivery

  • Real-time delivery of gift card codes
  • Copy-to-clipboard functionality
  • Direct merchant website integration
  • Email backup delivery

API Integration

The extension integrates with Bitrefill's API endpoints:

  • GET /products/search - Search for available gift cards
  • POST /invoices - Create payment invoices
  • GET /invoices/{id} - Check payment status
  • GET /orders/{id} - Retrieve gift card details

Configuration

Settings

Access settings through the extension popup:

  • Default Payment Method: Choose your preferred cryptocurrency
  • Auto-detect Country: Enable/disable automatic country detection
  • API Token Management: Update or test your API connection

Supported Payment Methods

  • Bitcoin (BTC)
  • Lightning Network
  • Ethereum (ETH)
  • Litecoin (LTC)
  • And more supported by Bitrefill

Development

Project Structure

BitrefillExtension/
├── manifest.json          # Extension manifest
├── background.js          # Service worker
├── content.js            # Content script
├── content.css           # Content styles
├── popup.html            # Popup interface
├── popup.css             # Popup styles
├── popup.js              # Popup logic
├── modal.html            # Payment modal
├── modal.css             # Modal styles
├── modal.js              # Modal logic
├── icons/                # Extension icons
└── README.md             # This file

Key Components

  • Background Script: Handles API calls and extension state
  • Content Script: Detects merchants and injects UI
  • Popup: Extension configuration and status
  • Modal: Complete payment flow interface

Building for Production

  1. Create Icons: Add icon files (16x16, 48x48, 128x128) to the icons/ directory
  2. Test Thoroughly: Test on various merchant websites
  3. Package Extension: Zip the extension folder for distribution

Troubleshooting

Common Issues

"API token not configured"

  • Ensure you've entered your Bitrefill API token correctly
  • Test the connection using the "Test Connection" button

"No gift cards available"

  • The merchant may not be supported in your region
  • Try changing your country setting or visiting a different merchant

"Payment failed"

  • Check your cryptocurrency wallet has sufficient funds
  • Ensure you're sending the correct amount to the provided address
  • Verify the payment method is supported

Extension not working

  • Refresh the webpage and try again
  • Check the browser console for error messages
  • Ensure the extension is enabled in Chrome

Debug Mode

Enable debug logging by opening the browser console and looking for messages starting with "Bitrefill:"

Security

  • API tokens are stored locally in Chrome's secure storage
  • No sensitive data is transmitted to third parties
  • All API calls are made directly to Bitrefill's secure endpoints
  • Payment addresses are generated securely by Bitrefill

Privacy

  • The extension only accesses websites you visit
  • No browsing data is collected or stored
  • API calls are limited to Bitrefill's endpoints
  • Location detection is based on domain TLD only

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions:

  • Extension Issues: Open an issue on GitHub
  • Bitrefill API: Contact Bitrefill support
  • General Questions: Check the troubleshooting section above

Changelog

v1.0.0

  • Initial release
  • Basic merchant detection
  • Payment flow implementation
  • Gift card delivery
  • Multi-cryptocurrency support

Roadmap

  • User account integration
  • Payment history tracking
  • Bulk gift card purchases
  • Advanced merchant detection
  • Mobile app companion
  • Additional payment methods
  • Localization support
  • Advanced analytics

Note: This extension requires a valid Bitrefill API token to function. Get yours at https://www.bitrefill.com/account/developers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published