I want to use the paypal-rest-sdk for payments in a multi tenant node/express application. Before I can fire a request, I have to configure the paypal module.
paypal.configure({
'mode': "sandbox",
'client_id': "XXXXXXXXXXX",
'client_secret': "XXXXXXXXXXXX"
});
But they just provide a way to configure the paypal module globally. I didn't find anything about changing the configuration on each request in my node/express app
Actually you can read how to do it directly in their documentation :
https://github.com/paypal/PayPal-node-SDK/blob/master/samples/configuration/multiple_config.js
Seems like you can pass a new configuration object as second parameter to override the global config :
var second_config = {
'mode': 'sandbox',
'client_id': '<SECOND_CLIENT_ID>',
'client_secret': '<SECOND_CLIENT_SECRET>'
};
paypal.payment.create(create_payment_json, second_config, function (error, payment) {
});