stripe-checkout: add source callback

This commit is contained in:
Sam Whited
2018-10-18 23:53:39 -05:00
parent 59dc9899d3
commit ffda5dd43e
2 changed files with 14 additions and 10 deletions
+3 -2
View File
@@ -3,7 +3,7 @@
// Definitions by: Chris Wrench <https://github.com/cgwrench>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="stripe-v2"/>
/// <reference types="stripe-v3"/>
interface StripeCheckoutStatic {
configure(options: StripeCheckoutOptions): StripeCheckoutHandler;
@@ -16,7 +16,8 @@ interface StripeCheckoutHandler {
interface StripeCheckoutOptions {
key?: string;
token?(token: stripe.StripeCardTokenResponse): void;
token?(token: stripe.Token): void;
source?(source: stripe.Source): void;
image?: string;
name?: string;
description?: string;
+11 -8
View File
@@ -1,9 +1,9 @@
// Test the minimum amount of configuration required.
let handler = StripeCheckout.configure({
key: "my-secret-key",
token: (token: stripe.StripeTokenResponse) => {
console.log(token.id);
}
key: "my-secret-key",
token: (token: stripe.Token) => {
console.log(token.id);
}
});
handler.open();
@@ -12,10 +12,13 @@ handler.close();
// Test all configuration options.
const options: StripeCheckoutOptions = {
key: "my-secret-key",
token: (token: stripe.StripeTokenResponse) => {
console.log(token.id);
},
key: "my-secret-key",
token: (token: stripe.Token) => {
console.log(token.id);
},
source: (src: stripe.Source) => {
console.log(src.id);
},
image: "http://placehold.it/128x128",
name: "Definitely Typed",
description: "A DefinitelyTyped test for Stripe Checkout",