@sumup/sdk
Version:
The official TypeScript SDK for the SumUp API
77 lines • 4.28 kB
text/typescript
import { APIResource, type RequestOptions, type WithResponse } from "../../core";
import type { EntryMode, PaymentType, TransactionFull, TransactionHistory, TransactionsHistoryLink } from "../../types";
export type RefundTransactionParams = {
/**
* Amount to be refunded. Eligible amount can't exceed the amount of the transaction and varies based on country and currency. If you do not specify a value, the system performs a full refund of the transaction.
*/
amount?: number;
};
export type GetTransactionV2_1QueryParams = {
id?: string;
transaction_code?: string;
foreign_transaction_id?: string;
client_transaction_id?: string;
};
export type ListTransactionsV2_1QueryParams = {
transaction_code?: string;
order?: "ascending" | "descending";
limit?: number;
users?: string[];
"statuses[]"?: ("SUCCESSFUL" | "CANCELLED" | "FAILED" | "REFUNDED" | "CHARGE_BACK")[];
payment_types?: PaymentType[];
"entry_modes[]"?: EntryMode[];
types?: ("PAYMENT" | "REFUND" | "CHARGE_BACK")[];
changes_since?: string;
newest_time?: string;
newest_ref?: string;
oldest_time?: string;
oldest_ref?: string;
};
export type ListTransactionsV2_1Response = {
items?: TransactionHistory[];
links?: TransactionsHistoryLink[];
};
/**
* API resource for the Transactions endpoints.
*
* Transactions represent completed or attempted payment operations processed for a merchant account. A transaction contains the core payment result, such as the amount, currency, payment method, creation time, and current high-level status.
*
* In addition to the main payment outcome, a transaction can contain related events that describe what happened after the original payment attempt. These events provide visibility into the financial lifecycle of the transaction, for example:
* - `PAYOUT`: the payment being prepared for payout or included in a payout to the merchant
* - `REFUND`: money returned to the payer
* - `CHARGE_BACK`: money reversed after the original payment
* - `PAYOUT_DEDUCTION`: an amount deducted from a payout to cover a refund or chargeback
*
* From an integrator's perspective, transactions are the authoritative record of payment outcomes. Use this tag to:
* - list transactions for reporting, reconciliation, and customer support workflows
* - retrieve a single transaction when you need the latest payment details
* - inspect `simple_status` for the current merchant-facing outcome of the payment
* - inspect `events` or `transaction_events` when you need refund, payout, or chargeback history
*
* Typical workflow:
* - create and process payments through the Checkouts endpoints
* - use the Transactions endpoints to read the resulting payment records
* - use the returned statuses and events to update your own order, accounting, or support systems
*/
export declare class Transactions extends APIResource {
/**
* Refunds an identified transaction either in full or partially.
*/
refund(merchantCode: string, id: string, body?: RefundTransactionParams, options?: RequestOptions): Promise<void>;
refundWithResponse(merchantCode: string, id: string, body?: RefundTransactionParams, options?: RequestOptions): Promise<WithResponse<void>>;
/**
* Retrieves the full details of an identified transaction. The transaction resource is identified by a query parameter and *one* of following parameters is required:
* - `id`
* - `transaction_code`
* - `foreign_transaction_id`
* - `client_transaction_id`
*/
get(merchantCode: string, query?: GetTransactionV2_1QueryParams, options?: RequestOptions): Promise<TransactionFull>;
getWithResponse(merchantCode: string, query?: GetTransactionV2_1QueryParams, options?: RequestOptions): Promise<WithResponse<TransactionFull>>;
/**
* Lists detailed history of all transactions associated with the merchant profile.
*/
list(merchantCode: string, query?: ListTransactionsV2_1QueryParams, options?: RequestOptions): Promise<ListTransactionsV2_1Response>;
listWithResponse(merchantCode: string, query?: ListTransactionsV2_1QueryParams, options?: RequestOptions): Promise<WithResponse<ListTransactionsV2_1Response>>;
}
//# sourceMappingURL=index.d.cts.map