Skip to content

Conversation

@shlowmo
Copy link

@shlowmo shlowmo commented Mar 1, 2024

Double check existing instance API key in constructor

Resolves #50

qdekussche and others added 2 commits March 1, 2024 17:35
if (Paymongo.instance instanceof Paymongo) return Paymongo.instance;
if (!secret) throw new Error('API key is required!');

if (Paymongo.instance instanceof Paymongo) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in a single if for cleaner code.

if (Paymongo.instance instanceof Paymongo && Paymongo.instance.secret === secret)

Kindly update, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using the same library to process payment with 2 paymongo account

2 participants