coinbase / coinbase-php

DEPRECATED — PHP wrapper for the Coinbase API
Apache License 2.0
297 stars 198 forks source link

What is $_SERVER['HTTP_CB_SIGNATURE'] in coinbase api notification? #203

Closed sahidul99 closed 4 years ago

sahidul99 commented 5 years ago

Hi I am trying to use coinbase api,api implementation is Working fine but facing problem on notification. Accroding to documentation I have created Notification url and codes are bellow

<?php
   require_once('vendor/autoload.php');

use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;

$apiKey=" xxxx";
$apiSecret="xxxx";

$configuration = Configuration::apiKey($apiKey, $apiSecret);
$client = Client::create($configuration);

$raw_body = file_get_contents('php://input');
$signature = $_SERVER['HTTP_CB_SIGNATURE'];
$authenticity = $client->verifyCallback($raw_body, $signature); // boolean
if($authenticity){
 $data = json_decode($raw_body, true);
    mail("sahid4745@gmail.com","Coinbase Payment Notifications",print_r($order, true));
}
$message=$raw_body;
mail('sahid4745@gmail.com', 'My Subject', $message);

?>    

But this is producing error as Notice:

Undefined index: HTTP_CB_SIGNATURE in /home/exhakduz/api/webhooks.php on line 38

I Don't know actually what is server_cb_signature, if some one can explain that will be great help for me.

drewrothstein commented 4 years ago

Hi, we are closing out PRs + Issues as this project is being archived.