Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

6
How can I use multiple API keys for nestjs-stripe?
Post Body

Hi,

I am using nestjs-stripe for a project that needs to direct payments at different Stripe accounts depending on which brand the booking is for.

I am using the package in the recommended way;

import { Module } from '@nestjs-common';
import { StripeModule } from 'nestjs-stripe';

@Module({
  imports: [
    StripeModule.forRoot({
      apiKey: 'my_secret_key',
      apiVersion: '2020-03-02',
    }),
  ],
})
export class AppModule {}

Is there a way that I can swap the API key at the point where I create the token and charge within my payment.service.ts?

    result.tokenResult = await this.stripeClient.tokens.create({
      card: {
        number: data.card.cardNumber,
        exp_month: data.card.expiryMonth,
        exp_year: data.card.expiryYear,
        cvc: data.card.cvc,
      },
    });

    result.chargeResult = await this.stripeClient.charges.create({
      amount: data.charge.amount,
      currency: data.charge.currency,
      source: result.tokenResult.id,
      description: data.charge.description,
    });

Author
Account Strength
90%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
691
Link Karma
293
Comment Karma
398
Profile updated: 1 day ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago