Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The token has already been used #19

Closed
CristianFranco opened this issue Aug 8, 2017 · 2 comments
Closed

The token has already been used #19

CristianFranco opened this issue Aug 8, 2017 · 2 comments

Comments

@CristianFranco
Copy link

Hi! i have a problem when a make a charge,this show me this error:

"The token has already been used"
"La tarjeta no pudo ser procesada"

when i do this with a test token this works fine but when i do it with another token this don´t work, this is my implementation.

    bool band = true;
    Order order;
    Expression<Func<Usuario, bool>> exp = (x) => x.IdUsuario == IdUsuario;
    UsuarioLoader uLoader = new UsuarioLoader();
    var usuario = uLoader.GetElementByProperty(exp);
    try
    {
        
        order = new conekta.Order().create(@"{
          ""currency"":""MXN"",
          ""customer_info"": {
            ""customer_id"": """+usuario.TokenConekta+@""" 
          },
          ""line_items"": [{
            ""name"": ""Cobro Union"",
            ""unit_price"": 1000,
            ""quantity"": 1
          }],
          ""charges"": [{
            ""payment_method"": {
               ""type"": ""card"",
                ""token_id"": """+tokenTarjeta+@"""
            },""amount"":1000
          }]
        }");

    }
    catch (ConektaException e)
    {
        band = false;
        foreach (JObject obj in e.details)
        {
            System.Console.WriteLine("\n [ERROR]:\n");
            System.Console.WriteLine("message:\t" + obj.GetValue("message"));
            System.Console.WriteLine("debug:\t" + obj.GetValue("debug_message"));
            System.Console.WriteLine("code:\t" + obj.GetValue("code"));
        }
    }
@edenriquez
Copy link
Contributor

edenriquez commented Aug 9, 2017

@CristianFranco Te recomendamos seguir la documentación, y revises los parametros que ingresas a una orden. Un token es un digesto que nosotros realizamos con base a los datos de la tarjeta del usuario esos datos se envían al api y regresa dicho token, recuerda hacer pruebas con una tarjeta valida, posiblemente la tarjeta que estas usando, alguien ya la tokenizo y por eso regresa ese error de parte del api

@CristianFranco
Copy link
Author

aaok gracias! mi error era que usaba el token_id y yo necesitaba el source_payment_id, gracias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants