bitpay / php-bitpay-client

PHP implementation for the BitPay cryptographically secure RESTful API
MIT License
165 stars 149 forks source link

IPNlogger.php includes no private/public key, just token #278

Closed petzsch closed 6 years ago

petzsch commented 6 years ago

Is that intended or a bug?

From my understanding the IPNlogger.php needs the keys to query the BitPay API for invoice details. Please fix if it is not a misunderstanding from my side.

Thx for the great library, it's fun working with this. :+1:

pieterpoorthuis commented 6 years ago

IPNLogger uses the public facade to fetch the invoice, so it doesn't need keys. Using the public facade invoices can be fetched up until 3 days after invoice creation.

If you want you can use the merchant facade. In this case you do need the keys, a merchant facade token and to explicitly set the facade name to 'merchant':

$token = new \Bitpay\Token();
$token->setToken('your_token'); // UPDATE THIS VALUE
$token->setFacade("merchant");
/**
 * Token object is injected into the client
 */
$client->setToken($token);

Using the merchant facade has the advantage that you can also fetch invoices after 3 days.