Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Invalid User #380

Closed
Kaushik1502 opened this issue Jan 11, 2017 · 23 comments
Closed

Invalid User #380

Kaushik1502 opened this issue Jan 11, 2017 · 23 comments
Labels

Comments

@Kaushik1502
Copy link

Kaushik1502 commented Jan 11, 2017

SandBox payment is not working

E/paypal.sdk: request failure with http statusCode:401,exception:Unauthorized
E/paypal.sdk: request failed with server response:{"error":"invalid_user","error_description":"Invalid user credentials"}
E/paypal.sdk: invalid_user

Getting these response while trying to login. I have also tried after changing the password and also tried creating new buyer account.

private static final String CONFIG_ENVIRONMENT = PayPalConfiguration.ENVIRONMENT_SANDBOX;
private static final String CONFIG_CLIENT_ID = "my_client_id_for_sandbox";
private static final int REQUEST_CODE_PAYMENT = 1;
private static PayPalConfiguration config = new PayPalConfiguration()
            .environment(CONFIG_ENVIRONMENT)
            .clientId(CONFIG_CLIENT_ID).merchantName("Test");

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

//In button click
PayPalPayment thingToBuy = getThingToBuy(PayPalPayment.PAYMENT_INTENT_SALE);
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config);
intent.putExtra(PaymentActivity.EXTRA_PAYMENT, thingToBuy);
startActivityForResult(intent, REQUEST_CODE_PAYMENT);

private PayPalPayment getThingToBuy(String paymentIntent) {
return new PayPalPayment(new BigDecimal("0.1"), "USD", "buy",
                paymentIntent);
}

//OnActivityResult
if (requestCode == REQUEST_CODE_PAYMENT) {
            if (resultCode == Activity.RESULT_OK) {
                PaymentConfirmation confirm =
                        data.getParcelableExtra(PaymentActivity.EXTRA_RESULT_CONFIRMATION);
                if (confirm != null) {
                    try {
                        Log.i(TAG, confirm.toJSONObject().toString(4));
                        Log.i(TAG, confirm.getPayment().toJSONObject().toString(4));
                        /**
                         *   send 'confirm' (and possibly confirm.getPayment() to your server for verification
                         * or consent completion.
                         * See https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
                         * for more details.
                         *
                         * For sample mobile backend interactions, see
                         * https://github.com/paypal/rest-api-sdk-python/tree/master/samples/mobile_backend
                         */
                        /*Toast.makeText(
                                getApplicationContext(),
                                "You have donated successfully", Toast.LENGTH_LONG)
                                .show();*/

                    } catch (JSONException e) {
                        Log.e(TAG, "an extremely unlikely failure occurred: ", e);
                    }
                }
            } else if (resultCode == Activity.RESULT_CANCELED) {
                Log.i(TAG, "The user canceled.");
            } else if (resultCode == PaymentActivity.RESULT_EXTRAS_INVALID) {
                Log.i(
                        TAG,
                        "An invalid Payment or PayPalConfiguration was submitted. Please see the docs.");
            }
        }

Gradle dependency

compile('com.paypal.sdk:paypal-android-sdk:2.15.1') {
    exclude group: 'io.card'
 }
@randstraw
Copy link

Sorry for the delay in follow up. Are you still seeing this issue?

@Kaushik1502
Copy link
Author

Kaushik1502 commented Mar 29, 2017

I have last tested that 2 weeks earlier. Production mode is working fine but sandbox mode is not working

@randstraw
Copy link

Are you using your sandbox client id and secret or are you using your production values in sandbox? You have two different sets.

@randstraw
Copy link

Also if you have a PayPal-Debug-ID from the error, I would be happy to look into it further to see if I can get more details.

@randstraw
Copy link

Closing the issue due to lack of response.

@aijaz070110
Copy link

I am using PayPalConfiguration.ENVIRONMENT_PRODUCTION, and the correct credentials.
I can login with sandbox mode but not in production mode.

paypal.sdk: request failure with http statusCode:401,exception:Unauthorized
/paypal.sdk: request failed with server response:{"error":"invalid_user","error_description":"Invalid user credentials"}

while all the credentials and environment variables are ok.

@randstraw
Copy link

@aijaz070110 please ensure you are using the client id and secret from the Live tab of your REST Application, it defaults to sandbox and the credentials are not the same.

@aijaz070110
Copy link

Yes, I know that. I am using live credentials..

@randstraw
Copy link

Can you provide a debug id?

@aijaz070110
Copy link

debug id>> where from I will get that?

@randstraw
Copy link

Is this happening when the buyer is logging in or during the API call?

If this is during the API call then are you able to plug the phone in and use logcat?

@randstraw
Copy link

The debug_id should be in the response headers, or in the response JSON for an error.

@aijaz070110
Copy link

aijaz070110 commented Jul 21, 2017 via email

@randstraw
Copy link

Is this happening when the buyer is logging in or during the API call?

@aijaz070110
Copy link

aijaz070110 commented Jul 21, 2017 via email

@randstraw
Copy link

Outside of double checking the buyer credentials or suggesting testing with another account there is not much I can do at this point. If you can confirm the same credentials can be used to log into https://www.paypal.com then I suggest contacting PayPal Technical Support here: https://www.paypal-techsupport.com/app/ask.

@aijaz070110
Copy link

brother, I am able to login on website with the credentials.
I can login using sandbox credentials
but, when I change it to production mode with merchant id and also the keys , I get that error :(

@randstraw
Copy link

Make sure the account isn't the same as the receiver is my last idea, but I think that throws a different error. Regardless get with Technical Support they should be able to help.

@aijaz070110
Copy link

please send then I will delste this

@paypal paypal deleted a comment from aijaz070110 Jul 21, 2017
@randstraw
Copy link

Talk to Technical Support and change your REST Credentials Immediately there are others on this thread.

@aijaz070110
Copy link

are you from paypal team?

@randstraw
Copy link

Yes, I work at PayPal. I help with sandbox integration issues here on GitHub. However, I do not have access to troubleshoot the production issue you are facing. You will need to contact Technical Support here: https://www.paypal-techsupport.com/app/ask/.

@aijaz070110
Copy link

hmm thanks

@paypal paypal locked and limited conversation to collaborators Jul 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@aijaz070110 @Kaushik1502 @randstraw and others