Reputation: 3448
I am trying to mass payout using paypal , I getting 403 error while executing this bellow line.
@Autowired
private APIContext apiContext;
------------------------
------------------------
// ###Create Batch Payout
PayoutBatch batch = payout.create(apiContext, new HashMap<String, String>());
See this is my config class PaypalConfig.java
@Configuration
public class PaypalConfig {
@Value("${paypal.client.app}")
private String clientId;
@Value("${paypal.client.secret}")
private String clientSecret;
@Value("${paypal.mode}")
private String mode;
@Bean
public Map<String, String> paypalSdkConfig(){
Map<String, String> sdkConfig = new HashMap<>();
sdkConfig.put("mode", mode);
return sdkConfig;
}
@Bean
public OAuthTokenCredential authTokenCredential(){
return new OAuthTokenCredential(clientId, clientSecret, paypalSdkConfig());
}
@Bean
public APIContext apiContext() throws PayPalRESTException{
APIContext apiContext = new APIContext(authTokenCredential().getAccessToken());
apiContext.setConfigurationMap(paypalSdkConfig());
return apiContext;
}
}
This is the exception I getting.
com.paypal.base.rest.PayPalRESTException: Response code: 403 Error response: {"name":"AUTHORIZATION_ERROR","message":"Authorization error occurred","debug_id":"b11d9b5d1aea7","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors"}
at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
at com.paypal.api.payments.Payout.create(Payout.java:118)
at com.paypal.service.impl.PaypalServiceImpl.massPayout(PaypalServiceImpl.java:56)
at com.paypal.controller.PaypalController.massPayout(PaypalController.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Maven
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>1.13.1</version>
</dependency>
What I missing here in authorization config ? Please guide.
Upvotes: 0
Views: 839
Reputation: 3448
I try with USA account it will work.
I found answer from here : https://github.com/paypal/PayPal-PHP-SDK/issues/793
Upvotes: 0
Reputation: 1240
Http error 403 is "forbidden" which would normally imply that you don't have permission to do what you are trying to do. This is different from being not authenticated, because then you would expect a 401 "unauthorised".
I would suggest that you refer to the api documentation to see if you need to send any more data, or if there is additional config that you are missing.
Upvotes: 1