• France
status page
Demo shops
assistance
FAQContact support
Search
Categories
Tags
Europe (English)
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 an invoice payment order

This operation requires the use of the data collection form. Before creating invoice orders in PRODUCTION mode, you must ensure that you have completed the form's settings and requested that it be put online.

Use cases

The merchant creates an invoice payment order, with a unique reference.
To pay, the buyer must enter this unique invoice reference in the data collection form.

Test

Test the Charge/CreatePaymentOrder Web Service via our playground: Charge/CreatePaymentOrder.

Request

Immediate payment

Sample query

Required fields:

  • Amount: €100,00.
  • Distribution channel: INVOICE.
  • Unique invoice reference: "myOrderId-1234".
/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/CreatePaymentOrder
{
    "amount": 10000,
    "currency": "EUR",
    "orderId": "myOrderId-1234",
    "channelOptions": {
      "channelType": "INVOICE"
    }
}
{
    "amount": 200050,
    "currency": "PEN",
    "orderId": "myOrderId-999999",    
    "channelOptions": {
      "channelType": "INVOICE"      
    },
    "paymentReceiptEmail": "sample@example.com",
    "expirationDate": "2020-04-20T20:13:26+02:00",
    "locale": "es_PE",
    "description" : "My custom description"
}
{
    "amount": 200050,
    "currency": "ARS",
    "orderId": "myOrderId-999999",    
    "channelOptions": {
      "channelType": "INVOICE"      
    },
    "paymentReceiptEmail": "sample@example.com",
    "expirationDate": "2020-04-20T20:13:26+02:00",
    "locale": "es_AR",
    "description" : "My custom description"
}
{
    "amount": 200050,
    "currency": "COP",
    "orderId": "myOrderId-999999",   
    "channelOptions": {
      "channelType": "INVOICE"      
    },
    "paymentReceiptEmail": "sample@example.com",
    "expirationDate": "2020-04-20T20:13:26+02:00",
    "locale": "es_CO",
    "description" : "My custom description"
}
/**
 * I initialize the PHP SDK
 */
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/keys.php';
require_once __DIR__ . '/helpers.php';

/** 
 * Initialize the SDK 
 * see keys.php
 */
$client = new Lyra\Client();

/**
 * I create a formToken
 */
$store = array("amount" => 250, 
"currency" => "EUR", 
"orderId" => uniqid("MyOrderId"),
"customer" => array(
  "email" => "sample@example.com"
));
$response = $client->post("V4/Charge/CreatePayment", $store);

/* I check if there are some errors */
if ($response['status'] != 'SUCCESS') {
    /* an error occurs, I throw an exception */
    display_error($response);
    $error = $response['answer'];
    throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] );
}

/* everything is fine, I extract the formToken */
$formToken = $response["answer"]["formToken"];

?>
/**
 * I initialize the PHP SDK
 */
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/keys.php';
require_once __DIR__ . '/helpers.php';

/** 
 * Initialize the SDK 
 * see keys.php
 */
$client = new Lyra\Client();

/**
 * I create a formToken
 */
$store = array("amount" => 250, 
"currency" => "EUR", 
"orderId" => uniqid("MyOrderId"),
"customer" => array(
  "email" => "sample@example.com"
));
$response = $client->post("V4/Charge/CreatePayment", $store);

/* I check if there are some errors */
if ($response['status'] != 'SUCCESS') {
    /* an error occurs, I throw an exception */
    display_error($response);
    $error = $response['answer'];
    throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] );
}

/* everything is fine, I extract the formToken */
$formToken = $response["answer"]["formToken"];

?>

The buyer enters the unique reference: myOrderId-1234 in the data collection form to pay the amount of €100.00.

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

Response

Example of a response
{
    "webService": "Charge/CreatePaymentOrder",    
    "version": "V4",
    "applicationVersion": "5.5.0",
    "status": "SUCCESS",
    "answer": {
        "paymentOrderId": "f95a9c6c2d5a4e3ca279401c4d07c115",
        "paymentURL": null,
        "paymentOrderStatus": "RUNNING",
        "creationDate": "2020-03-31T15:06:49+00:00",
        "updateDate": null,
        "amount": 10000,
        "currency": "EUR",
        "locale": "en_GB",
        "strongAuthentication": "AUTO",
        "orderId": "myOrderId-1234",
        "channelDetails": {
            "channelType": "INVOICE",
            "mailDetails": null,
            "smsDetails":  null,
            "whatsAppDetails": null,
            "ivrDetails": null,
            "_type": "V4/ChannelDetails"
        },
        "paymentReceiptEmail": "sample@example.com",
        "taxRate": null,
        "taxAmount": null,
        "expirationDate": "2020-04-20T18:13:26+00:00",
        "transactionDetails": {
            "cardDetails": {
                "manualValidation": "NO",
                "captureDelay": 0,
                "_type": "V4/CardDetails"
            },
            "_type": "V4/PaymentOrderTransactionDetails"
        },
        "dataCollectionForm": false,
        "merchantComment": null,
        "message": null,
        "description": "My custom description"
        "_type": "V4/PaymentOrder"
    },
    "ticket": null,
    "serverDate": "2020-03-31T15:06:49+00:00",
    "applicationProvider": "LYRA",
    "metadata": null,
    "_type": "V4/WebService/Response"
}


}

Retrouvez la description et l'intégralité des champs dans notre playground : PaymentOrder

Error handling

Error table
Code Description
INT_009 The format of the amount field is invalid or the field is not transmitted.
INT_010 The format of the currency field is invalid or the field is not transmitted.
INT_050 The strongAuthentication parameter is invalid.
INT_856 The locale parameter is invalid.
INT_858 The taxRate parameter is invalid.
INT_869 The taxAmount parameter is invalid.
PSP_519 Unknown currency.
PSP_606 Currency not supported by the MID.
PSP_1007 The expiry date of the payment order cannot be earlier than the current date or exceed 90 days.
PSP_1015 No data collection form for this shop.
PSP_1018 The data collection form cannot be used for the requested currency.

Analysis of payment results

To know the payment result, implement the instant payment notification (also known as IPN).

  1. In the REST API section (TEST or PRODUCTION), enter only the notification URL: Procedure.
  2. Analyze the IPN: Procedure.
Jobs
Legal
GDPR
25.25.0-1.11