PHPackages                             ramiroauditore/coinbase-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ramiroauditore/coinbase-laravel

ActiveLibrary[API Development](/categories/api)

ramiroauditore/coinbase-laravel
===============================

Un wrapper para la API de Coinbase Commerce en Laravel

1.2.1(6y ago)117[2 PRs](https://github.com/RamiroAuditore/coinbase-laravel/pulls)MITPHP

Since Mar 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/RamiroAuditore/coinbase-laravel)[ Packagist](https://packagist.org/packages/ramiroauditore/coinbase-laravel)[ RSS](/packages/ramiroauditore-coinbase-laravel/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (1)Versions (8)Used By (0)

coinbase-laravel
================

[](#coinbase-laravel)

A wrapper for Coinbase Commerce's API for Laravel projects that require token purchases. It should work without issues if you follow the README to the tee, but I'm still new to cryptocurrency and Coinbase doesn't have the best docs, so please do submit an issue if you find a bug or something that could be improved and I'll take a look at it.

Notes
-----

[](#notes)

Right now the package just handles creating charges and has a webhook for the updates of charges. I might add the rest of endpoints in the future.

Installation
------------

[](#installation)

Install with Composer:

```
composer require ramiroauditore/coinbase-laravel

```

Then you need to include the ServiceProvider in the *config/app.php* file like this:

```
/*
 * Package Service Providers...
 */
coinbaselaravel\CoinbaseLaravelServiceProvider::class
```

Add the following to your *.env* file:

```
COINBASE_API_KEY= //An API Key you generated from your Coinbase's dashboard
TOKENS_BY_DOLLAR= //The ammount of tokens that should be given to the user per dollar spent

```

Run `php artisan: migrate` and a migration will run, adding the `coinbase_transactions` table to your database.

Usage
-----

[](#usage)

### Create a charge

[](#create-a-charge)

To create a charge you will need a `POST` to the following route:

```
https://yoursite.com/create_charge

```

You will need to send the following data:

```
user_id: An id from the users table so you know who the tokens belong to
amount: The amount in USD that the user wishes to spend
token_amount: The amount of tokens that the user will receive should they pay the value from the amount field

```

Should the request be successful a new row will be added to your coinbase\_transactions with the charge data and you will receive the following JSON response:

```
{
"pricing":{
    "local":
        {"amount":"0.50","currency":"USD"},
    "bitcoincash":
        {"amount":"0.00145658","currency":"BCH"},
    "litecoin":
        {"amount":"0.00792959","currency":"LTC"},
    "bitcoin":
        {"amount":"0.00005480","currency":"BTC"},
    "ethereum":
        {"amount":"0.002146000","currency":"ETH"},
    "usdc":
        {"amount":"0.500000","currency":"USDC"},
    "dai":
        {"amount":"0.498643440520065163","currency":"DAI"}
    },
"qr_strings":{
  "bitcoincash":"qrztp9f44tkdplvk822prfqqtep820hfs5hqhrktzc",
  "litecoin":"M97sEjpXCih4RHZiNtR6h3H8pZt134ECTt",
  "bitcoin":"37YVDwLSJbfUggqt3K6reBJS1awoXiEU2s",
  "ethereum":"0x0275b18043776cc73b57ebe980b58c521bf5ce67",
  "usdc":"0x0275b18043776cc73b57ebe980b58c521bf5ce67",
  "dai":"0x0275b18043776cc73b57ebe980b58c521bf5ce67"
  }
}
```

In which each object in the pricing object represents the equivalent of the local (USD) price the user submitted and each property in the qr\_strings object represents a string you can use to generate a QR code to pay with the respective currency.

### Webhooks

[](#webhooks)

The webhook function resides in the following route:

```
https://yoursite.com/charge_update

```

So you should exclude it from the CSRF protection by modfying your `Http/Middleware/VerifyCsrfToken.php` file like this:

```
protected $except = [
  'charge_update/'
];
```

After doing that you should register the webhook by providing the URL of the route in the settings of you Coinbase Commerce and it should automatically start functioning whenever there's an event (I recommend disabling the `charge:created` hook). It will update the corresponding table entry with the new data. Including doing recalculations of the `amount` and `token_amount` fields to adjust in case the user underpaid or overpaid.

**NOTE:** Keep in mind, though, that if the user does over or underpay and you want the charge to still be valid, you will need to "resolve it" manually through the dashboard, otherwise it will be marked as failed and the money will be returned to the user. There's a way to do this through an endpoint, I might add it later.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

5

Last Release

2235d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3a28f0e7bba593833a14f396467445b2e1d8d281d6ec22ccdf2dc1065f877e3?d=identicon)[RamiroAuditore](/maintainers/RamiroAuditore)

---

Top Contributors

[![RamiroAuditore](https://avatars.githubusercontent.com/u/20427893?v=4)](https://github.com/RamiroAuditore "RamiroAuditore (116 commits)")

### Embed Badge

![Health badge](/badges/ramiroauditore-coinbase-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/ramiroauditore-coinbase-laravel/health.svg)](https://phpackages.com/packages/ramiroauditore-coinbase-laravel)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
