Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payee account is invalid. #PAYEE_ACCOUNT_INVALID #254

Open
tbz-mikaels opened this issue Feb 12, 2022 · 2 comments
Open

Payee account is invalid. #PAYEE_ACCOUNT_INVALID #254

tbz-mikaels opened this issue Feb 12, 2022 · 2 comments

Comments

@tbz-mikaels
Copy link

Hi, I am trying to implement PayPal Credit card functionality on laravel for Rest Api. I am receiving the "PAYEE_ACCOUNT_INVALID" error. Any idea what am I doing wrong? Any help would be really appreciated. Thanks.

This is my code snippet.

public function payment()
    {
        $gateway = Omnipay::create('PayPal_Rest');

        // Initialise the gateway
        $gateway->initialize(array(
            'clientId' => env('PAYPAL_SANDBOX_CLIENT_ID'),
            'secret' => env('PAYPAL_SANDBOX_CLIENT_SECRET'),
            'testMode' => true,
        ));

        #### Direct Credit Card Payment

        // Create a credit card object
        // DO NOT USE THESE CARD VALUES -- substitute your own
        // see the documentation in the class header.
        $card = new CreditCard([
            'firstName' => 'Example',
            'lastName' => 'User',
            'number' => '4111111111111111',
            'expiryMonth' => '01',
            'expiryYear' => '2027',
            'cvv' => '123',
        ]);

        // Do a purchase transaction on the gateway
        try {
            $transaction = $gateway->purchase([
                'amount' => '1.00',
                'currency' => 'AUD',
                'description' => 'This is a test purchase transaction.',
                'card' => $card,
            ]);

            $response = $transaction->send();
            $data = $response->getData();
            echo "Gateway purchase response data == " . print_r($data, true) . "\n";

            if ($response->isSuccessful()) {
                echo "Purchase transaction was successful!\n";
            }
        } catch (Exception $e) {
            echo "Exception caught while attempting authorize.\n";
            echo "Exception type == " . get_class($e) . "\n";
            echo "Message == " . $e->getMessage() . "\n";
        }
    }
@francoisjacquet
Copy link

Same error here.
I have tried with various REST API apps (sandbox), and thus different Business sandbox accounts, client IDs and secrets.
But always ends up with the 400 "Payee account is invalid." error.
The documentation does not help much https://developer.paypal.com/docs/api/payments/v1/#error-PAYEE_ACCOUNT_INVALID
I have revised the sandbox merchant accounts are indeed both Business and Verified (they are by default).

@tbz-mikaels did you find a solution to this?

Anyone?

Note that I am on localhost if that does matter.

@francoisjacquet
Copy link

One can read at https://developer.paypal.com/docs/api/payments/v1/

Important: The use of the PayPal REST /payments APIs to accept credit card payments is restricted. Instead, you can accept credit card payments with Braintree Direct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants