Making a payment

During a payment, unless the buyer has enabled and is using an embedded form, the buyer must be redirected to the payment page in order to finalize a purchase.

In order to make a payment, follow the steps below:

  1. Create an order by using the POST method on the ORDER resource.
  2. Fix the order to make the payment using the GET method:
    • either on the URL of the attribute: execute provided in the ORDER links,
    • or on the URL of the execute-embedded attribute in case of a payment by embedded form
  3. In the GET response, retrieve:
    • either the redirection URL, attribute: payment_url,
    • or the form_token in case of a payment by embedded form.
  4. Redirect the buyer to the URL of the payment page or display the embedded form using the form_token.

Step 1

To execute the order, the amount of the commission item must be greater than X% of the order total amount.

The X value is defined on our side for each marketplace and is the minimum percentage required for Lyra Collect to charge these fees.

These fees are deducted from the commission charged by the marketplace.

If the commission is insufficient, an error message is returned and the order is not executed.

For example, for a marketplace where the minimum charge is set at 5% the order below can be executed because the commission amount of the order is well above the required minimum.

Example of a POST ORDER call:

{
  "marketplace": "ebfb36ab-2d30-4326-adb9-e16b0c9a89f3",
  "reference": "MKP BURO example",
  "description": "office supplies order",
  "currency": "EUR",
  "url_return": "https://URLreturn.com",
"items": [
    {
      "seller": "d0f80202-0676-4d8d-9247-f455f30aec1b",
      "reference": "commburo",
      "description": "commission BURO",
      "amount": 150,
      "is_commission": true
    },
    {
      "seller": "5d0ef88c-3345-4b33-948e-80e23d553b73",
      "reference": "STB1",
      "description": "blue pens
      "amount": 1000,
      "is_commission": false
    }
  ],
  "buyer": {
    "type": "PRIVATE",
    "email": "jean.dupont@example.com",
    "phone_number": "33 (0)1 11 22 33 44",
    "reference": "ZhIsYM"
  },
  "shipping": {
    "shipping_method": "RELAY_POINT"
  }
}

Example of a POST ORDER response :
{
  "uuid": "1a2b51f8-9d62-408f-ab39-aa8e28ab15f0",
  "href": "https://secure.lyra.com/marketplace/orders/1a2b51f8-9d62-408f-ab39-aa8e28ab15f0",
"created_at": "2019-01-21T16:46:46.517000Z",
  "updated_at": "2019-01-21T16:46:46.517000Z",
  "marketplace": "ebfb36ab-2d30-4326-adb9-e16b0c9a89f3",
  "reference": "MKP BURO example",
  "description": "Office supplies order",
  "alias": null,
  "buyer": [
    {
      "reference": "ZhIsYM",
      "title": null,
      "type": "PRIVATE",
      "first_name": null,
      "last_name": null,
      "legal_name": null,
      "phone_number": "33 (0)1 11 22 33 44",
      "email": "jean.dupont@acheteur.fr",
      "address": null
    }
  ],
  "shipping": [
    {
      "shipping_method": "RELAY_POINT",
      "delivery_company_name": null,
      "shipping_speed": null,
      "shipping_delay": null,
      "type": null,
      "first_name": null,
      "last_name": null,
      "legal_name": null,
      "phone_number": null,
      "address": null
    }
  ],
  "amount": null,
  "initial_amount": null,
  "currency": "EUR",
  "status": "CREATED",
  "webhook_result": null,
  "url_return": "https://URLreturn.com",
"items": [
    {
      "uuid": "d33ba1ab-793e-4d3d-943f-72b14a1e885b",
      "href": "https://secure.lyra.com/marketplace/items/d33ba1ab-793e-4d3d-943f-72b14a1e885b",
"created_at": "2019-01-21T16:46:46.510000Z",
      "updated_at": "2019-01-21T16:46:46.573000Z",
      "seller": "5d0ef88c-3345-4b33-948e-80e23d553b73",
      "order": "1a2b51f8-9d62-408f-ab39-aa8e28ab15f0",
      "reference": "STB1",
      "description": "blue pens
      "type": "Manager",  
		"amount": 1000,
      "quantity": 1,
      "transfer": null,
      "status": "CREATED",
      "links": null,
      "is_commission": false
    },
    {
      "uuid": "20034374-b425-4beb-91a8-a660ca5a3f9b",
      "href": "https://secure.lyra.com/marketplace/items/20034374-b425-4beb-91a8-a660ca5a3f9b",
"created_at": "2019-01-21T16:46:46.502000Z",
      "updated_at": "2019-01-21T16:46:46.551000Z",
      "seller": "d0f80202-0676-4d8d-9247-f455f30aec1b",
      "order": "1a2b51f8-9d62-408f-ab39-aa8e28ab15f0",
      "reference": "commburo",
      "description": "commission BURO",
      "type": "Manager",  
		"amount": 150,
      "quantity": 1,
      "transfer": null,
      "status": "CREATED",
      "links": null,
      "is_commission": true
    }
  ],
  "links": {
    "items": {
    "href": "https://secure.lyra.com/marketplace/orders/1a2b51f8-9d62-408f-ab39-aa8e28ab15f0/items"
    },
    "refunds": {
    "href": "https://secure.lyra.com/marketplace/orders/1a2b51f8-9d62-408f-ab39-aa8e28ab15f0/refunds"
    },
    "execute": {
    "href": "https://secure.lyra.com/marketplace/orders/1a2b51f8-9d62-408f-ab39-aa8e28ab15f0/execute"
    },
    "execute-embedded": {
    "href": "https://secure.lyra.com/marketplace/orders/1a2b51f8-9d62-408f-ab39-aa8e28ab15f0/execute-embedded"
    }
  },
  "vads_transaction_id": 0,
  "vads_transaction_date": null,
  "expected_capture_date": null,
  "capture_delay": null
}

Step 2

Example of a GET call via redirection to fix the order:

GET
https://secure.lyra.com/marketplaces/marketplace/orders/515abac9-6cb2-4e21-8a25-b08d7e41e43c/execute

Example of a GET response:

{
	'payment_url': 'https://secure.lyra.com/vads-payment/exec.refresh.a;jsessionid=HqKAcpvcgZQA29qCZDjXw4kS.marketplacevad01?cacheId=450272311503195000050'
}						

Example of a GET call via the embedded form to fix the order:

GET https://secure.lyra.com/marketplaces/marketplace/orders/515abac9-6cb2-4e21-8a25b08d7e41e43c/embedded-execute

Example of a GET response:
{"form_token":"fa0yfV2FQuR3aak1SwsgcuZg195eyJhbW91bnQiOjEwOTAwLCJjdXJyZW5jeSI6IkVVUiIsIm
							1vZGUiOiJURVNUIiwidmVyc2lvbiI6Mywib3JkZXJJZCI6IjVjNDk1N2E5LWNkOGEtNGJhZC1hMGNiLTgxMT
							ZiMWE3ZDdmNiIsInNob3BOYW1lIjoiTHlyYSBTTVMiLCJicmFuZFByaW9yaXR5IjpbIkJBTkNPTlRBQ1QiL
							CJDQiIsIkUtQ0FSVEVCTEVVRSIsIk1BU1RFUkNBUkQiLCVGQVVMVCJ9fX0a702"}

Note: the size of the form_token can be up to 8kb