https://github.com/wundii/afterbuy-sdk
Afterbuy Programming Interface Software Development Kit
https://github.com/wundii/afterbuy-sdk
afterbuy php sdk shop-api xml-api
Last synced: 6 months ago
JSON representation
Afterbuy Programming Interface Software Development Kit
- Host: GitHub
- URL: https://github.com/wundii/afterbuy-sdk
- Owner: wundii
- License: mit
- Created: 2024-07-20T07:20:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-18T09:34:26.000Z (7 months ago)
- Last Synced: 2025-12-21T16:50:47.304Z (7 months ago)
- Topics: afterbuy, php, sdk, shop-api, xml-api
- Language: PHP
- Homepage:
- Size: 620 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# afterbuy-sdk
[](https://xmldoku.afterbuy.de/shopdoku)
[](https://xmldoku.afterbuy.de/dokued)
[](https://github.com/wundii/afterbuy-sdk/actions/workflows/code_quality.yml)
[](https://phpstan.org/)

[](https://www.php.net/)
[](https://getrector.com)
[](https://tomasvotruba.com/blog/zen-config-in-ecs)
[](https://phpunit.org)
[](https://codecov.io/github/wundii/afterbuy-sdk)
[](https://php-fig.org/psr/psr-3)
[](https://packagist.org/packages/wundii/afterbuy-sdk)
This is a modern Afterbuy Programming Interface Software Development Kit, for the selling solution [afterbuy.de](https://www.afterbuy.de/).
## Requirements
- PHP 8.2 or higher
- ext-dom
- ext-json
- ext-reflection
- ext-simplexml
- ext-xml
## Installation
Require the bundle and its dependencies with composer:
> composer require wundii/afterbuy-sdk
### Installations for frameworks
- Laravel Package is in development
- [Symfony Bundle](https://github.com/wundii/afterbuy-sdk-symfony-bundle)
## Afterbuy API Documentation
- [Shop API Documentation](https://xmldoku.afterbuy.de/shopdoku/)
- [XML API Documentation](https://xmldoku.afterbuy.de/dokued/)
### Current Afterbuy API Informations
- last update 2.0.460 was recalled by Afterbuy, current version is 2.0.459
- the afterbuy sdk is compatible with the recalled version 2.0.460
### Supported Requests with Examples
- [x] [CreateShopOrder](examples/CreateShopOrder.md)
- [x] [GetAfterbuyTime](examples/GetAfterbuyTime.md)
- [x] [GetListerHistory](examples/GetListerHistory.md)
- [x] [GetMailTemplates](examples/GetMailTemplates.md)
- [x] [GetPaymentServices](examples/GetPaymentServices.md)
- [x] [GetProductDiscounts](examples/GetProductDiscounts.md)
- [x] [GetShippingCost](examples/GetShippingCost.md)
- [x] [GetShippingServices](examples/GetShippingServices.md)
- [x] [GetShopCatalogs](examples/GetShopCatalogs.md)
- [x] [GetShopProducts](examples/GetShopProducts.md)
- [x] [GetSoldItems](examples/GetSoldItems.md)
- [x] [GetStockInfo](examples/GetStockInfo.md)
- [x] [GetTranslatedMailTemplate](examples/GetTranslatedMailTemplate.md)
- [x] [UpdateCatalogs](examples/UpdateCatalogs.md)
- [x] [UpdateShopProducts](examples/UpdateShopProducts.md)
- [x] [UpdateSoldItems](examples/UpdateSoldItems.md)
## Afterbuy Sandbox Environment
```php
use Wundii\AfterbuySdk\Core\Afterbuy;
use Wundii\AfterbuySdk\Core\AfterbuyGlobal;
use Wundii\AfterbuySdk\Dto\UpdateShopProducts;
use Wundii\AfterbuySdk\Enum\Core\EndpointEnum;
$afterbuyGlobal = new AfterbuyGlobal(
'123...',
'456...',
EndpointEnum::SANDBOX,
);
$afterbuy = new Afterbuy(
$afterbuyGlobal,
);
$afterbuy->runRequest(
new UpdateShopProducts(
... // afterbuy sdk request object
),
);
```
According to the Afterbuy documentation, the scheme should be changed from https to http for the test environment.
However, this is currently not working as expected - all changes continue to affect the production environment.
This afterbuy sdk always returns default a successful response if it is an update request.
Alternatively, you can pass your own update response class.
```php
use Wundii\AfterbuySdk\Core\Afterbuy;
use Wundii\AfterbuySdk\Core\AfterbuyGlobal;
use Wundii\AfterbuySdk\Core\SandboxResponse;
use Wundii\AfterbuySdk\Dto\UpdateShopProducts;
use Wundii\AfterbuySdk\Enum\Core\EndpointEnum;
$afterbuyGlobal = new AfterbuyGlobal(
'123...',
'456...',
EndpointEnum::SANDBOX,
);
$afterbuy = new Afterbuy(
$afterbuyGlobal,
);
/** your own response version */
$afterbuy->runRequest(
new UpdateShopProducts(
... // afterbuy sdk request object
),
new SandboxResponse('', 200),
);
```
## Usage
```php
use Wundii\AfterbuySdk\Core\Afterbuy;
use Wundii\AfterbuySdk\Core\AfterbuyGlobal;
use Wundii\AfterbuySdk\Enum\Core\EndpointEnum;
use Wundii\AfterbuySdk\Request\GetAfterbuyTimeRequest;
$afterbuyGlobal = new AfterbuyGlobal(
accountToken: '123...',
partnerToken: '456...',
EndpointEnum::SANDBOX,
);
$request = new GetAfterbuyTimeRequest();
$afterbuy = new Afterbuy(
$afterbuyGlobal,
Optional_PsrLoggerInterface::class,
);
$response = $afterbuy->runRequest($request);
$response->getStatusCode();
$response->getCallStatus();
$response->getInfo();
$response->getResult();
$response->getXmlResponse()
$response->getErrorMessages();
$response->getWarningMessages();
```
## Development for Afterbuy SDK
### composer scripts
```shell
composer cache-clear
composer ecs-apply
composer ecs-dry
composer phpstan
composer rector-apply
composer rector-dry
composer unittest
```
### complete checks before merge
```shell
composer complete-check
```