I created a subscription for my Android app and here's my code to confirm subscription assignments, but I get an error
$packageName = "com.example.srkn";
$productId = "com.example.srkn.aylik";
$token = "<some token here>";
require 'vendor/autoload.php';
$client = new \Google_Client();
$client->setAuthConfig('ts.json');
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$service = new \Google_Service_AndroidPublisher($client);
$postBody = "okey";
$para = "test";
$purchase = $service->purchases_subscriptions->acknowledge($packageName, $productId, $token,$postBody,$para);
//echo json_encode($purchase);
Fatal error: Uncaught TypeError: Argument 4 passed to Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions::acknowledge() must be an instance of Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest, string given, called in /home/serkanka/public_html/dgr/onayla.php on line 17 and defined in /home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php:40 Stack trace: #0 /home/serkanka/public_html/dgr/onayla.php(17): Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions->acknowledge('com.text.spec.s...', 'com.text.spec.s...','jlkehndmfjoaenc...', 'test', 'test') #1 {main} thrown in /home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php on line 40
The postbody (4th parameter) should be an instance of Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest
You can set the developerPayload on the object like so:
$requestBody = new Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest();
$requestBody->setDeveloperPayload('your_developer_payload');