aboutsummaryrefslogblamecommitdiff
path: root/server/config/paypal.js
blob: 3b45015d56cac716be03957554a3be78d93df4e7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                                  
                                                                 
const paypal = require('@paypal/checkout-server-sdk');
const {paypalEnvironment, paypalClientId, paypalClientSecret} = require('./env');

function environment() {
  if (paypalEnvironment === 'live')
    return new paypal.core.LiveEnvironment(paypalClientId, paypalClientSecret);
  else
    return new paypal.core.SandboxEnvironment(paypalClientId, paypalClientSecret);
}

module.exports = new paypal.core.PayPalHttpClient(environment());