Android - Problema con stripe

 
Vista:

Problema con stripe

Publicado por Daniel (6 intervenciones) el 23/05/2017 23:47:41
Hola amigos he tenido un pequeño problema con la integracion de stripe que me esta volviendo un poco desesperado no se que puedo hacer el error es el siguiente
1
2
3
4
5
Error:(391, 13) error: no suitable constructor found for Stripe(no arguments)
constructor Stripe.Stripe(Context) is not applicable
(actual and formal argument lists differ in length)
constructor Stripe.Stripe(Context,String) is not applicable
(actual and formal argument lists differ in length)


el codigo fuente del error es este
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public void saveCreditCard() {
 
        Card card = new Card(etCreditCardNum.getText().toString(),
                Integer.parseInt(etMonth.getText().toString()),
                Integer.parseInt(etYear.getText().toString()), etCvc.getText()
                .toString());
 
        boolean validation = card.validateCard();
        if (validation) {
            AndyUtils.showCustomProgressDialog(activity,
                    getString(R.string.adding_payment), false, null);
            new Stripe().createToken(card, Const.PUBLISHABLE_KEY,
                    new TokenCallback() {
                        public void onSuccess(Token token) {
                            // getTokenList().addToList(token);
                            // AndyUtils.showToast(token.getId(), activity);
                            String lastFour = etCreditCardNum.getText()
                                    .toString();
                            lastFour = lastFour.substring(lastFour.length() - 4);
                            addCard(token.getId(), lastFour);
                            // finishProgress();
                        }

MIL GRACIAS si pueden ayudarme
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Problema con stripe

Publicado por Antonio (1 intervención) el 25/05/2017 13:56:07
Hola Daniel, tal y como dice el error tienes que pasar los argumentos, aquí tienes la solución:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Stripe stripe = new Stripe(mContext, "pk_test_6pRNASCoBOKtIshFeQd4XMUh");
stripe.createToken(
  card,
  new TokenCallback() {
    public void onSuccess(Token token) {
      // Send token to your server
    }
    public void onError(Exception error) {
      // Show localized error message
      Toast.makeText(getContext(),
        error.getLocalizedString(getContext()),
        Toast.LENGTH_LONG
      ).show();
    }
  }
)

https://stackoverflow.com/questions/42920356/stripe-android-error-no-suitable-constructor
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar