diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index f0596623ea..fd9f217164 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -60,6 +60,7 @@ declare class Stripe { products: Stripe.resources.Products; skus: Stripe.resources.SKUs; webhooks: Stripe.resources.WebHooks; + ephemeralKeys: Stripe.resources.EphemeralKeys; setHost(host: string): void; setHost(host: string, port: string|number): void; @@ -3142,6 +3143,36 @@ declare namespace Stripe { } } + namespace ephemeralKeys { + interface IStripeVersion { + /** + * https://stripe.com/docs/upgrades#api-changelog + */ + stripe_version: string; + } + + interface ICustomer { + /** + * customer id + */ + customer: string; + } + + interface IEphemeralKey extends IResourceObject { + object: "ephemeral_key"; + associated_objects: Array + created: number; + expires: number; + livemode: boolean; + secret: string; + } + + interface IAssociatedObject { + id: string; + type: string; + } + } + namespace tokens { interface IToken extends ICardToken, IBankAccountToken { } @@ -6302,6 +6333,10 @@ declare namespace Stripe { class WebHooks { constructEvent(requestBody: any, signature: string | string[], endpointSecret: string): webhooks.StripeWebhookEvent; } + + class EphemeralKeys { + create(customer: ephemeralKeys.ICustomer, stripe_version: ephemeralKeys.IStripeVersion, response?: IResponseFn): Promise; + } } interface IObject { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index c4b291a7ed..6ab619eeb3 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -989,3 +989,10 @@ stripe.subscriptions.list({ customer: "cus_5rfJKDJkuxzh5Q", plan: "platypi-dev" }); //#endregion + +//#region Ephemeral keys tests +// ################################################################################## + +stripe.ephemeralKeys.create({ customer: "cus_5rfJKDJkuxzh5Q" }, { stripe_version: "2017-08-15" }).then(function(ephemeralKeys) { + // asynchronously called +});