Merge pull request #21257 from starhoshi/master

[stripe] Add ephemeral keys
This commit is contained in:
Daniel Rosenwasser
2017-11-12 00:50:49 -08:00
committed by GitHub
2 changed files with 42 additions and 0 deletions

View File

@@ -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;
@@ -3152,6 +3153,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<IAssociatedObject>
created: number;
expires: number;
livemode: boolean;
secret: string;
}
interface IAssociatedObject {
id: string;
type: string;
}
}
namespace tokens {
interface IToken extends ICardToken, IBankAccountToken { }
@@ -6311,6 +6342,10 @@ declare namespace Stripe {
class WebHooks {
constructEvent<T>(requestBody: any, signature: string | string[], endpointSecret: string): webhooks.StripeWebhookEvent<T>;
}
class EphemeralKeys {
create(customer: ephemeralKeys.ICustomer, stripe_version: ephemeralKeys.IStripeVersion, response?: IResponseFn<ephemeralKeys.IEphemeralKey>): Promise<ephemeralKeys.IEphemeralKey>;
}
}
interface IObject {

View File

@@ -998,3 +998,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
});