https://github.com/sapientpro/ebay-account-sdk-php
PHP SDK for Ebay Account API
https://github.com/sapientpro/ebay-account-sdk-php
ebay-api ebay-sdk php php8
Last synced: 3 months ago
JSON representation
PHP SDK for Ebay Account API
- Host: GitHub
- URL: https://github.com/sapientpro/ebay-account-sdk-php
- Owner: sapientpro
- License: mit
- Created: 2023-05-03T11:52:04.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-06-28T08:10:51.000Z (over 2 years ago)
- Last Synced: 2025-09-25T13:35:46.939Z (4 months ago)
- Topics: ebay-api, ebay-sdk, php, php8
- Language: PHP
- Homepage:
- Size: 450 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ebay Account API SDK for PHP
The Account API gives sellers the ability to configure their eBay seller accounts, including the seller's policies (eBay business policies and seller-defined custom policies), opt in and out of eBay seller programs, configure sales tax tables, and get account information.
For details on the availability of the methods in this API, see Account API requirements and restrictions.
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: v1.9.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
## Requirements
- PHP 8.1 or later
- ext-json and ext-curl extensions enabled
## Installation & Usage
Install the package using composer:
```sh
composer require sapientpro/ebay-account-sdk-php
```
## Example usage
Please follow the [installation procedure](#installation--usage) and then run the following:
```php
setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new CustomPolicyApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
ebayClient: GuzzleHttp\Client(),
config: $config
);
// you can create and fill a Model class that implements EbayModelInterface using fromArray() method
// exception will be thrown if a property does not exist in the model class
$body = CustomPolicyCreateRequest::fromArray([
'description' => 'description_example',
'name' => 'name_example',
'label' => 'label_example',
'custom_policy_type_enum' => CustomPolicyTypeEnum::PRODUCT_COMPLIANCE,
]);
try {
$result = $apiInstance->createCustomPolicy($body, MarketplaceIdEnum::EBAY_US);
print_r($result);
// there is also a custom ApiException for non 2xx responses
} catch (Exception $e) {
echo 'Exception when calling CustomPolicyApi->createCustomPolicy: ', $e->getMessage(), PHP_EOL;
}
```
## Creating Models
Some SDK methods require `$body` variable as a parameter. It refers to a Model class that implements EbayModelInterface.
There are several ways to create a Model class:
### fromArray()
You can create a Model class using fromArray() method.
It will throw an exception if a property does not exist in the model class.
If the model has a property of type that implements EbayModelInterface, you must create an instance of that class using fromArray() method.
In this example, the property `price` is of type `ConvertedAmount` that also implements EbayModelInterface.
```php
Item::fromArray([
'price' => ConvertedAmount::fromArray([
'value' => '6.90',
'currency' => CurrencyCodeEnum::USD
)]
])
```
### fromPlainArray()
It is also possible to create a Model from plain associative array.
The previous example can be rewritten as follows:
```php
Item::fromPlainArray([
'price' => [
'value' => '6.90',
'currency' => CurrencyCodeEnum::USD
]
])
```
### fromJson()
It is also possible to create a Model from JSON string.
```php
Item::fromJson('{"price": {"value": "6.90", "currency": "USD"}}')
```
## Documentation for API Endpoints
All URIs are relative to *https://api.ebay.com/sell/account/v1*
| Class | Method | HTTP request | Description |
|------------------------|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------|
| *CustomPolicyApi* | [**createCustomPolicy**](docs/Api/CustomPolicyApi.md#createcustompolicy) | **POST** /custom_policy/ | |
| *CustomPolicyApi* | [**getCustomPolicies**](docs/Api/CustomPolicyApi.md#getcustompolicies) | **GET** /custom_policy/ | |
| *CustomPolicyApi* | [**getCustomPolicy**](docs/Api/CustomPolicyApi.md#getcustompolicy) | **GET** /custom_policy/{custom_policy_id} | |
| *CustomPolicyApi* | [**updateCustomPolicy**](docs/Api/CustomPolicyApi.md#updatecustompolicy) | **PUT** /custom_policy/{custom_policy_id} | |
| *FulfillmentPolicyApi* | [**createFulfillmentPolicy**](docs/Api/FulfillmentPolicyApi.md#createfulfillmentpolicy) | **POST** /fulfillment_policy/ | |
| *FulfillmentPolicyApi* | [**deleteFulfillmentPolicy**](docs/Api/FulfillmentPolicyApi.md#deletefulfillmentpolicy) | **DELETE** /fulfillment_policy/{fulfillmentPolicyId} | |
| *FulfillmentPolicyApi* | [**getFulfillmentPolicies**](docs/Api/FulfillmentPolicyApi.md#getfulfillmentpolicies) | **GET** /fulfillment_policy | |
| *FulfillmentPolicyApi* | [**getFulfillmentPolicy**](docs/Api/FulfillmentPolicyApi.md#getfulfillmentpolicy) | **GET** /fulfillment_policy/{fulfillmentPolicyId} | |
| *FulfillmentPolicyApi* | [**getFulfillmentPolicyByName**](docs/Api/FulfillmentPolicyApi.md#getfulfillmentpolicybyname) | **GET** /fulfillment_policy/get_by_policy_name | |
| *FulfillmentPolicyApi* | [**updateFulfillmentPolicy**](docs/Api/FulfillmentPolicyApi.md#updatefulfillmentpolicy) | **PUT** /fulfillment_policy/{fulfillmentPolicyId} | |
| *KycApi* | [**getKYC**](docs/Api/KycApi.md#getkyc) | **GET** /kyc | |
| *OnboardingApi* | [**getPaymentsProgramOnboarding**](docs/Api/OnboardingApi.md#getpaymentsprogramonboarding) | **GET** /payments_program/{marketplace_id}/{payments_program_type}/onboarding | |
| *PaymentPolicyApi* | [**createPaymentPolicy**](docs/Api/PaymentPolicyApi.md#createpaymentpolicy) | **POST** /payment_policy | |
| *PaymentPolicyApi* | [**deletePaymentPolicy**](docs/Api/PaymentPolicyApi.md#deletepaymentpolicy) | **DELETE** /payment_policy/{payment_policy_id} | |
| *PaymentPolicyApi* | [**getPaymentPolicies**](docs/Api/PaymentPolicyApi.md#getpaymentpolicies) | **GET** /payment_policy | |
| *PaymentPolicyApi* | [**getPaymentPolicy**](docs/Api/PaymentPolicyApi.md#getpaymentpolicy) | **GET** /payment_policy/{payment_policy_id} | |
| *PaymentPolicyApi* | [**getPaymentPolicyByName**](docs/Api/PaymentPolicyApi.md#getpaymentpolicybyname) | **GET** /payment_policy/get_by_policy_name | |
| *PaymentPolicyApi* | [**updatePaymentPolicy**](docs/Api/PaymentPolicyApi.md#updatepaymentpolicy) | **PUT** /payment_policy/{payment_policy_id} | |
| *PaymentsProgramApi* | [**getPaymentsProgram**](docs/Api/PaymentsProgramApi.md#getpaymentsprogram) | **GET** /payments_program/{marketplace_id}/{payments_program_type} | |
| *PrivilegeApi* | [**getPrivileges**](docs/Api/PrivilegeApi.md#getprivileges) | **GET** /privilege | |
| *ProgramApi* | [**getOptedInPrograms**](docs/Api/ProgramApi.md#getoptedinprograms) | **GET** /program/get_opted_in_programs | |
| *ProgramApi* | [**optInToProgram**](docs/Api/ProgramApi.md#optintoprogram) | **POST** /program/opt_in | |
| *ProgramApi* | [**optOutOfProgram**](docs/Api/ProgramApi.md#optoutofprogram) | **POST** /program/opt_out | |
| *RateTableApi* | [**getRateTables**](docs/Api/RateTableApi.md#getratetables) | **GET** /rate_table | |
| *ReturnPolicyApi* | [**createReturnPolicy**](docs/Api/ReturnPolicyApi.md#createreturnpolicy) | **POST** /return_policy | |
| *ReturnPolicyApi* | [**deleteReturnPolicy**](docs/Api/ReturnPolicyApi.md#deletereturnpolicy) | **DELETE** /return_policy/{return_policy_id} | |
| *ReturnPolicyApi* | [**getReturnPolicies**](docs/Api/ReturnPolicyApi.md#getreturnpolicies) | **GET** /return_policy | |
| *ReturnPolicyApi* | [**getReturnPolicy**](docs/Api/ReturnPolicyApi.md#getreturnpolicy) | **GET** /return_policy/{return_policy_id} | |
| *ReturnPolicyApi* | [**getReturnPolicyByName**](docs/Api/ReturnPolicyApi.md#getreturnpolicybyname) | **GET** /return_policy/get_by_policy_name | |
| *ReturnPolicyApi* | [**updateReturnPolicy**](docs/Api/ReturnPolicyApi.md#updatereturnpolicy) | **PUT** /return_policy/{return_policy_id} | |
| *SalesTaxApi* | [**createOrReplaceSalesTax**](docs/Api/SalesTaxApi.md#createorreplacesalestax) | **PUT** /sales_tax/{countryCode}/{jurisdictionId} | |
| *SalesTaxApi* | [**deleteSalesTax**](docs/Api/SalesTaxApi.md#deletesalestax) | **DELETE** /sales_tax/{countryCode}/{jurisdictionId} | |
| *SalesTaxApi* | [**getSalesTax**](docs/Api/SalesTaxApi.md#getsalestax) | **GET** /sales_tax/{countryCode}/{jurisdictionId} | |
| *SalesTaxApi* | [**getSalesTaxes**](docs/Api/SalesTaxApi.md#getsalestaxes) | **GET** /sales_tax | |
## Documentation For Models
- [Amount](docs/Model/Amount.md)
- [CategoryType](docs/Model/CategoryType.md)
- [CompactCustomPolicyResponse](docs/Model/CompactCustomPolicyResponse.md)
- [CustomPolicy](docs/Model/CustomPolicy.md)
- [CustomPolicyCreateRequest](docs/Model/CustomPolicyCreateRequest.md)
- [CustomPolicyRequest](docs/Model/CustomPolicyRequest.md)
- [CustomPolicyResponse](docs/Model/CustomPolicyResponse.md)
- [Deposit](docs/Model/Deposit.md)
- [Error](docs/Model/Error.md)
- [ErrorParameter](docs/Model/ErrorParameter.md)
- [FulfillmentPolicy](docs/Model/FulfillmentPolicy.md)
- [FulfillmentPolicyRequest](docs/Model/FulfillmentPolicyRequest.md)
- [FulfillmentPolicyResponse](docs/Model/FulfillmentPolicyResponse.md)
- [InternationalReturnOverrideType](docs/Model/InternationalReturnOverrideType.md)
- [KycCheck](docs/Model/KycCheck.md)
- [KycResponse](docs/Model/KycResponse.md)
- [PaymentMethod](docs/Model/PaymentMethod.md)
- [PaymentPolicy](docs/Model/PaymentPolicy.md)
- [PaymentPolicyRequest](docs/Model/PaymentPolicyRequest.md)
- [PaymentPolicyResponse](docs/Model/PaymentPolicyResponse.md)
- [PaymentsProgramOnboardingResponse](docs/Model/PaymentsProgramOnboardingResponse.md)
- [PaymentsProgramOnboardingSteps](docs/Model/PaymentsProgramOnboardingSteps.md)
- [PaymentsProgramResponse](docs/Model/PaymentsProgramResponse.md)
- [Program](docs/Model/Program.md)
- [Programs](docs/Model/Programs.md)
- [RateTable](docs/Model/RateTable.md)
- [RateTableResponse](docs/Model/RateTableResponse.md)
- [RecipientAccountReference](docs/Model/RecipientAccountReference.md)
- [Region](docs/Model/Region.md)
- [RegionSet](docs/Model/RegionSet.md)
- [ReturnPolicy](docs/Model/ReturnPolicy.md)
- [ReturnPolicyRequest](docs/Model/ReturnPolicyRequest.md)
- [ReturnPolicyResponse](docs/Model/ReturnPolicyResponse.md)
- [SalesTax](docs/Model/SalesTax.md)
- [SalesTaxBase](docs/Model/SalesTaxBase.md)
- [SalesTaxes](docs/Model/SalesTaxes.md)
- [SellingLimit](docs/Model/SellingLimit.md)
- [SellingPrivileges](docs/Model/SellingPrivileges.md)
- [SetFulfillmentPolicyResponse](docs/Model/SetFulfillmentPolicyResponse.md)
- [SetPaymentPolicyResponse](docs/Model/SetPaymentPolicyResponse.md)
- [SetReturnPolicyResponse](docs/Model/SetReturnPolicyResponse.md)
- [ShippingOption](docs/Model/ShippingOption.md)
- [ShippingService](docs/Model/ShippingService.md)
- [TimeDuration](docs/Model/TimeDuration.md)
## Documentation For Authorization
## api_auth
- **Type**: OAuth
- **Flow**: accessCode
- **Authorization URL**: https://auth.ebay.com/oauth2/authorize
- **Scopes**:
- **https://api.ebay.com/oauth/api_scope/sell.account.readonly**: View your account settings
- **https://api.ebay.com/oauth/api_scope/sell.account**: View and manage your account settings
## Author
[Swagger Codegen team](https://github.com/swagger-api/swagger-codegen)
and [SapientPro](https://sapient.pro/)