@sumup/sdk
Version:
The official TypeScript SDK for the SumUp API
460 lines • 16.2 kB
TypeScript
import * as Core from "../../core";
/**
* Object attributes that are modifiable only by SumUp applications.
*/
export type Attributes = Record<string, unknown>;
/**
* An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
* country code. This definition users `oneOf` with a two-character string
* type to allow for support of future countries in client code.
*/
export type CountryCode = string;
/**
* An address somewhere in the world. The address fields used depend on the country conventions. For example, in Great Britain, `city` is `post_town`. In the United States, the top-level administrative unit used in addresses is `state`, whereas in Chile it's `region`.
* Whether an address is valid or not depends on whether the locally required fields are present. Fields not supported in a country will be ignored.
*
* Address documentation: https://sumup.roadie.so/docs/default/Component/merchants/merchant/#addresses
*/
export type Address = {
street_address?: string[];
/**
* The postal code (aka. zip code) of the address.
*
*/
post_code?: string;
country: CountryCode;
/**
* The city of the address.
*
*/
city?: string;
/**
* The province where the address is located. This may not be relevant in some countries.
*
*/
province?: string;
/**
* The region where the address is located. This may not be relevant in some countries.
*
*/
region?: string;
/**
* A county is a geographic region of a country used for administrative or other purposes in some nations. Used in countries such as Ireland, Romania, etc.
*
*/
county?: string;
/**
* In Spain, an autonomous community is the first sub-national level of political and administrative division.
*
*/
autonomous_community?: string;
/**
* A post town is a required part of all postal addresses in the United Kingdom and Ireland, and a basic unit of the postal delivery system.
*
*/
post_town?: string;
/**
* Most often, a country has a single state, with various administrative divisions. The term "state" is sometimes used to refer to the federated polities that make up the federation. Used in countries such as the United States and Brazil.
*
*/
state?: string;
/**
* Locality level of the address. Used in countries such as Brazil or Chile.
*
*/
neighborhood?: string;
/**
* In many countries, terms cognate with "commune" are used, referring to the community living in the area and the common interest. Used in countries such as Chile.
*
*/
commune?: string;
/**
* A department (French: département, Spanish: departamento) is an administrative or political division in several countries. Used in countries such as Colombia.
*
*/
department?: string;
/**
* A municipality is usually a single administrative division having corporate status and powers of self-government or jurisdiction as granted by national and regional laws to which it is subordinate. Used in countries such as Colombia.
*
*/
municipality?: string;
/**
* A district is a type of administrative division that in some countries is managed by the local government. Used in countries such as Portugal.
*
*/
district?: string;
/**
* A US system of postal codes used by the United States Postal Service (USPS).
*
*/
zip_code?: string;
/**
* A postal address in Ireland.
*
*/
eircode?: string;
};
export type PersonalIdentifier = {
/**
* The unique reference for the personal identifier type.
*/
ref: string;
/**
* The company identifier value.
*/
value: string;
};
/**
* A publicly available phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.
*
*/
export type PhoneNumber = string;
export type Ownership = {
/**
* The percent of ownership shares held by the person expressed in percent mille (1/100000). Only persons with the relationship `owner` can have ownership.
*
*/
share: number;
};
/**
* The version of the resource. The version reflects a specific change submitted to the API via one of the `PATCH` endpoints.
*
*/
export type Version = string;
/**
* Reflects the status of changes submitted through the `PATCH` endpoints for the merchant or persons. If some changes have not been applied yet, the status will be `pending`. If all changes have been applied, the status `done`.
* The status is only returned after write operations or on read endpoints when the `version` query parameter is provided.
*
*/
export type ChangeStatus = string;
/**
* Base schema for a person associated with a merchant. This can be a legal representative, business owner (ultimate beneficial owner), or an officer. A legal representative is the person who registered the merchant with SumUp. They should always have a `user_id`.
*
*
* Person documentation: https://developer.sumup.com/tools/models/merchant#persons
*/
export type BasePerson = {
/**
* The unique identifier for the person. This is a [typeid](https://github.com/sumup/typeid).
*
*/
id: string;
/**
* A corresponding identity user ID for the person, if they have a user account.
*
*/
user_id?: string;
/**
* The date of birth of the individual, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format.
*
*/
birthdate?: string;
/**
* The first name(s) of the individual.
*/
given_name?: string;
/**
* The last name(s) of the individual.
*/
family_name?: string;
/**
* Middle name(s) of the End-User. Note that in some cultures, people can have multiple middle names; all can be present, with the names being separated by space characters. Also note that in some cultures, middle names are not used.
*
*/
middle_name?: string;
phone_number?: PhoneNumber;
/**
* A list of roles the person has in the merchant or towards SumUp. A merchant must have at least one person with the relationship `representative`.
*
*/
relationships?: string[];
ownership?: Ownership;
address?: Address;
/**
* A list of country-specific personal identifiers.
*
*/
identifiers?: PersonalIdentifier[];
citizenship?: CountryCode;
/**
* The persons nationality. May be an [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code, but legacy data may not conform to this standard.
*
*/
nationality?: string | null;
/**
* An [ISO3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code representing the country where the person resides.
*
*/
country_of_residence?: string | null;
version?: Version;
change_status?: ChangeStatus;
};
export type Person = BasePerson;
export type ListPersonsResponseBody = {
items: Person[];
};
/**
* The unique legal type reference as defined in the country SDK. We do not rely on IDs as used by other services. Consumers of this API are expected to use the country SDK to map to any other IDs, translation keys, or descriptions.
*
*
* The country SDK documentation for legal types.: https://developer.sumup.com/tools/models/merchant#legal-types
*/
export type LegalType = string;
export type CompanyIdentifier = {
/**
* The unique reference for the company identifier type as defined in the country SDK.
*
*/
ref: string;
/**
* The company identifier value.
*
*/
value: string;
};
/**
* A list of country-specific company identifiers.
*
*/
export type CompanyIdentifiers = CompanyIdentifier[];
/**
* Information about the company or business. This is legal information that is used for verification.
*
*
* Company documentation: https://developer.sumup.com/tools/models/merchant#company
*/
export type Company = {
/**
* The company's legal name.
*/
name?: string;
/**
* The merchant category code for the account as specified by [ISO18245](https://www.iso.org/standard/33365.html). MCCs are used to classify businesses based on the goods or services they provide.
*
*/
merchant_category_code?: string;
legal_type?: LegalType;
address?: Address;
trading_address?: Address;
identifiers?: CompanyIdentifiers;
phone_number?: PhoneNumber;
/**
* HTTP(S) URL of the company's website.
*
*/
website?: string | null;
attributes?: Attributes;
};
/**
* Settings used to apply the Merchant's branding to email receipts, invoices, checkouts, and other products.
*/
export type Branding = {
/**
* An icon for the merchant. Must be square.
*
*/
icon?: string;
/**
* A logo for the merchant that will be used in place of the icon and without the merchant's name next to it if there's sufficient space.
*
*/
logo?: string;
/**
* Data-URL encoded hero image for the merchant business.
*
*/
hero?: string;
/**
* A hex color value representing the primary branding color of this merchant (your brand color).
*
*/
primary_color?: string;
/**
* A hex color value representing the color of the text displayed on branding color of this merchant.
*
*/
primary_color_fg?: string;
/**
* A hex color value representing the secondary branding color of this merchant (accent color used for buttons).
*
*/
secondary_color?: string;
/**
* A hex color value representing the color of the text displayed on secondary branding color of this merchant.
*
*/
secondary_color_fg?: string;
/**
* A hex color value representing the preferred background color of this merchant.
*
*/
background_color?: string;
};
/**
* Business information about the merchant. This information will be visible to the merchant's customers.
*
*/
export type BusinessProfile = {
/**
* The customer-facing business name.
*/
name?: string;
/**
* The descriptor is the text that your customer sees on their bank account statement.
* The more recognisable your descriptor is, the less risk you have of receiving disputes (e.g. chargebacks).
*
*/
dynamic_descriptor?: string;
/**
* The business's publicly available website.
*/
website?: string;
/**
* A publicly available email address.
*/
email?: string;
phone_number?: PhoneNumber;
address?: Address;
branding?: Branding;
};
/**
* A set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
*
* **Warning**: Updating Meta will overwrite the existing data. Make sure to always include the complete JSON object.
*/
export type Meta = Record<string, string>;
export type ClassicMerchantIdentifiers = {
/**
* Classic (serial) merchant ID.
*
* @deprecated
*/
id: number;
};
export type Timestamps = {
/**
* The date and time when the resource was created. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
*
*/
created_at: string;
/**
* The date and time when the resource was last updated. This is a string as defined in [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6).
*
*/
updated_at: string;
};
/**
* Merchant
*
* Merchant documentation: https://developer.sumup.com/tools/models/merchant
*/
export type Merchant = {
/**
* Short unique identifier for the merchant.
*/
merchant_code: string;
/**
* ID of the organization the merchant belongs to (if any).
*/
organization_id?: string;
/**
* The business type.
* * `sole_trader`: The business is run by an self-employed individual.
* * `company`: The business is run as a company with one or more shareholders
* * `partnership`: The business is run as a company with two or more shareholders that can be also other legal entities
* * `non_profit`: The business is run as a nonprofit organization that operates for public or social benefit
* * `government_entity`: The business is state owned and operated
*
*/
business_type?: string;
company?: Company;
country: CountryCode;
business_profile?: BusinessProfile;
/**
* A user-facing small-format logo for use in dashboards and other user-facing applications. For customer-facing branding see `merchant.business_profile.branding`.
*
*/
avatar?: string;
/**
* A user-facing name of the merchant account for use in dashboards and other user-facing applications. For customer-facing business name see `merchant.business_profile`.
*
*/
alias?: string;
/**
* Three-letter [ISO currency code](https://en.wikipedia.org/wiki/ISO_4217) representing the default currency for the account.
*
*/
default_currency: string;
/**
* Merchant's default locale, represented as a BCP47 [RFC5646](https://datatracker.ietf.org/doc/html/rfc5646) language tag. This is typically an ISO 639-1 Alpha-2 [ISO639‑1](https://www.iso.org/iso-639-language-code) language code in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1](https://www.iso.org/iso-3166-country-codes.html) country code in uppercase, separated by a dash. For example, en-US or fr-CA.
* In multilingual countries this is the merchant's preferred locale out of those, that are officially spoken in the country. In a countries with a single official language this will match the official language.
*/
default_locale: string;
/**
* True if the merchant is a sandbox for testing.
*/
sandbox?: boolean;
meta?: Meta;
classic?: ClassicMerchantIdentifiers;
version?: Version;
change_status?: ChangeStatus;
} & Timestamps;
export type BaseError = {
/**
* A unique identifier for the error instance. This can be used to trace the error back to the server logs.
*
*/
instance?: string;
/**
* A human-readable message describing the error that occurred.
*
*/
message?: string;
};
/**
* The category of the error.
*
*/
export type ErrorCategoryClient = "client_error";
/**
* An error code specifying the exact error that occurred.
*
*/
export type ErrorCodeNotFound = "not_found";
/**
* The category of the error.
*
*/
export type ErrorCategoryServer = "server_error";
/**
* An error code specifying the exact error that occurred.
*
*/
export type ErrorCodeInternalServerError = "internal_error";
export type GetMerchantQueryParams = {
version?: string;
};
export type ListPersonsQueryParams = {
version?: string;
};
export type GetPersonQueryParams = {
version?: string;
};
export declare class Merchants extends Core.APIResource {
/**
* Retrieve a merchant.
*/
get(merchantCode: string, query?: GetMerchantQueryParams, params?: Core.FetchParams): Core.APIPromise<Merchant>;
/**
* Returns a list of persons related to the merchant.
*/
listPersons(merchantCode: string, query?: ListPersonsQueryParams, params?: Core.FetchParams): Core.APIPromise<ListPersonsResponseBody>;
/**
* Returns a single person related to the merchant.
*/
getPerson(merchantCode: string, personId: string, query?: GetPersonQueryParams, params?: Core.FetchParams): Core.APIPromise<Person>;
}
export declare namespace Merchants {
export type { Address, Attributes, BaseError, BasePerson, Branding, BusinessProfile, ChangeStatus, ClassicMerchantIdentifiers, Company, CompanyIdentifier, CompanyIdentifiers, CountryCode, ErrorCategoryClient, ErrorCategoryServer, ErrorCodeInternalServerError, ErrorCodeNotFound, GetMerchantQueryParams, GetPersonQueryParams, LegalType, ListPersonsQueryParams, ListPersonsResponseBody, Merchant, Meta, Ownership, Person, PersonalIdentifier, PhoneNumber, Timestamps, Version, };
}
//# sourceMappingURL=index.d.ts.map