Paymentservice.js 571 B

123456789101112131415161718192021222324
  1. const braintree = require("braintree");
  2. var gateway = braintree.connect({
  3. environment: braintree.Environment.Sandbox,
  4. merchantId: "useYourMerchantId",
  5. publicKey: "useYourPublicKey",
  6. privateKey: "useYourPrivateKey"
  7. });
  8. class OrderService {
  9. constructor() {
  10. this.gateway = gateway
  11. this.clientOptions = {
  12. customerId: aCustomerId
  13. };
  14. }
  15. gatewayGenerator(clientOptions){
  16. //client options should get passed through request
  17. this.gateway.clientToken.generate(this.clientOptions, function (err, response) {
  18. return response.clientToken;
  19. });
  20. }
  21. }