Next.js Discord

Discord Forum

Paypal tranfer failed

Answered
Blue orchard bee posted this in #help-forum
Open in Discord
Blue orchard beeOP
my whole project working fine but when admin try to send money to freelancer it get failed
this is the issue i am getting in console error
## Error Type
Console Error

## Error Message
PayPal error: {}


    at handlePayPalPayout (src/app/dashboard/admin/page.tsx:155:17)

## Code Frame
  153 |       if (!res.ok) {
  154 |         alert("❌ PayPal transfer failed. Check logs.");
> 155 |         console.error("PayPal error:", data);
      |                 ^
  156 |         setLoading(false);
  157 |         return;
  158 |       }

Next.js version: 15.5.2 (Turbopack)

and this is the format i follow in .env.local file
CLIENT_ID=
CLIENT_SECRET=
PAYPAL_API_BASE=https://api-m.sandbox.paypal.com

PAYPAL_ENV=sandbox
Answered by Blue orchard bee
now i get the issue
View full answer

18 Replies

Blue orchard beeOP
here is the admin code
@Blue orchard bee Click to see attachment
Huntaway
@Blue orchard bee I believe it’d because their a mismatch if I’m reading this correct between env and route your missing the PAYPAL_ prefix for client and secret so either remove prefix from route or add it to env
@Huntaway <@713374921136275456> I believe it’d because their a mismatch if I’m reading this correct between env and route your missing the PAYPAL_ prefix for client and secret so either remove prefix from route or add it to env
Blue orchard beeOP
well you are right but still those thing not working like for example i also tried this way
PAYPAL_CLIENT_ID=
PAYPAL_CLIENT_Eo
PAYPAL_API_BASE=https://api-m.sandbox.paypal.com
PAYPAL_ENV=sandbox 

and this way too
NEXT_PUBLIC_PAYPAL_CLIENT_ID=
NEXT_PUBLIC_PAYPAL_CLIENT_Eo
PAYPAL_API_BASE=https://api-m.sandbox.paypal.com
PAYPAL_ENV=sandbox

also update route page too but still won't work
before creating this form i tried other possibilities in .env file like changing file name from .env to .env.local
like as i said in starting when client want to deposit certain amount it work so let's say if their an issue in .env file it won't submit to admit account
Dutch
It says "failed to fetch paypal token" so its an internal error of paypal, you need to check your token from their dashboard first
Blue orchard beeOP
now i get the issue
Answer
Blue orchard beeOP
it won't allow in india
Dutch
as i remember razorpay was working in india
@Dutch as i remember razorpay was working in india
Blue orchard beeOP
yeah now i have to switch to razorpay
Dutch
its a very common issue, recently i am looking for a payment integration and couldnt find any proper one among many options
one doesnt work for X country, one doesnt have proper payment API, one are chasing fraud with fake payments, most of them asking for your detailed company info etc...
Dutch
so i recommend searching it in depth before buying one solution
@Dutch so i recommend searching it in depth before buying one solution
Blue orchard beeOP
sure thanks
Dutch