Example Implementations

Activate the examples

In order to enable the examples do the following:

  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 Keypair section.

Use the examples

In order to use the examples go to the examples folder e. g. 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’ which shows the handling of the initial transactions of most payment types in one place.