Rapid testing

This page provides a quick overview of how to create a transaction with our REST API.

Preparing your environment

If you use PHP with our SDK, we recommend to store your keys in a configuration file.

Example with test keys:

<?php
/**
 * Get the client
 */
require_once __DIR__ . '/vendor/autoload.php';

/**
 * Define configuration
 */

/* Username, password and endpoint used for server to server web-service calls */
Lyra\Client::setDefaultUsername("69876357");
Lyra\Client::setDefaultPassword("testpassword_DEMOPRIVATEKEY23G4475zXZQ2UA5x7M");
Lyra\Client::setDefaultEndpoint("https://api.payzen.eu");

Do not forget to replace them with your personal keys.

For more information, see Server SDKs and Prerequisites

Making a call

In order to test your integration, you can use the Charge/SDKTest RESTful Web Service:

{
    "value": "my testing value"
}
/** 
 * Initialize the SDK 
 * Please update your keys in keys.php
 */
$client = new Lyra\Client();  

/**
 * I send test data
 */
$store = array("value" => "my testing value");
$response = $client->post("V4/Charge/SDKTest", $store);

For more information on authentication during the call to the RESTful Web Service, go to: REST API: authentication phase.

The response

The full response will be:

{
    "webService":"Charge/SDKTest",
    "version":"V4",
    "applicationVersion":"4.1.2",
    "status":"SUCCESS",
    "answer": {
        "value":"my testing value",
        "_type":"V4/Type/String"
    },
    "ticket":null,
    "serverDate":"2018-10-02T16:13:57+00:00",
    "applicationProvider":"PAYZEN",
    "metadata":null,
    "_type":"V4/WebService/Response"
}

The response data can be found in the answer property:

{
    "value":"my testing value",
    "_type":"V4/Type/String"
}

You can use our interactive playground to learn more about our Web Services.

For more information on the RESTful Web Service specifications, go to: Functioning of the API