commerce_coinbase is a modern, fully typed Python client for the Coinbase Commerce API that stays current with the latest platform capabilities. Use it to integrate cryptocurrency payments into your product without wrestling with raw HTTP requests or manual signature verification.
The official Coinbase Commerce wrapper is no longer maintained, leaving many new API capabilities inaccessible. This project aims to fill that gap by providing:
- ✅ Complete coverage of core payment flows – create, list, cancel charges, and retrieve events with minimal boilerplate.
- ✅ First-class webhook utilities – easily validate incoming events to keep your integration secure.
- ✅ Pythonic ergonomics – type hints, descriptive exceptions, and logical method names speed up integration and maintenance.
Install from PyPI:
pip install commerce-coinbaseTo work against a local checkout instead, clone the repository and install it in editable mode:
git clone https://github.com/maxiedev/Coinbase-Commerce.git
cd Coinbase-Commerce
pip install -e .from commerce_coinbase import CoinbaseCommerceAPI
# Authenticate with your Coinbase Commerce API key
api = CoinbaseCommerceAPI(api_key="YOUR_API_KEY")
# Create a one-time charge
charge = api.create_charge(
name="Limited Edition Hoodie",
description="Only 100 made",
amount=20.00,
currency="USD",
pricing_type="fixed_price",
)
print(charge.code) # Use this code to redirect customers to Coinbase Checkoutfrom commerce_coinbase.webhooks import CoinbaseWebhook
webhook = CoinbaseWebhook(shared_secret="YOUR_WEBHOOK_SHARED_SECRET")
def handle_event(request_body: bytes, signature: str):
event = webhook.verify_signature(payload=request_body, signature=signature)
# Process the event (e.g., mark charge as paid)
return eventFor a complete list of available methods, explore the commerce_coinbase package or check the API reference.
- API key: Generate a key from your Coinbase Commerce dashboard and keep it secret.
- Timeouts & retries: The client exposes
sessionconfiguration if you need to customize request behavior for high-volume scenarios. - Environment variables: In production environments, store credentials in variables such as
COINBASE_COMMERCE_API_KEYand inject them at runtime.
- Install development dependencies with
pip install -r requirements.txt. - Run the unit suite with
pytestto validate changes. - Use
blackandisort(if installed) to maintain consistent formatting.
Contributions are welcome! Please:
- Fork the repository and create a feature branch.
- Add or update tests that cover your changes.
- Submit a pull request describing your motivation and implementation details.
Before contributing, review the CONTRIBUTING guidelines for more information on project conventions.
Encounter a bug or need a feature? Open an issue with as much detail as possible. Discussions and suggestions are always appreciated.
commerce_coinbase is distributed under the GPL-3.0 License. See the LICENSE file for the full text.