xsolla / xsolla-sdk-php

Xsolla SDK for PHP
https://developers.xsolla.com/doc/sdk/#php_sdk
MIT License
34 stars 52 forks source link

How to add virtual item which is Nonconsumable #89

Open PrajapatiDhara1510 opened 3 years ago

PrajapatiDhara1510 commented 3 years ago

I am using this SDK with laravel project. I am using api for creating virtual item. There is no document how to use with php and also request parameters are also different then mentioned in API reference of the official document. I somehow found the code from the source of the sdk. I did following code.

            $virtualItem = [
                'sku' => $request->sku,
                'name' => [
                    'en' => $request->name,
                ],
                'description' => [
                    'en' => $request->description,
                ],
                'prices' => [
                    'USD' => $request->price,
                ],
                'default_currency' => 'USD',
                'enabled' => $request->enabled,
                'free' => $request->free,
                'disposable' => false,
            ];

            $client = XsollaClient::factory(array(
                'merchant_id' => config('configuration.xsolla_merchant_id'),
                'api_key' => config('configuration.xsolla_api_key'),
            ));
            $response = $client->CreateVirtualItem([
                'project_id' => config('configuration.xsolla_project_id'),
                'request' => $virtualItem,
            ]);

As you can see for the php SDK there is difference with API reference. Now I want to create virtual item which is Nonconsumable. I tried item_type=>'Consumable' , item_type=>Nonconsumable', is_consumable=>false' , but nothing seems working.

Please help me how to do that also where can I find proper documentation.

CoolisCodes commented 3 years ago

I have the same problem with my solution, please help!