@sumup/sdk
Version:
The official TypeScript SDK for the SumUp API
107 lines • 5.49 kB
text/typescript
import { APIResource, type RequestOptions, type WithResponse } from "../../core";
import type { CreateReaderCheckoutRequest, CreateReaderCheckoutResponse, Metadata, Reader, ReaderID, ReaderName, ReaderPairingCode, StatusResponse } from "../../types";
export type ListReadersResponse = {
items: Reader[];
};
export type CreateReaderParams = {
pairing_code: ReaderPairingCode;
name: ReaderName;
metadata?: Metadata;
};
export type UpdateReaderParams = {
name?: ReaderName;
metadata?: Metadata;
};
export type CreateReaderTerminateParams = Record<string, unknown>;
/**
* API resource for the Readers endpoints.
*
* A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments.
*/
export declare class Readers extends APIResource {
/**
* List all readers of the merchant.
*/
list(merchantCode: string, options?: RequestOptions): Promise<ListReadersResponse>;
listWithResponse(merchantCode: string, options?: RequestOptions): Promise<WithResponse<ListReadersResponse>>;
/**
* Create a new Reader for the merchant account.
*/
create(merchantCode: string, body: CreateReaderParams, options?: RequestOptions): Promise<Reader>;
createWithResponse(merchantCode: string, body: CreateReaderParams, options?: RequestOptions): Promise<WithResponse<Reader>>;
/**
* Retrieve a Reader.
*/
get(merchantCode: string, id: ReaderID, options?: RequestOptions): Promise<Reader>;
getWithResponse(merchantCode: string, id: ReaderID, options?: RequestOptions): Promise<WithResponse<Reader>>;
/**
* Delete a reader.
*/
delete(merchantCode: string, id: ReaderID, options?: RequestOptions): Promise<void>;
deleteWithResponse(merchantCode: string, id: ReaderID, options?: RequestOptions): Promise<WithResponse<void>>;
/**
* Update a Reader.
*/
update(merchantCode: string, id: ReaderID, body: UpdateReaderParams, options?: RequestOptions): Promise<Reader>;
updateWithResponse(merchantCode: string, id: ReaderID, body: UpdateReaderParams, options?: RequestOptions): Promise<WithResponse<Reader>>;
/**
* Creates a Checkout for a Reader.
*
* This process is asynchronous and the actual transaction may take some time to be started on the device.
*
*
* There are some caveats when using this endpoint:
* * The target device must be online, otherwise checkout won't be accepted
* * After the checkout is accepted, the system has 60 seconds to start the payment on the target device. During this time, any other checkout for the same device will be rejected.
*
*
* **Note**: If the target device is a Solo, it must be in version 3.3.24.3 or higher.
*
*/
createCheckout(merchantCode: string, readerId: string, body: CreateReaderCheckoutRequest, options?: RequestOptions): Promise<CreateReaderCheckoutResponse>;
createCheckoutWithResponse(merchantCode: string, readerId: string, body: CreateReaderCheckoutRequest, options?: RequestOptions): Promise<WithResponse<CreateReaderCheckoutResponse>>;
/**
* Provides the last known status for a Reader.
*
* This endpoint allows you to retrieve updates from the connected card reader, including the current screen being displayed during the payment process and the device status (battery level, connectivity, and update state).
*
* Supported States
*
* * `IDLE` – Reader ready for next transaction
* * `SELECTING_TIP` – Waiting for tip input
* * `WAITING_FOR_CARD` – Awaiting card insert/tap
* * `WAITING_FOR_PIN` – Waiting for PIN entry
* * `WAITING_FOR_SIGNATURE` – Waiting for customer signature
* * `UPDATING_FIRMWARE` – Firmware update in progress
*
* Device Status
*
* * `ONLINE` – Device connected and operational
* * `OFFLINE` – Device disconnected (last state persisted)
*
* **Note**: If the target device is a Solo, it must be in version 3.3.39.0 or higher.
*
*/
getStatus(merchantCode: string, readerId: string, options?: RequestOptions): Promise<StatusResponse>;
getStatusWithResponse(merchantCode: string, readerId: string, options?: RequestOptions): Promise<WithResponse<StatusResponse>>;
/**
* Terminate a Reader Checkout stops the current transaction on the target device.
*
* This process is asynchronous and the actual termination may take some time to be performed on the device.
*
*
* There are some caveats when using this endpoint:
* * The target device must be online, otherwise terminate won't be accepted
* * The action will succeed only if the device is waiting for cardholder action: e.g: waiting for card, waiting for PIN, etc.
* * There is no confirmation of the termination.
*
* If a transaction is successfully terminated and `return_url` was provided on Checkout, the transaction status will be sent as `failed` to the provided URL.
*
*
* **Note**: If the target device is a Solo, it must be in version 3.3.28.0 or higher.
*
*/
terminateCheckout(merchantCode: string, readerId: string, body?: CreateReaderTerminateParams, options?: RequestOptions): Promise<void>;
terminateCheckoutWithResponse(merchantCode: string, readerId: string, body?: CreateReaderTerminateParams, options?: RequestOptions): Promise<WithResponse<void>>;
}
//# sourceMappingURL=index.d.cts.map