Creating a SVI payment order
Test the Charge/CreatePaymentOrder web service using our playground: Charge/CreatePaymentOrder.
Request
PARAMETER | required | Description |
---|---|---|
channelOptions.channelType | YES | Parameter to define the channel for issuing the payment order. Must be set to IVR. |
channelOptions.ivrOptions | YES | A JSON object for defining the parameters specific to creating an IVR payment order. |
channelOptions.ivrOptions.ivrPaymentOrderId | No | This field is normally filled in automatically by the platform. If the merchant has specific functional constraints, this field can exceptionally be overloaded with its own numerical reference, guaranteeing its uniqueness. |
expirationDate | No | Validity date of the order in ISO-8601 format. Cannot be earlier than the current date and cannot exceed 90 days. If this parameter is not sent, the value applied de shop default value will be used. Ex : 2021-10-05T21:59:59+00:00 |
merchantComment | No | Optional comment for the user of theIdentifiant utilisateur source , or by viewing the columnInformations utilisateur . |
amount | YES | Amount to be paid, expressed in its smallest currency unit (cent for euro). |
currency | YES | Currency of payment. ISO 4217 alpha-3 code. Ex: "EUR" for euro. |
orderId | YES | Order reference. |
taxAmount | No | Amount of taxes for the entire order, expressed in its smallest monetary unit (cent for euro). |
taxRate | No | Tax rate applied to the entire order. The value must be the applied percentage (21 for 21%). |
transactionOptions.cardOptions.manualValidation | No | Specifies whether the transaction is validated manually.Possible values: "YES" or "NO". |
transactionOptions.cardOptions.captureDelay | No | Indicates the delay (in days) before the bank capture. |
paymentReceiptEmail | No | The e-mail address that will be used for sending the payment ticket to the buyer. Requires the activation of the “Payment confirmation e-mail sent to the buyer” notification rule. |
customer | No | Object containing buyer's data. |
metadata | No | Custom values linked to the transaction, in JSON format. |
Sample query
/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": 200050, "currency": "EUR", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "IVR" }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00" }
{ "amount": 200050, "currency": "EUR", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "IVR" }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00" }
{ "amount": 200050, "currency": "ARS", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "IVR" }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00" }
{ "amount": 200050, "currency": "COP", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "IVR" }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00" }
{ "amount": 200050, "currency": "EUR", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "IVR" }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00" }
/** * 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"]; ?>
Response
The answer object will contain the parameters below:
PARAMETER | Description |
---|---|
paymentOrderId | Payment order ID. |
paymentOrderStatus | Status of the payment order. |
creationDate | Date and time of payment order creation. |
updateDate | Date and time of payment order update. |
channelDetails.channelType | Distribution channel of the payment order. |
channelDetails.ivrDetails.ivrPaymentOrderId | Payment order reference in the IVS. |
amount | Amount payable, expressed in the smallest monetary unit. |
currency | Payment currency.ISO 4217 alpha-3 code. |
orderId | Order reference. |
paymentReceiptEmail | E-mail address that will be used to send the payment receipt to the buyer. |
taxAmount | Amount of taxes for the entire order, expressed in its smallest monetary unit. |
taxRate | Tax rate applied to the entire order. |
expirationDate | Expiry date of the order in ISO-8601 format. |
merchantComment | Optional comment. |
transactionDetails.cardDetails.manualValidation | Transaction validation mode. |
transactionDetails.cardDetails.captureDelay | Capture delay. |
customer | Object containing buyer's data. |
metadata | Custom values linked to the transaction, in JSON format. |
Example of a response
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": null, "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "en_GB", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "IVR", "mailDetails": null, "smsDetails": null, "whatsAppDetails": null, "ivrDetails": { "ivrPaymentOrderId": "0123", "_type": "V4/IVRDetails" } "_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, "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" } }
Error handling
The Charge/createPaymentOrder web service will return an error in the following cases:
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_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. |