/easydaraz

A package to make API endpoint calls to daraz e-commerce site for sellers.

Primary LanguagePHP

EasyDaraz

This is a package created to make api endpoint calls to Daraz e-commerce site for sellers.

How to initiate?

  1. Git Clone the repository
  2. Update the Composer
  3. Use these in your file
     require_once(dirname(__FILE__) . '/vendor/autoload.php');
     require_once(dirname(__FILE__) . '/src/Daraz.php');
     use daraz\easydaraz\Daraz;
  4. Define following variables in your code.
    $apiKey = 'Your Daraz API-Key';
    $userId = 'Your E-mail';
    $url = 'Your Daraz API URL';
  5. Instantiate the class
    • $daraz = new Daraz($userId, $apiKey, $url);

Available API Endpoints

Use these calls to get required results. Get complete information on Daraz API here.

  1. getSeller() - To get seller information by the current user ID.

  2. getCategoryTree() - Retrieve the list of all product categories in the system.

  3. getCategoryAttributes() - Get a list of attributes with options for a given category.

  4. getBrands() - Retrieve all product brands in the system.

  5. createProduct() - Create a product (use an array of attributes).

  6. updateProduct() - Update attributes or SKUs of an existing product. One request can update only 1 product.

  7. uploadImage() - To upload a single image file and accept binary stream with file content.

  8. migrateImage() - To migrate a single image from an external site to Daraz site (Response provides migrated Image URLs).

  9. migrateImages() - To migrate multiple images from an external site to Daraz site (This call's response doesn't provide migrated image URLs).

  10. getResponse() - To get the returned information from the system for the UploadImages and MigrateImages API

  11. getAllProducts() - Get all or a range of products.

  12. getProducts() - To get all or a range of products.

  13. setImages() - To set the images for an existing product by associating one or more image URLs with it.

  14. updatePriceQuantity() - To update the price and quantity of one or more existing products.

  15. getOrder() - To get the order details for a single order.

  16. getOrders() - To get the customer details for a range of orders.

  17. getOrderItems() - To get the item information of one or more orders.

  18. getMultipleOrderItems() - To get the item information of one or more orders.

  19. setInvoiceNumber() - To set the invoice access key.

  20. setStatusToPackedByMarketplace() - To mark order items as being packed.

  21. setStatusToReadyToShip() - To mark an order item as being ready to ship.

  22. getDocument() - To retrieve order-related documents, including invoices, shipping labels, and shipping parcels.

  23. getFailureReasons() - To get additional error context for SetStatusToCanceled.

  24. setStatusToCanceled() - To cancel a single item.

  25. getQCStatus() - To get the quality control status of items being listed.

  26. getPayoutStatus() - To get the payout status for a specified period.

  27. getTransactionDetails() - To get transaction or fee details for a specified period.

Example Array

$addProductArray = [
    'Product' => [
                'PrimaryCategory' => '9098',
                'SPUId' => '',
                'AssociatedSku' => '',
                'Attributes' => [
                    'name' => 'T-800 Terminator',
                    'short_description' => 'Premium Skynet Product',
                    'brand' => 'Skynet',
                    'model' => '',
                ],
                'Skus' => [
                    'Sku' => [
                        'SellerSku' => 'sudo_T800_init',
                        'color_family' => 'Black',
                        'quantity' => '1000',
                        'price' => '20000',
                        'package_length' => '10',
                        'package_height' => '10',
                        'package_width' => '10',
                        'package_weight' => '1',
                        'package_content' => '',
                        'Images' => [
                            'Image' => [
                                "https://static-01.daraz.lk/p/8ef1381b408720516321407d91bd2a8f.jpg",
                            ]
                        ],
                    ],
                ],
            ],
];