简体   繁体   中英

PayPal how to set credentials programmatically in java sdk (express checkout)

I'm using PayPal Express Checkout to make reference payments. Right now, the sdk loads PayPal credentials (user id, password, signature) from a resource file (sdk_config.properties) - is there any way to set the credentials (user id, password, signature) from code?

I'm not familiar with their SDK but you should be able to just update the values of those constants or whatever types of variables they're using with your own dynamic values.

Alternatively, you might want to look into the Permissions API as it sounds like you're attempting to make calls on behalf of 3rd party users..??

We have made some good improvements to the PayPal Java SDK on integration steps. We are removing the need for sdk_config.properties file as they do not work as well, specially for multi-configuration settings.

Now, all you do is create an APIContext instance with clientId , clientSecret , and mode . You pass that context object for any API operation from there on.

Here is how the code would look like:

APIContext context = new APIContext(clientId, clientSecret, "sandbox");

Payment payment = new Payment();
// Fill in all the details.
payment.create(context);

Here is the wiki page explaining that: https://github.com/paypal/PayPal-Java-SDK/wiki/Making-First-Call

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM