3

Estoy tratando de integrar la pasarela de pago a mi servicio en android pero al momento de ingresar EXTRA_PAYPAL_CONFIGURATION en mi codigo me aparece como si no existiera:

intent.putExtra(PaymentActivity.EXTRA_PAYPAL_CONFIGURATION,m_configuration);

¿alguien sabe como lo puedo solucionar o con que lo puedo reemplazar?

1
  • Agrega tu código completo, PaymentActivity extiende de que clase?
    – Jorgesys
    el 11 ago. 2017 a las 19:24

1 respuesta 1

3

Estas accediendo a un Campo que no se tiene en la Activity (PaymentActivity), la cual no creo que extienda de PayPalService.

intent.putExtra(PaymentActivity.EXTRA_PAYPAL_CONFIGURATION,m_configuration);

EXTRA_PAYPAL_CONFIGURATION es un campo del Servicio.

intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, m_configuration);

Para la implementación te sugiero veas este ejemplo:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_paypal);

        DisplayMetrics metrics = new DisplayMetrics();
         getWindowManager().getDefaultDisplay().getMetrics(metrics);

        getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff")));
        getSupportActionBar().setDisplayShowTitleEnabled(false);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        Intent intent = new Intent(this, PayPalService.class);
        intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
        startService(intent);

        Log.e(TAG, "Alert Dialog");

        new AlertDialog.Builder(this)
        .setTitle("Notice")
        .setMessage(this.getString(R.string.disclaimer))
        .setCancelable(false)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setPositiveButton("Ok, I understand", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();

                PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);
                Intent intent = new Intent(PaypalActivity.this, PaymentActivity.class);

                intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);

                startActivityForResult(intent, REQUEST_CODE_PAYMENT);

            }

        })
       .setNegativeButton("Nevermind", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                PaypalActivity.this.finish();
            }
        })
        .show();
    }

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.