Creating a token
It is possible to request the recording of the payment method (and, therefore, the token creation) without it being linked to an order.
For this, you need to call the TOKEN API to create a token, with a query similar to the one used for creating a payment.
Create a token using the payment page
POST /tokens/
Example:
Request
POST https://secure.lyra.com/marketplace/tokens/
Body
{ "marketplace": "9537e049-8862-400a-ae8d-da2ec9ca6051", "url_return": "http://www.my-website.com/", "buyer": { "type": "PRIVATE", "first_name": "Jean", "last_name": "Dupond", "email": "jean.dupond@lyra.fr", "phone_number": "1234", "reference": "Acheteur_1", "address": { "zipcode": "59259", "street_number": "37", "country": "FR", "street": "rue Marcel Philippe", "city": "Vignoux" } } }
Response
{ "token": "d3329266-c8d6-421c-8d2a-10a8ffbcaef6", "payment_url": "https://secure.lyra.com/vads-payment/exec.refresh.a;jsessionid=335D2aDb5eF8356Aed2cf3dF.vadpayment02inte01lbg?cacheId=913355311811276000040" }
Once the token has been created, the Buyer must be redirected to the URL transmitted in payment_url in order to proceed to payment method recording (and, therefore, to creating an alias).
Create a token using the embedded form
POST /tokens/embedded/
Example:
Request
POST https://secure.lyra.com/marketplace/tokens/embedded/
Body
{ "marketplace": "9537e049-8862-400a-ae8d-da2ec9ca6051", "url_return": "http://www.my-website.com/", "buyer": { "type": "PRIVATE", "first_name": "Jean", "last_name": "Dupond", "email": "jean.dupond@lyra.fr", "phone_number": "1234", "reference": "Acheteur_1", "address": { "zipcode": "59259", "street_number": "37", "country": "FR", "street": "rue Marcel Philippe", "city": "Vignoux" } } }
Response
{ "token": "d3329266-c8d6-421c-8d2a-10a8ffbcaef6", "form_token":"fa0yfV2FQuR3aak1SwsgcuZg195eyJhbW91bnQiOjEwOTAwLCJjdXJyZW5jeSI6IkVVUiIsIm 1vZGUiOiJURVNUIiwidmVyc2lvbiI6Mywib3JkZXJJZCI6IjVjNDk1N2E5LWNkOGEtNGJhZC1hMGNiLTgxMT ZiMWE3ZDdmNiIsInNob3BOYW1lIjoiTHlyYSBTTVMiLCJicmFuZFByaW9yaXR5IjpbIkJBTkNPTlRBQ1QiL CJDQiIsIkUtQ0FSVEVCTEVVRSIsIk1BU1RFUkNBUkQiLCVGQVVMVCJ9fX0a702" }
Once the token is created, the form_token must be inserted in the form (kr-form-token) attribute) to proceed to payment method recording (and, therefore, to creating an alias).