Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

centrahq/ingrid-checkout-siw-client-v2

Repository files navigation

Ingrid Delivery Checkout v2 [OpenAPIClient-php]

Delivery Checkout provides almost unlimited flexibility in selecting delivery options while securing that the process is as convenient and as fast as it physically can. ⚡

Generate API Client

$ openapi-generator generate \
      -i https://api.ingrid.com/v1/siw/_/swagger.json \
      -g php \
      -o siw

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: Bearer
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new OpenAPI\Client\Api\DefaultApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$body = new \OpenAPI\Client\Model\CompleteSessionRequest(); // \OpenAPI\Client\Model\CompleteSessionRequest

try {
    $result = $apiInstance->siwCompleteSession($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->siwCompleteSession: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to /v1/siw

Class Method HTTP request Description
DefaultApi siwCompleteSession POST /session.complete When the customer completes the purchase you also need to complete the session. At this point you will have to supply us with the address and the contact details of the user.
DefaultApi siwCreateSession POST /session.create To add the Ingrid widget to the checkout page you will need to create a new session. This can be done by this call. When doing this you will need to provide some required information.
DefaultApi siwCreateSessionFromOrder POST /session.createFromOrder Creates a session from an already existing order.
DefaultApi siwGetSession GET /session.get Fetches a session by ID. Can be used for loading a previously created session that have been stored together with a customer's shopping cart from a previous visit.
DefaultApi siwListSessionsSummaries GET /sessions_summaries.list Allows the user to get shipping data (session IDs and result fields) associated with tos ID.
DefaultApi siwUpdateSession POST /session.update Update the session with new information. Useful for cases where the customer or cart information is changed. The later being the most common case.

Models

Authorization

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen