mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
parent
70737c2a24
commit
79bdd9caf3
38
stripe-checkout/stripe-checkout-tests.ts
Normal file
38
stripe-checkout/stripe-checkout-tests.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/// <reference path="stripe-checkout.d.ts" />
|
||||
|
||||
// Test the minimum amount of configuration required.
|
||||
var handler = StripeCheckout.configure({
|
||||
key: "my-secret-key",
|
||||
token: function(token: StripeTokenResponse) {
|
||||
console.log(token.id);
|
||||
}
|
||||
});
|
||||
|
||||
handler.open();
|
||||
|
||||
handler.close();
|
||||
|
||||
// Test all configuration options.
|
||||
var options = {
|
||||
key: "my-secret-key",
|
||||
token: function(token: StripeTokenResponse) {
|
||||
console.log(token.id);
|
||||
},
|
||||
image: "http://placehold.it/128x128",
|
||||
name: "Definitely Typed",
|
||||
description: "A DefinitelyTyped test for Stripe Checkout",
|
||||
amount: Number.MAX_VALUE,
|
||||
currency: "USD",
|
||||
panelLabel: "Pay Definitely Typed {{amount}}",
|
||||
label: "Pay Definitely Typed",
|
||||
zipCode: false,
|
||||
email: "test@example.com",
|
||||
allowRememberMe: false,
|
||||
bitcoin: false,
|
||||
opened: function() {},
|
||||
closed: function() {}
|
||||
}
|
||||
|
||||
handler = StripeCheckout.configure(options);
|
||||
|
||||
handler.open(options);
|
||||
35
stripe-checkout/stripe-checkout.d.ts
vendored
Normal file
35
stripe-checkout/stripe-checkout.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Type definitions for Stripe Checkout
|
||||
// Project: https://stripe.com/checkout
|
||||
// Definitions by: Chris Wrench <https://github.com/cgwrench>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../stripe/stripe.d.ts"/>
|
||||
|
||||
interface StripeCheckoutStatic {
|
||||
configure(options: StripeCheckoutOptions): StripeCheckoutHandler;
|
||||
}
|
||||
|
||||
interface StripeCheckoutHandler {
|
||||
open(options?: StripeCheckoutOptions): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface StripeCheckoutOptions {
|
||||
key: string;
|
||||
token: (token: StripeTokenResponse) => void;
|
||||
image?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
amount?: number;
|
||||
currency?: string;
|
||||
panelLabel?: string;
|
||||
zipCode?: boolean;
|
||||
email?: string;
|
||||
label?: string;
|
||||
allowRememberMe?: boolean;
|
||||
bitcoin?: boolean;
|
||||
opened?: () => void;
|
||||
closed?: () => void;
|
||||
}
|
||||
|
||||
declare var StripeCheckout: StripeCheckoutStatic;
|
||||
Loading…
Reference in New Issue
Block a user