Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.2.0
-
Component/s: None
-
Labels:None
Description
One client encountered an error when validating an approved token, since the api request to fetch ledgers resulted in an error like the following:
[2021-10-04T19:43:39.998692+00:00] general.ERROR: BITPAY-LEDGER-GET: Failed to retrieve ledger-> failed to serialize Ledger object : GET failed : Guzzle\/BadResponseException : Server error: `GET https://bitpay.com/ledgers?token=6YZajLf5hJ2yMd7ttyer6r6qY3tM3a1KmJysmknSdKcMg resulted in a 500 Internal Server Error` response: {"error":"No ledgers for account"}
This happened even though there were ledgers assigned to the user. The subscription api call seems to be more reliable.
Change:
$ledgers = $bitpay->getLedgers();
To
$subscriptions = $bitpay->getSubscriptions();