李帅

1.打印苹果日志

......@@ -33,6 +33,8 @@ class ApplePayment implements PaymentInterface
const SANDBOX_URL = 'https://sandbox.itunes.apple.com/verifyReceipt';
const PASSWORD = 'cbd66447ac8b463daf6d5498fec5f580';
public function __construct()
{
......@@ -55,8 +57,20 @@ class ApplePayment implements PaymentInterface
$client = new Client(['headers' => ['Content-Type' => 'application/json']]);
try{
$response = $client->post(self::IS_SANDBOX ? self::SANDBOX_URL : self::VERIFY_URL,
['json' => ['receipt-data' => $token,]])->getBody()->getContents();
['json' => ['receipt-data' => $token, 'password' => self::PASSWORD]])->getBody()->getContents();
$resp = json_decode($response,true);
Log::debug($response);
if ($resp['status'] <= 21003) {
$newToken = str_replace('+', ' ', $token);
try{
$response = $client->post(self::IS_SANDBOX ? self::SANDBOX_URL : self::VERIFY_URL,
['json' => ['receipt-data' => $newToken, 'password' => self::PASSWORD]])->getBody()->getContents();
Log::debug('======== 替换+ ========');
Log::debug($response);
}catch (GuzzleException $exception){
Log::error($exception->getMessage() . 'Line:' . $exception->getLine());
}
}
}catch (GuzzleException $exception){
Log::error($exception->getMessage() . 'Line:' . $exception->getLine());
}
......