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

Java PayPal SDK send money to business account

$
0
0

I want my customers to be able to purchase certain services in my Java application using PayPal.I used the SDK. After I enter my ClientID and SecretID, I get a approval link. If I open this, the official PayPal window actually opens. However, when I click on "Pay" I am redirected and nothing happens. No money has been deducted from my account, nor has anything been entered into the business account.Does anyone have a working code?Thanks in advance!

When I enter the paypal developer dashboard, I can see that all my API calls are green.

That's my code:

        Order order = null;        // Construct a request object and set desired parameters        // Here, OrdersCreateRequest() creates a POST request to /v2/checkout/orders        OrderRequest orderRequest = new OrderRequest();        orderRequest.checkoutPaymentIntent("CAPTURE");        List<PurchaseUnitRequest> purchaseUnits = new ArrayList<>();        purchaseUnits.add(new PurchaseUnitRequest().amountWithBreakdown(new AmountWithBreakdown().currencyCode("EUR").value("0.01")));        orderRequest.purchaseUnits(purchaseUnits);        OrdersCreateRequest request = new OrdersCreateRequest().requestBody(orderRequest);        try {            // Call API with your client and get a response for your call            HttpResponse<Order> response = Credentials.client.execute(request);  // Here are the keys            // If call returns body in response, you can get the de-serialized version by            // calling result() on the response            order = response.result();            System.out.println("Order ID: " + order.id());            order.links().forEach(link -> System.out.println(link.rel() +" => " + link.method() +":" + link.href()));        } catch (IOException ioe) {            if (ioe instanceof HttpException) {                // Something went wrong server-side                HttpException he = (HttpException) ioe;                System.out.println(he.getMessage());                he.headers().forEach(x -> System.out.println(x +" :" + he.headers().header(x)));            } else {                System.out.println(ioe);            }        }

I get redirected but no money has been transfered.

Edit: I just found that I should use payouts. I used the payout SDK but now I'm getting this error:

"{"name":"AUTHORIZATION_ERROR","message":"Authorization error occurred.","debug_id":"578ce67e544c5","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors","links":[]}"

I also checked the checkbox "Payout" in my apps. The checkbox is selected.


Viewing all articles
Browse latest Browse all 516

Trending Articles