page overview docs developer apps application android paypal paypal-sandbox paypal-adaptive-payments
MPL

android - overview - paypal split



Ejemplo de Paypal MPL para Android y Pizza "AplicaciĆ³n no autorizada, Error ID-1" (0)

Descargué esta biblioteca: MPL

Descargué este ejemplo: PizzaMPL

Creé una cuenta de espacio aislado y varias cuentas personales y comerciales.

Puedo ver perfectamente las credenciales y la firma de la API (¿no necesito las credenciales de la API para probar en SANDBOX?) En caso afirmativo, ¿dónde debo ingresar mi código? El documento dice que "Además de las credenciales de la API, las llamadas MPL también requieren un ID de aplicación. Para el banco de pruebas de PayPal, el ID de aplicación es estático:" APP-80W284485P519543T "" ¿Además?

Ahora, en el entorno SANDBOX, cuando doy el botón "pagar con paypal", el código obtenido en PayPalActivityResult (int requestCode, int resultCode, Intent intennt) es: PayPal.FAILURE y el mensaje que se muestra es: "Aplicación no autorizada, ID de error -1 "

No he podido encontrar este error en la maravillosa documentación de PayPal.

Aquí mi código:

public void initLibrary() { PayPal pp = PayPal.getInstance(); if (pp == null) { pp = PayPal.initWithAppID(this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX); pp.setLanguage("en_US"); pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); pp.setShippingEnabled(true); pp.setDynamicAmountCalculationEnabled(false); _paypalLibraryInit = true; } } private void showPayPalButton() { // Generate the PayPal checkout button and save it for later use PayPal pp = PayPal.getInstance(); CheckoutButton launchPayPalButton = pp.getCheckoutButton(this, PayPal.BUTTON_278x43, CheckoutButton.TEXT_PAY); // The OnClick listener for the checkout button launchPayPalButton.setOnClickListener(this); // Add the listener to the layout RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.bottomMargin = 10; launchPayPalButton.setLayoutParams(params); launchPayPalButton.setId(12345); ((LinearLayout) findViewById(R.id.wrapper)).addView(launchPayPalButton); ((LinearLayout) findViewById(R.id.wrapper)).setGravity(Gravity.CENTER_HORIZONTAL); } public void PayPalButtonClick(View arg0) { // Create a basic PayPal payment PayPalPayment payment = new PayPalPayment(); payment.setCurrencyType("USD"); payment.setRecipient("[email protected]"); payment.setSubtotal(new BigDecimal(200.0f)); payment.setPaymentType(PayPal.PAYMENT_TYPE_PERSONAL); payment.setMerchantName("Discográfica XXX"); Intent paypalIntent = PayPal.getInstance().checkout(payment, this); this.startActivityForResult(paypalIntent, 1); } public void PayPalActivityResult(int requestCode, int resultCode, Intent intent) { switch (resultCode) { case Activity.RESULT_OK: // The payment succeeded String payKey = intent .getStringExtra(PayPalActivity.EXTRA_PAY_KEY); this.paymentSucceeded(payKey); break; case Activity.RESULT_CANCELED: // The payment was canceled this.paymentCanceled(); break; case PayPalActivity.RESULT_FAILURE: // The payment failed -- we get the error from the // EXTRA_ERROR_ID and EXTRA_ERROR_MESSAGE String errorID = intent .getStringExtra(PayPalActivity.EXTRA_ERROR_ID); String errorMessage = intent .getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE); this.paymentFailed(errorID, errorMessage); } }