ON-DEMAND TOKENIZATION BRINGS THE ABILITY TO ENTER A CREDIT CARD JUST ONCE AND BE ABLE TO USE IT AGAIN SEVERAL TIMES.
As we have mentioned in past sections, tokens tok_xxxx can only be used once, in order to be able to use them multiple times it is necessary to use this token to generate a token crd_xxxxx
Pre-requisites
Creation and retrieve of a client
Process
1. Create a token tok_xxxxx to do this task you can refer to the javascript tokenization guide.
2. Retrieve the token cus_xxxx from the client to which you are going to assign the on-demand token
3. Import Sr Pago.php class
using SrPagoApi; using SrPagoApi.Response; SrPago.ApiKey = "APPLICATION KEY"; SrPago.ApiSecret = "APPLICATION SECRET"; SrPago.LiveMode = false;
4. Call the method addCardToCustomer
CustomerService customerService = new CustomerService(); CustomerCardResponse customerCard = await customerService.PostCustomerCard(<token de tipo tok_xxxx>, <token de tipo cus_xxxx>);
This method will return an array with a token crd_xxxxxx, this token can be used multiple times to make a better user experience.