• France
status page
Demo shops
assistance
FAQContact support
Search
Categories
Tags
docs.
France
Spain
Europe (English)
India
Homepage
Use cases
Create a payment
Create an installment payment
Create a multi-card (split) payment
Create a payment by Alias (Token)
Create a payment link
Create a recurring payment
Manage subscriptions
Manage your transactions (refund, cancel...)
Analyze your reports
API docs
Embedded Form
REST API
Hosted payment
Mobile payment
File exchange
SDD mandates by REST API
Snippets
Payment methods
Plugins
Marketplace
Guides
Merchant Back Office
Back Office Expert
Functional guides

Creating a token with payment

API documentation: Charge/CreatePayment

Only payment cards are supported. This method does not allow you to create a token from an IBAN.

Request

  1. Automatic token creation.
Sample query

Required fields:

  • amount : 9.90 €.
  • buyer's email: "sample@example.com ".
  • formAction:REGISTER_PAY.

. Recommended fields:

  • Référence de la commande : "myOrderId-1234".
  • Référence de l'acheteur : "myCustomerRef-123456".
/en-EN/rest/V4.0/api/kb/authentication.html
https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.php#L9-L44
https://api.lyra.com/api-payment/V4/Charge/CreatePayment
      {
        "amount": 990,
        "currency": "EUR",
        "customer": {
          "email": "sample@example.com",
          "reference": "myCustomerRef-123456"
        },
        "orderId": "myOrderId-1234"
      }

To view the fields and their description, go to the playground: Charge/CreatePayment (menu on the left).

  1. Offer to the buyer to create a token
Sample query

Required fields:

  • amount : 9.90 €.
  • buyer's email: "sample@example.com ".
  • formAction:ASK_REGISTER_PAY.

. Recommended fields:

  • Référence de la commande : "myOrderId-1234".
  • Référence de l'acheteur : "myCustomerRef-123456".
/en-EN/rest/V4.0/api/kb/authentication.html
https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.php#L9-L44
https://api.lyra.com/api-payment/V4/Charge/CreatePayment
    {
      "amount": 990,
      "currency": "EUR",
      "customer": {
        "email": "sample@example.com",
        "reference": "myCustomerRef-123456"
      },
      "formAction": "ASK_REGISTER_PAY",
      "orderId": "myOrderId-1234"
    }

To view the fields and their description, go to the playground: Charge/CreatePayment (menu on the left).

Response

Récupèrez le formToken pour afficher le formulaire de paiement (Plus d'infos : Afficher le formulaire).

A la fin du paiement, une transaction de type DEBIT sera créée. L'alias sera retourné dans transactions[0].paymentMethodToken (Plus d'infos : Analyser le résultat du paiement)

Example of a response
  {
    "shopId": "123456",
    "orderCycle": "CLOSED",
    "orderStatus": "PAID",
    "serverDate": "2023-10-20T13:53:41+00:00",
    (...)
      "_type": "V4/OrderDetails"
    },
(...)
    "transactions": [
      {
        "shopId": "123456",
        "uuid": "b72e91826ce14bfd802249d16eb30849",
        "amount": 990,
        "currency": "EUR",
        "paymentMethodType": "CARD",
        "paymentMethodToken": "b6e51ba31f934ac5b25ccad2a52ccd56",
        "status": "PAID",
        "detailedStatus": "AUTHORISED",
        "operationType": "DEBIT",
        "effectiveStrongAuthentication": "DISABLED",
       (...)
    "_type": "V4/Payment"
  }

Dans cet exemple, l'alias (champ paymentMethodToken) a pour valeur : "b6e51ba31f934ac5b25ccad2a52ccd56".

For full details and descriptions of the fields, see the playground: answer/Payment.

Jobs
Legal
GDPR
25.18-1.11