$purchaseToken, "productId" => $productId]; $msgBody = json_encode($body); $response = AtDemo::httpPost(self::getRootUrl($accountFlag) . self::VERIFY_TOKEN_URL, $msgBody, 5, 5, $headers); // TODO: display the response as string in console, you can replace it with your business logic. // echo $response; # gwang 将echo 改为return (2022.10.19) $respData = json_decode($response); return $respData; } public function cancelledListPurchase($endTime, $startTime, $maxRows, $type, $continuationToken, $accountFlag) { // fetch the App Level AccessToken $appAT = AtDemo::getAppAT(); if ($appAT == null) { return; } // construct the Authorization in Header $headers = AtDemo::buildAuthorization($appAT); // pack the request body $body = ["endAt" => $endTime, "startAt" => $startTime, "maxRows" => $maxRows, "type" => $type, "continuationToken" => $continuationToken]; $msgBody = json_encode($body); $response = AtDemo::httpPost(self::getRootUrl($accountFlag) . self::CANCELLED_LIST_PURCHASE_URL, $msgBody, 5, 5, $headers); // TODO: display the response as string in console, you can replace it with your business logic. echo $response; } public function confirmPurchase($purchaseToken, $productId, $accountFlag) { // fetch the App Level AccessToken $appAT = AtDemo::getAppAT(); if ($appAT == null) { return; } // construct the Authorization in Header $headers = AtDemo::buildAuthorization($appAT); // pack the request body $body = ["purchaseToken" => $purchaseToken, "productId" => $productId]; $msgBody = json_encode($body); $response = AtDemo::httpPost(self::getRootUrl($accountFlag) . self::CONFIRM_PURCHASE_URL, $msgBody, 5, 5, $headers); // TODO: display the response as string in console, you can replace it with your business logic. echo $response; } }