smarkets / react-native-paypal

React Native library that implements PayPal Checkout flow using purely native code
MIT License
118 stars 54 forks source link

Error requesting one time payment - "Merchant account not found" #10

Closed dmamaril closed 5 years ago

dmamaril commented 5 years ago

Hi,

Unsure how to proceed... it's likely a braintree issue, but I just want to make sure I'm covering my bases. I've triple checked my merchantId, publicKey and privateKey and ensured that they're 100% correct, however I'm receiving a merchant not found error still.

Screen Shot 2019-03-21 at 10 56 44 PM

Braintree setup

const gateway = braintree.connect({
    environment: braintree.Environment.Sandbox,
    merchantId: process.env.BRAINTREE_MERCHANT_ID,
    publicKey: process.env.BRAINTREE_PUBLIC_KEY,
    privateKey: process.env.BRAINTREE_PRIVATE_KEY
});

createToken method

    public createToken(request: Request, h: ResponseToolkit): Promise<string> {
        return new Promise((resolve, reject) => {
            this.gateway.clientToken.generate({}, (err, response) => {
                if (err) {
                    reject(err.message);
                } else if (!response.success) {
                    reject(response.message);
                } else {
                    resolve(response.clientToken);
                }
            });
        });
    }

Click handler in UI

        requestOneTimePayment(
            token,
            {
                amount: '5', // required
                // any PayPal supported currency (see here: https://developer.paypal.com/docs/integration/direct/rest/currency-codes/#paypal-account-payments)
                currency: 'GBP',
                // any PayPal supported locale (see here: https://braintree.github.io/braintree_ios/Classes/BTPayPalRequest.html#/c:objc(cs)BTPayPalRequest(py)localeCode)
                localeCode: 'en_GB',
                shippingAddressRequired: false,
                userAction: 'commit', // display 'Pay Now' on the PayPal review page
                // one of 'authorize', 'sale', 'order'. defaults to 'authorize'. see details here: https://developer.paypal.com/docs/api/payments/v1/#payment-create-request-body
                intent: 'authorize',
            }
        )

Any help would be greatly appreciated.

riso commented 5 years ago

Hey, sorry for the late reply and thanks for the detailed report. Your setup seems correct. Googling your issue seems to point at a misconfiguration of your paypal merchant account. I double checked our config and under https://developer.paypal.com/developer/applications/ you should see a section named 'Express Checkout via Braintree SDK - Sandbox Accounts' where your sandbox credentials are. As for merchant ID it should be in https://www.paypal.com/businessprofile/settings ..

Ultimately though I think that the best thing you can do is get in touch with PayPal support as I think they would be best suited to help.

ibnulk commented 5 years ago

I am facing the same issue. May i know how you solved this?

shahbazmancho commented 4 years ago

I think the problem is with the token you are using. Try to print the error you are getting you will get more info about the problem.

In my case, it was the token (merchant not found). Try to use the token from this URL Create Token

If you don't get any error by using this token then the problem is with your token, It means your Braintree account is not connected with your PayPal account.

The solution is to link PayPal with your Braintree account How to link

nafplann commented 4 years ago

I was into this.. this solves the problem. Paypal Integration

trimitrtechnologies commented 4 years ago

For all users who still struggling to solve this issue follow the below steps:

riso commented 4 years ago

Thanks for that :)

alapanerao commented 3 years ago

@trimitrtechnologies Thanks a lot for the solution. https://github.com/smarkets/react-native-paypal/issues/10#issuecomment-635281813

@riso can you please add this steps in ReadMe in setup guide ?