coinbase / coinbase/coinbase-commerce-php

how to verify signature in laravel

Open
#54 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
149
Forks
157
PR merge metrics
No merged PRs in 30d

Description

Hi, I wanted to know, I have a laravel project, and tried to implement this package in order to support payments with crypto.

The only problem I have is that I don't know how can I verify coinbase's signature on the webhook events.

What I'm trying to do is something like this example from the readme file:

```
use CoinbaseCommerce\Webhook;

try {
Webhook::verifySignature($signature, $body, $sharedSecret);
echo 'Successfully verified';
} catch (\Exception $exception) {
echo $exception->getMessage();
echo 'Failed';
}
```

I don't have any problem getting the signature or the shared secret, but I don't know how can I get the raw body of the request.

If anyone can help, I'd really appreciate it.

I'm using the following:
- PHP 8.0.10
- Laravel 8.61.0
- coinbase/coinbase-commerce: "^1.0",

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README webhook example and Laravel 8.61.0 request handling, focusing on how the raw request body is obtained for the signature check. Done means documenting a Laravel-compatible way to provide the raw body to Webhook::verifySignature using the existing signature and shared secret.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, payments
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.