Java send money to paypal account

Fimmel
New Community Member

Hello,

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!

Finn

Login to Me Too
2 REPLIES 2

Fimmel
New Community Member

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":[]}"

 

This is the code I have used:

List<PayoutItem> items = IntStream
.range(1, 6)
.mapToObj(index -> new PayoutItem()
.senderItemId("Test_txn_" + index)
.note("Your 1$ Payout!")
.receiver("HERE_IS_THE_BUSINESS_EMAIL")
.amount(new Currency()
.currency("EUR")
.value("0.01")))
.collect(Collectors.toList());

CreatePayoutRequest request = new CreatePayoutRequest()
.senderBatchHeader(new SenderBatchHeader()
.senderBatchId("Test_sdk_" + RandomStringUtils.randomAlphanumeric(7))
.emailMessage("SDK payouts test txn")
.emailSubject("This is a test transaction from SDK")
.note("Enjoy your Payout!!")
.recipientType("EMAIL"))
.items(items);

try {
// Call API with your client and get a response for your call
PayoutsPostRequest httpRequest = new PayoutsPostRequest().requestBody(request);
HttpResponse<CreatePayoutResponse> response = Credentials.client.execute(httpRequest);

// If call returns body in response, you can get the de-serialized version by
// calling result() on the response
CreatePayoutResponse payouts = response.result();
System.out.println("Payouts Batch ID: " + payouts.batchHeader().payoutBatchId());
payouts.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 {
// Something went wrong client-side
}
}
 
I also checked the checkbox "Payout" in my apps. The checkbox is selected.

 

Login to Me Too

Kavyar
Moderator
Moderator

Good day @Fimmel 

 

Thank you for posting to the PayPal community.

 

To utilize the Payouts/Mass payments feature, it is essential to verify your account, and you’ll need to request access.

 

For additional information, please refer to the detailed guide provided in the link below.

 

https://developer.paypal.com/docs/payouts/standard/ 

 

https://developer.paypal.com/docs/payouts/standard/integrate-api/ 

 

I would suggest to please contact our PayPal Customer service via link -  https://www.paypal.com/smarthelp/contact-us (then choose at the bottom one of the contact methods - email or phone) who should be able to help you regarding the request.

 

They will be able to assist you further as they are specially trained to address this type of account inquiry.

 

Sincerely,

Kavya

PayPal MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.