A Laravel package for the Bol.com v5 Retailer API. Losely based on the incomplete jasperverbeet/bolcom-retailer-api-v3-php
package.
composer require deniztezcan/laravel-bolcom-retailer-api
Add a ServiceProvider to your providers array in config/app.php
:
'providers' => [
//other things here
DenizTezcan\BolRetailer\BolServiceProvider::class,
];
Add the facade to the facades array:
'aliases' => [
//other things here
'BolRetailerAPI' => DenizTezcan\BolRetailer\Facades\BolRetailerAPI::class,
];
Finally, publish the configuration files:
php artisan vendor:publish --provider="DenizTezcan\BolRetailer\BolServiceProvider"
Please set your API: key
and secret
in the config/bolcom-retailer.php
To get commissions in bulk, we need to send EANs in bulk.
$request = BolRetailerAPI::commissions()->getCommissions([['ean' => '3615674428738'], ['ean' => '0958054542376'], ['ean' => '1863180850327']]);
$commissions = $request->commissions;
To get commissions for the single EAN.
$commission = BolRetailerAPI::commissions()->getCommission('3615674428738');
It is possible to create an offer via the v3 api
BolRetailerAPI::offers()->createOffer(
$ean,
$conditionName, // "NEW" "AS_NEW" "GOOD" "REASONABLE" "MODERATE",
$conditionCategory, // "NEW" "SECONDHAND"
$referenceCode, // Your internal SKU or other ID
$onHoldByRetailer,
$unknownProductTitle,
$price,
$stockAmount,
$stockManagedByRetailer, //False incase you want Bol to remove the stock automatically from their system based on orders
$fulfilmentType, //"FBB" "FBR" (FBB - Fulfilment By Bol) (FBR - Fulfilment by Retailer)
$fulfilmentDeliveryCode //"24uurs-23" "24uurs-22" "24uurs-21" "24uurs-20" "24uurs-19" "24uurs-18" "24uurs-17" "24uurs-16" "24uurs-15" "24uurs-14" "24uurs-13" "24uurs-12" "1-2d" "2-3d" "3-5d" "4-8d" "1-8d" "MijnLeverbelofte"
);
To get a list of all offers you have in CSV
$event = BolRetailerAPI::offers()->requestDump();
sleep(120); //it takes some time for bol to generate the CSV a sleep is needed to make sure the CSV is ready
$csv = BolRetailerAPI::offers()->handleDumpRequest((string) $event->entityId);
You can get a specific offers by it's offer id
$offer = BolRetailerAPI::offers()->getOffer($offerId);
You can update the fulfilment promise of an offer by it's offer id
BolRetailerAPI::offers()->updateOffer(
$offerId,
$referenceCode,
$onHoldByRetailer,
$unknownProductTitle,
$fulfilmentType, //"FBB" "FBR" (FBB - Fulfilment By Bol) (FBR - Fulfilment by Retailer)
$fulfilmentDeliveryCode //"24uurs-23" "24uurs-22" "24uurs-21" "24uurs-20" "24uurs-19" "24uurs-18" "24uurs-17" "24uurs-16" "24uurs-15" "24uurs-14" "24uurs-13" "24uurs-12" "1-2d" "2-3d" "3-5d" "4-8d" "1-8d" "MijnLeverbelofte"
);
You can update the price of an offer by it's offer id
BolRetailerAPI::offers()->updateOfferPrice(
$offerId,
[
[
'quantity' => 1,
'price' => 1.00
]
]
);
You can update the stock of an offer by it's offer id
BolRetailerAPI::offers()->updateOfferStock(
$offerId,
$amount,
$managedByRetailer
);
$orders = BolRetailerAPI::orders()->getOrders();
$order = BolRetailerAPI::orders()->getOrder($orderId);
BolRetailerAPI::orders()->cancelOrderItem(
$orderItemId,
$reasonCode //"OUT_OF_STOCK" "REQUESTED_BY_CUSTOMER" "BAD_CONDITION" "HIGHER_SHIPCOST" "INCORRECT_PRICE" "NOT_AVAIL_IN_TIME" "NO_BOL_GUARANTEE" "ORDERED_TWICE" "RETAIN_ITEM" "TECH_ISSUE" "UNFINDABLE_ITEM" "OTHER"
);
BolRetailerAPI::orders()->cancelOrderItem(
$shipOrderItem,
$shipmentReference, //optional only for internal purposes
$transporterCode, // TNT for PostNL
$trackAndTrace, // Track and Trace number
);
The following features are available (an - means the feature is planned, but not yet included):
Method | URI | From Version | Link to Bol documentation |
---|---|---|---|
POST | /retailer/commission | v1.1.0 | link |
GET | /retailer/commission/{ean} | v1.0.0 | link |
POST | /retailer/offers | v1.1.0 | link |
POST | /retailer/offers/export | v1.3.0 | link |
GET | /retailer/offers/export/{offer-export-id} | v1.3.0 | link |
GET | /retailer/offers/{offer-id} | v1.1.0 | link |
PUT | /retailer/offers/{offer-id} | v1.0.0 | link |
PUT | /retailer/offers/{offer-id}/price | v1.0.0 | link |
PUT | /retailer/offers/{offer-id}/stock | v1.0.0 | link |
GET | /retailer/orders | v1.0.0 | link |
GET | /retailer/orders/{orders-id} | v1.0.0 | link |
PUT | /retailer/orders/{order-item-id}/cancellation | v1.1.0 | link |
PUT | /retailer/orders/{order-item-id}/shipment | v1.0.0 | link |