UNPKG

@bebapps/rapyd-sdk

Version:

An un-official [Rapyd](https://rapyd.net) SDK for Node.js.

146 lines (144 loc) 5.61 kB
import { Address } from './Address'; import { Discount } from './Discount'; export interface Customer { /** * ID of the Customer object. String starting with **cus_**. */ id: `cus_${string}`; /** * Address object. For details, see [Address Object](ref:address-object). */ address: Partial<Address>; /** * Describes the addresses associated with this customer. * * For more information, see [Address Object](#address-object). */ addresses: (object)[]; /** * The tax ID number of the customer. Relevant when the customer is a business. */ business_vat_id: string; /** * Category of payment method. Possible values: * * **bank_redirect** * * **bank_transfer** * * **card** * * **cash** * * **ewallet** * * **rapyd_ewallet** * * Response only. */ category: 'bank_redirect' | 'bank_transfer' | 'card' | 'cash' | 'ewallet' | 'rapyd_ewallet'; /** * The ID of a discount coupon that is assigned to this customer. The coupon must use the same currency as the customer's default payment method. * * For more information, see [Coupon Object](#coupon-object). */ coupon: string; /** * Time of creation of this customer, in [*Unix time*](ref:glossary). * * Response only. */ created_at: number; /** * ID of the customer, a string starting with **cus_**. */ customer: `cus_${string}`; /** * The payment method that is used when the 'payment' object or subscription does not specify a payment method. Must appear in the `payment_methods` list. The payment method is referenced by its `name` field. */ default_payment_method: string | object; /** * Indicates whether there is currently a failure of an automatic payment that is part of a subscription, or an invoice that was not paid when due. * * **true**: The account is delinquent. * * **false**: The account is current. * * Response only. */ delinquent: boolean; /** * A text description of the customer. */ description: string; /** * Contains information about the coupon that applies to the customer. Read-only field. * * Adding a discount is a 2-step process: * 1. [Create Coupon](ref:create-coupon), which returns a coupon ID. * 2. Add the coupon ID to the `coupon` field of the customer with [Create Customer](ref:create-customer) or [Update Customer](ref:update-customer). * * For more information, see [Discount Object](ref:discount-object). */ discount: Partial<Discount>; /** * Customer's email address. Maximum 512 characters. */ email: string; /** * ID of the wallet that is linked to the customer. String starting with **ewallet_**. * * Each wallet can be associated with only one customer. */ ewallet: `ewallet_${string}`; /** * Contains the fields that are required for the specific payment method. * * To determine what fields are required for the payment method, see [Get Payment Method Required Fields](ref:retrieve-payment-method-required-fields). */ fields: object; /** * A custom string that is prefixed to all invoices for this customer. For more information, see [Invoice Object](ref:invoice-object). */ invoice_prefix: string; /** * A JSON object defined by the client. */ metadata: object; /** * The name of the customer. * * Business - The company name. * * Individual - The person's name. */ name: string; /** * An object containing the following fields: * * `data` - A list of up to three payment methods. See [Payment Method Object](ref:payment-method-object). * * `has_more` - Indicates whether there are more than three payment methods for this customer. * * `total_count` - Total number of payment methods for this customer. * * `url` - URL for requesting all of the payment methods for this customer. * * **Note:** You cannot delete a payment method that is the designated default payment method. * * You can include a payment method when you create the customer using [Create Customer](ref:create-customer), or you can add it later with [Add Payment Method to Customer](ref:add-payment-method-to-customer). */ payment_methods: { data: unknown; has_more: unknown; total_count: unknown; url: unknown }; /** * Customer's primary phone number in E.164 format. The merchant is responsible for verifying that the number is correct. One method of verifying could be to send an activation code to the phone by SMS, with a limited time for response. */ phone_number: string; /** * An object containing the following fields: * * `data` - A list of up to three subscriptions. * * `has_more` - Indicates whether there are more than three subscriptions for this customer. * * `total_count` - Total number of subscriptions for this customer. * * `url` - URL for requesting all of the subscriptions for this customer. * * To add a subscription to a customer, use [Create Subscription](ref:create-subscription). For more information, see [Subscription Object](ref:subscription-object) */ subscriptions: { data: unknown; has_more: unknown; total_count: unknown; url: unknown }; /** * ID of the token that represents the card. Relevant to cards. * * For more information, see [Token Object for Card](ref:token-object-for-card). */ token: string; /** * Name of the payment method type. For example, **us_mastercard_card**. * * To get a list of payment methods for a country, use [List Payment Methods by Country](ref:list-payment-methods-by-country). */ type: string; };