Zum Hauptinhalt springen

Installation

Pull the composer package:

composer require fynn-digital/sdk-php

Obtain an API key

You can obtain an API key by visiting the settings page "Einstellungen > Berechtigungen" of your tenant. Then you can create a new API key by clicking on the "API-Key hinzufügen" button.:

API key

Obtain an API username

The API username is provided by Fynn on your registration. If you don't know your API username, please ask your contact person for the API username.

Setup

Once you have installed the package, you need to setup the SDK. This is done by creating a new client instance by the Fynn\Sdk\V1\Api\ClientFactory class. Production and sandbox environments are supported. Default environment is sandbox. You can do this by passing the API key and the API username to the constructor:

<?php

$client = ClientFactory::create('pk_live_xxx', 'api-username', 'production');

Usage

The SDK provides a set of services that can be used to interact with the Fynn API. The services are grouped by their functionality and need to be instantiated by themselves, e.g:

<?php
use Fynn\Sdk\V1\Subscription\SubscriptionService;
use Fynn\Sdk\V1\Checkout\CartService;

$subscriptionService = new SubscriptionService($client);
$cartService = new CartService($client);

🎉 You are now ready to use the SDK! 🎉