Skip to content

Instantly share code, notes, and snippets.

@alizahid
Last active September 29, 2021 05:24
Show Gist options
  • Save alizahid/ff3beec5e74c187ab06592778508295f to your computer and use it in GitHub Desktop.
Save alizahid/ff3beec5e74c187ab06592778508295f to your computer and use it in GitHub Desktop.
Safepay Node SDK TypeScript types
declare module 'safepay' {
type Options = {
apiKey: string
apiSecret: string
baseUrl: string
}
type Config = {
environment: string
production: Options
sandbox: Options
}
type Payments = {
create: (options: { amount: number; currency: string }) => Promise<{
data: {
data: {
amount: number
billing: string
client: string
conversion_rate: number
created_at: string
currency: string
default_currency: string
environment: string
state_reason: string
state: string
token: string
updated_at: string
user: string
}
status: {
message: string
}
}
}>
}
type Checkout = {
create: (options: {
cancelUrl: string
orderId: string
redirectUrl: string
source: string
tracker: string
}) => string
}
export default class Safepay {
constructor(config: Config)
static validateWebhookSignature(
tracker: string,
signature: string,
secret: string
): boolean
checkout: Checkout
payments: Payments
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment