diff --git a/lib/bitpay/bp_lib.php b/lib/bitpay/bp_lib.php index 1400765..4f63f08 100644 --- a/lib/bitpay/bp_lib.php +++ b/lib/bitpay/bp_lib.php @@ -190,7 +190,12 @@ function bpVerifyNotification($apiKey = false) $json['posData'] = $posData['posData']; - return $json; + if (!array_key_exists('id', $json)) + { + return 'Cannot find invoice ID'; + } + + return bpGetInvoice($json['id'], $apiKey); } /** @@ -218,7 +223,10 @@ function bpGetInvoice($invoiceId, $apiKey=false) } $response['posData'] = json_decode($response['posData'], true); - $response['posData'] = $response['posData']['posData']; + if($bpOptions['verifyPos']) + { + $response['posData'] = $response['posData']['posData']; + } return $response; }