• 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

Step 4: Display the payment form

Objective

  • Display all payment fields (card number, expiration date, CVV, etc.) on your website.

I. Initialize the payment form

In the HEAD of the page, you must include the following data in a <script> tag.

  1. Load our JavaScript library

It is imperative for the main library to be loaded very early on, well before the other JS libraries used on your page.

src="https://static.lyra.com/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js"
  1. Implement the public key.

Set the public key in the parameter kr-public-key

<head>
(...)
<script type="text/javascript"
        (...)
        kr-public-key="69876357:testpublickey_DEMOPUBLICKEY95me92597fd28tGD4r5"
        (...)
 </script>
(...)
 </head>

As a reminder, it corresponds to the 3 rd key of the table.

  1. Add more initialization parameters.
  • Add 2 initialization parameters , for example:
name Description
kr-post-url-success URL to which the buyer's browser is redirected in case of a successful payment. ( recommended )
kr-language Defines the language in which the form will be displayed. Accepts ISO 639-1 (en or en-US). If the parameter is not defined, the form uses the language of the browser.

. Code sample:

<head>
(...)
<script type="text/javascript"
        src="https://static.lyra.com/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js"
        kr-public-key="69876357:testpublickey_DEMOPUBLICKEY95me92597fd28tGD4r5"
        kr-post-url-success="paid.php";
        kr-language="en-EN">
 </script>
(...)
 </head>

Référez vous à ces 2 rubriques Paramètres généraux et Paramètres de personnalisation des "placeholders" pour connaître les autres paramètres. Après la balise <script>, choisissez un thème.

  1. Choose a theme.

Classic is the default theme. Here are the links to load this theme.

<head>
(...)
<link rel="stylesheet" href="https://static.lyra.com/static/js/krypton-client/V4.0/ext/classic.css">
  <script
  src="https://static.lyra.com/static/js/krypton-client/V4.0/ext/classic.js">
 </script>
 (...)
 </head>

More info on themes.

  1. Adding JS functions ( optional ):
  • In another <script> tag, you can integrate events or JS methods.

  • For more details, Event presentation and Method presentation.

Example code for the HEAD without JS function:

<head>
<!-- STEP :
1 : load the JS librairy 
2 : required public key with file config.php
3 : the JS parameters url sucess and langage EN  -->

<script type="text/javascript"
        src="https://static.lyra.com/static/js/krypton-client/V4.0/stable/kr-payment-form.min.js"
        kr-public-key="69876357:testpublickey_DEMOPUBLICKEY95me92597fd28tGD4r5"
        kr-post-url-success="paid.php";
        kr-language="en-EN">
 </script>

  <!--  theme CLASSIC should be loaded in the HEAD section   -->
<link rel="stylesheet" href="https://static.lyra.com/static/js/krypton-client/V4.0/ext/classic-reset.min.css">
<script src="https://static.lyra.com/static/js/krypton-client/V4.0/ext/classic.js">
 </script>
 </head>

II. Define the display mode

In the BODY, choose the display mode that suits you.

Mode Description
embedded Displays the fields of card payment (card number, expiry date, CVV, etc.)
pop-in Displays a payment button that opens a pop-up window containing the payment fields (card number, expiry date, CVV, etc.).
Embedded mode Pop-in mode
<body>
        <div class="kr-embedded" kr-form-token="[GENERATED FORMTOKEN]"></div>
        (...)
</body>
<body>
        <div class="kr-embedded" kr-popin kr-form-token="[GENERATED FORMTOKEN]"></div>
        (...)
</body>
More info: Embedded Mode More info: Pop-in mode

III. Advanced customization

This step is optional.

Example of customization :

  • Customize the "Pay" button ;
  • Personalization of the page layout for the embedded form ;

IV. Simplified example in PHP

In the sample folder, the sample files are:

  1. embedded.php.
  2. popin.php.

To get more details, Example files: embedded.php and popin.php

NEXT STEP N°5

Jobs
Legal
GDPR
25.18-1.11