tabby-web-sdk
Version:
Web merchant custom implementation for Tabby, the app that lets you split your payments in 4.
85 lines (84 loc) • 2.08 kB
TypeScript
export interface Payment {
amount: string;
currency?: "AED" | "SAR" | "KWD" | "BHD" | "QAR";
description?: string;
buyer: Buyer;
shipping_address: ShippingAddress;
order: Order;
buyer_history: BuyerHistory;
order_history: OrderHistory[];
meta?: Meta;
attachment?: Attachment;
}
export interface Buyer {
phone: string;
email: string;
name: string;
dob?: string;
}
export interface ShippingAddress {
city: string;
address: string;
zip: string;
}
export interface Item {
title: string;
description?: string;
quantity: number;
unit_price: string;
discount_amount?: string;
reference_id?: string;
image_url?: string;
product_url?: string;
gender?: string;
category: string;
color?: string;
product_material?: string;
size_type?: string;
size?: string;
brand?: string;
is_refundable?: boolean;
}
export interface Order {
tax_amount?: string;
shipping_amount?: string;
discount_amount?: string;
updated_at?: string;
reference_id: string;
items: Item[];
}
export interface BuyerHistory {
registered_since: string;
loyalty_level: number;
wishlist_count?: number;
is_social_networks_connected?: boolean;
is_phone_number_verified?: boolean;
is_email_verified?: boolean;
}
export interface OrderHistory {
purchased_at: string;
amount: string;
payment_method?: "card" | "cod";
status: "new" | "processing" | "complete" | "refunded" | "cancelled" | "unknown";
buyer: Buyer;
shipping_address: ShippingAddress;
items: Item[];
}
export interface Meta {
order_id: string | null;
customer: string | null;
}
export interface Attachment {
body: string;
content_type: string;
}
export interface MerchantUrls {
success: string;
cancel: string;
failure: string;
}
export interface PaymentRequest {
payment: Payment;
lang?: "ar" | "en";
merchant_urls?: MerchantUrls;
}