Example implementations

Unzer API PHP SDK is provided with example payment integrations

Activate the examples

To enable the examples:

  1. Navigate to the examples folder, open the _enableExamples.php file, and change the constant UNZER_PAPI_EXAMPLES from false to true. You should disable it again as soon as you launch your application.
  2. You may need to adapt the constant UNZER_PAPI_FOLDER to match the your folder structure. for example, define('UNZER_PAPI_FOLDER', '/sdk-test/vendor/unzerdev/php-sdk/examples/');
  3. Set the keypair constants UNZER_PAPI_PRIVATE_KEY and UNZER_PAPI_PUBLIC_KEY to valid values. To learn more how you can get a valid keypair or use your own sandbox keys, go to the Getting started section.

Use the examples

To use the examples go to the examples folder, for example https://my-server.de/sdk-test/vendor/unzerdev/php-sdk/examples/ and choose the payment method you want to try out.

The examples provide a generic handler examples\\ReturnController.php that shows the handling of the initial transactions of most payment types in one place.