Introduction

---end

All contents of this SDK are availble under the namespace PayoneCommercePlatform\Sdk. The SDK groups the endpoints of every resource into its own client, e.g. the PayoneCommercePlatform\Sdk\ApiClient\CheckoutApiClient can be used to interact with a checkout. To instantiate a singular client a PayoneCommercePlatform\Sdk\CommunicatorConfiguration instance has to provided which at least needs an API Key and Secret to connect to PAYONE Commerce Platform. The reponses and requests as well as their contained objects are provided as PHP classes and enums within the PayoneCommercePlatform\Sdk\Models namespace.

A convenient PHP wrapper around API calls and responses:marshals PHP request objects to HTTP requests
unmarshals HTTP responses to PHP response objects or PHP exceptions
handling of all the details concerning authentication
handling of required metadata


For a general introduction to the API and various checkout flows, see the documentation: - General introduction to the PAYONE Commerce Platform - Overview of the checkout flows - Available payment methods

---end

Requirements

---end

This SDK requires PHP 8.2 or later.

Installation

---end

This SDK is currently not released on packagist. You can install it from GitHub by specifying a vcs repository within your  composer.json :

---end

PHP
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/PAYONE-GmbH/PCP-ServerSDK-php"
    }
  ],
  "require": {
    "payone-gmbh/pcp-serversdk-php": "dev-main"
  }
}

---end

These snippets specify the main branch, which contains the latest release. You can specify a version by inserting a git tag  vX.Y.Z  instead of  main . Make sure to prepend the git branch or tag with  dev- . For an in depth explanation take a look at the Composer documentation.

Setup your configuration

To create a configuration object apiKey and apiSecret are required. You can use CommunicatorConfiguration::getPredefinedHosts() to get information about different environments of the PAYONE Commerce Platform. Currently prod and preprod are available. You should also provide an integrator as a string, this helps us in debugging and monitoring process.

---end

Setup Configuration
<?php

use PayoneCommercePlatform\Sdk\CommunicatorConfiguration;

/** @var CommunicatorConfiguration */
$config = new CommunicatorConfiguration(
        apiKey: getenv('API_KEY'),
        apiSecret: getenv('API_SECRET'),
        host: CommunicatorConfiguration::getPredefinedHosts()['prod']['url'],
        integrator: 'YOUR COMPANY NAME',
);

---end


You shouldn't need to provide serverMetaInfo. This property can automatically be detected. and will send your OS, PHP Version and SDK to the PCP for debugging purposes.

Find more Information under the PHP Documentation