nowpayments-api-typescript
Version:
Nowpayments typescript API wrapper
37 lines (31 loc) • 895 B
text/typescript
import ApiConnection from './../utils/api-connection';
import { IGetPaymentStatus, IError } from './../interfaces';
export interface GetPaymentStatusResponse {
payment_id: number;
payment_status: string;
pay_address: string;
price_amount: number;
price_currency: string;
pay_amount: number;
actually_paid: number;
pay_currency: string;
order_id: string;
order_description: string;
purchase_id: number;
created_at: string;
updated_at: string;
outcome_amount: number;
outcome_currency: string;
}
export interface GetPaymentStatus extends IGetPaymentStatus {
apiKey: string;
}
const getPaymentStatus = async ({
apiKey,
payment_id,
}: GetPaymentStatus): Promise<GetPaymentStatusResponse | IError> => {
const api = new ApiConnection({ apiKey });
const { data } = await api.get(`/payment/${payment_id}`);
return data;
};
export default getPaymentStatus;