Analyzing the payment result

The Marketplace server is notified via a webhook about each change in the statuses of the Order and Token objects.

The webhook is sent to the address specified by the marketplace during the integration phase.

This URL can be found in the "webhook_url” attribute of the Marketplace object.

The webhook is sent in POST with the "Content-Type: application/json” header.

Example of a notification (webhook)
{'order':'515abac9-6cb2-4e21-8a25-b08d7e41e43c'}

In PHP, this JSON can be retrieved using the following code:

$json = file_get_contents('php://input');
$data = json_decode($json);
$orderUuid = $data->order ?? false;

After that, the Marketplace has to call the GET ORDER (or TOKEN) resource with the transmitted UUID in order to know the new status of the object en question.

Example of a GET ORDER call

GET https://secure.lyra.com/marketplace/orders515abac9-6cb2-4e21-8a25-b08d7e41e43c/

Example of a GET ORDER response

{
     "uuid": "515abac9-6cb2-4e21-8a25-b08d7e41e43c",
     "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c",
     "created_at": "2015-03-19T16:30:14.434Z",
     "updated_at": "2015-03-19T16:30:14.434Z",
     "marketplace": "9537e049-8862-400a-ae8d-da2ec9ca6051",
     "reference": "cmd00052",
     "description": "Order",
     "buyer":[{
          "reference": "nope775",
          "title": "Mr",
          "type": “PRIVATE",
          "first_name": “Jane",
          "last_name": “Smith",
          "phone_number": “02 13 06 95 27",
          "email": "jsmith@tiscali.fr",
          "address": {
               "street_number": "29",
               "street": "rue Besnard",
               "district": "Île-de-France",
               "zipcode": "83819",
               "city": "Roux",
               "state": "Hautes-Pyrénées",
               "country": "FR"}
          }],
     "shipping":[ {
          "delivery_company_name": "DHL",
          "address": {
               "street_number": "493",
               "street": "avenue Duhamel",
               "district": "Saint-Martin",
               "zipcode": "33980",
               "city": "Hamon",
               "state": "Charente-Maritime",
               "country": "FR"},
          "shipping_speed": "EXPRESS",
          "shipping_method": "ETICKET",
          "type": “PRIVATE",
          "first_name": "John",
          "last_name": “Brown",
          "phone_number": “+33 (0)1 46 05 15 89"
	}],
     "amount": null,
     "currency": "EUR",
     "status": "CREATED",
     "webhook_result": 200,
     "url_return": "http://www.lyra-sms.com/",
     "links": {
          "items": {
               "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/items"},
          "transactions": {
               "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/transactions"},
          "refunds": {
               "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/refunds"},
          "execute":{
               "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/execute"},
          "execute-embedded": {
               "href": "https://secure.lyra.com/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/execute-embedded"}
     },
     "vads_transaction_id": 500003,
     "vads_transaction_date": ""	
}		

In case of any doubts concerning the transmission or the reception of the webhook, you can check the "webhook_result" attribute of the resource in question. This attribute contains the "status code" of the HTTP query made by our server. For example,

  • If it is null, the webhook has not (yet) been sent.
  • If it shows 200, the webhook should have reached you.
  • If it shows 404, we invite you to check the address that you specified.
  • etc.

Note:

The transaction authorization code is recorded in the auto_code attribute returned by the transaction result (accessible via the GET Transaction resource (see Transaction object).