Skip to content

Commit

Permalink
#857 add default option for stripeAccount (#1102)
Browse files Browse the repository at this point in the history
Co-authored-by: lyndonbuckley <[email protected]>
  • Loading branch information
lyndonbuckley and lyndonbuckley authored Jul 15, 2021
1 parent b8ed84d commit 40eaaab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/StripeResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ StripeResource.prototype = {
'X-Stripe-Client-User-Agent': clientUserAgent,
'X-Stripe-Client-Telemetry': this._getTelemetryHeader(),
'Stripe-Version': apiVersion,
'Stripe-Account': this._stripe.getApiField('stripeAccount'),
'Idempotency-Key': this._defaultIdempotencyKey(
method,
userSuppliedSettings
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const ALLOWED_CONFIG_PROPERTIES = [
'protocol',
'telemetry',
'appInfo',
'stripeAccount',
];

const EventEmitter = require('events').EventEmitter;
Expand Down Expand Up @@ -92,6 +93,7 @@ function Stripe(key, config = {}) {
),
agent: props.httpAgent || null,
dev: false,
stripeAccount: props.stripeAccount || null,
};

const typescript = props.typescript || false;
Expand Down
5 changes: 5 additions & 0 deletions types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ declare module 'stripe' {
* @docs https://stripe.com/docs/building-plugins?lang=node#setappinfo
*/
appInfo?: AppInfo;

/**
* An account id on whose behalf you wish to make every request.
*/
stripeAccount?: string;
}

export interface RequestOptions {
Expand Down

0 comments on commit 40eaaab

Please sign in to comment.