Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 468

How to avoid PayPal 'PAYEE_ACCOUNT_INVALID' error?

$
0
0

I'm trying to make an application to buy games online. And I'm currently working on the payment page. I've implemented a PayPal to PayPal transactions successfully and now I'm working on to make a Credit Card to PayPal transactions.

So I've made a front end page with all the inputs that I've needed: Card Number, Expiration Date and CVV. And I want that when I press on the buy button, the client send the card number, expiration date and cvv to an express API. Then when in the API, I make the payment such like the PayPal to PayPal method that I've used.

Here is my client-side code :

const CreditCardNumber = document.getElementById("CreditCardNumber");const CreditCardCVV = document.getElementById("CreditCardCVV");const ExpireMonth = document.getElementById("ExpireMonth");const ExpireYear = document.getElementById("ExpireYear");fetch(properties.api +'/getProductByInvoiceToken',{    method:'POST',    headers : {'Content-Type': 'application/json','Access-Control-Allow-Origin': 'http://127.0.0.1:5500'    },    body: JSON.stringify({'number' : CreditCardNumber.value,'cvv2' : CreditCardCVV.value,'expireMonth' : ExpireMonth.options[ExpireMonth.selectedIndex].value,'expireYear' : ExpireYear.options[ExpireYear.selectedIndex].value,    })})

Here is my server-side code :

app.post('/buyWithCreditCard',(req,res)=>{    const { number, expireMonth, expireYear, cvv } = req.body;    paypal.payment.create({        intent: 'sale',        payer: {            payment_method: 'credit_card',            funding_instruments: [{                credit_card: {                    number: number,                    type: 'visa',                    expire_month: expireMonth,                    expire_year: expireYear,                    cvv2: cvv2,                    first_name: "John",                    last_name: "Doe"                }            }]        },        transactions: [{            amount: {                total: product.child('Price').val(),                currency: "USD"            },            description: 'Payment desc.'        }]    }, function (error, payment) {        if (error) {            console.log(error.response);        } else {            console.log('LTETT');        }    });});

Every time I'm trying to pay, the app throws the following error:

{    name: 'PAYEE_ACCOUNT_INVALID',     message: 'Payee account is invalid.',     information_link: 'https://developer.paypal.com/docs/api/payments/v1/#error-PAYEE_ACCOUNT_INVALID', debug_id: 'cd64907fda648', httpStatusCode: 400}

Can someone please help with this?

I'm excepting the server to respond correctly


Viewing all articles
Browse latest Browse all 468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>