One-click payment
This mode allows you to create a transaction from an alias. Thanks to the alias, the buyer does not need to re-enter their bank card number.
Prerequisites: create a token
- For more information: Token creation.
Using a token
Request
Sample query
Required fields:
amount : 9.90 €.
alias : champ ,
paymentMethodToken
,= "b6e51ba31f934ac5b25ccad2a52ccd56
,".
/doc/en-EN/rest/V4.0/api/kb/authentication.html
https://github.com/lyra/rest-php-examples/blob/master/www/minimalEmbeddedForm.token.usage.php#L9-L44
https://api.scelliuspaiement.labanquepostale.fr/api-payment/V4/Charge/CreatePayment
{ "amount": 990, "currency": "EUR", "paymentMethodToken": "b6e51ba31f934ac5b25ccad2a52ccd56" }
/** * 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(); /** * create a transaction with a payment method token */ $store = array( "amount" => 250, "currency" => "EUR", "paymentMethodToken" => "b6e51ba31f934ac5b25ccad2a52ccd56" ); /** * do the web-service call */ $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'] ); } ?>
Response
Récupèrez le formToken
pour afficher le formulaire de paiement (Plus d'infos : Afficher le formulaire).
Analysez le résultat du paiement (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" }
For full details and descriptions of the fields, see the playground: answer/Payment.