UNPKG

@bebapps/rapyd-sdk

Version:

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

232 lines (230 loc) 9.86 kB
import { CustomElements } from './CustomElements'; import { PaymentFees } from './PaymentFees'; import { GetPaymentMethodRequiredFieldsRequest } from '../requests/GetPaymentMethodRequiredFieldsRequest'; export interface CheckoutPage { /** * ID of the Rapyd checkout page. String starting with **checkout_**. */ id: `checkout_${string}`; /** * The amount of the payment, in units of the currency defined in `currency`. Decimal, including the correct number of decimal places for the currency exponent, as defined in ISO 2417:2015. If the amount is a whole number, use an integer and not a decimal. */ amount: number; /** * URL where the customer is redirected when the customer closes the checkout page before completing the payment. This page can be set dynamically for each generated checkout page as it overrides the fallback URL that was set in the Client Portal. * * Does not support localhost URLs. */ cancel_checkout_url: string; /** * Describes the cart items that the customer is purchasing. These items are displayed at the checkout page. Contains the following fields for each cart item: * - `name` - The name of the item. Required. * - `amount` - The price of the item in the currency defined in `currency`. Required. * - `quantity` - The quantity of the item. Required. * - `image` - The image that appears in the checkout page for this item. */ cart_items: ({ name: unknown; amount: unknown; quantity: unknown; image: unknown })[]; /** * Determines whether to redirect to `complete_checkout_url` when the customer is finished with the online checkout page. One of the following: * - **true** - Redirect to display the page in the URL specified in `complete_checkout_url`. * - **false** - Display the default Thank You page. This is the default. */ complete_auto_redirect: boolean; /** * Reserved. */ complete_checkout_auto_redirect: string; /** * URL where the customer is redirected when checkout is successful. This page can be set dynamically for each generated checkout page as it overrides the fallback URL that was set in the Client Portal. * * Does not support localhost URLs. */ complete_checkout_url: string; /** * URL where the customer is redirected after completing the payment instructions on the third party site. * * Relevant to bank redirect payment methods. * * Does not support localhost URLs. */ complete_payment_url: string; /** * The two-letter ISO 3166-1 ALPHA-2 code for the country. Uppercase. * * To determine the code for a country, see [List Countries](ref:list-countries). */ country: string; /** * Name of the country in English. */ country_name: string; /** * Defines the currency for the amount received by the seller (merchant). Three-letter ISO 4217 code. * * In FX transactions, when `fixed_side` is **buy**, it is the currency received by the merchant. When `fixed_side` is **sell**, it is the currency charged to the buyer. */ currency: string; /** * Describes customizations of the page as it appears to the customer. See [Custom Elements Object](ref:custom-elements-object). */ custom_elements: Partial<CustomElements>; /** * ID of the customer. String starting with **cus_**. When used, the customer has the option to save card details for future purchases. */ customer: `cus_${string}`; /** * The customer's default payment method. */ customer_default_payment_method: object; /** * Description of the payment transaction. */ description: string; /** * URL where the customer is redirected after an error occurs on the third-party site. * * Relevant to bank redirect payment methods. * * Does not support localhost URLs. */ error_payment_url: string; /** * ID of the wallet that the money is paid into. String starting with **ewallet_**. */ ewallet: `ewallet_${string}`; /** * Time when the payment expires if it is not completed, in [*Unix time*](ref:glossary). When both `expiration` and `payment_expiration` are set, the payment expires at the earlier time. Default is 14 days after creation of the checkout page. */ expiration: number; /** * Indicates whether the FX rate is fixed for the buy side (seller) or for the sell side (buyer). * One of the following values: * - **buy** - The checkout page shows the currency that the seller (merchant) receives for goods or services. This is the default. For example, a US-based merchant wants to charge 100 USD. The buyer (customer) pays the amount in MXN that converts to 100 USD. * - **sell** - The checkout page shows the currency that the buyer is charged with to purchase goods or services from the seller. For example, a US-based merchant wants to charge a buyer 2,000 MXN and will accept whatever amount in USD that is converted from 2,000 MXN. */ fixed_side: 'buy' | 'sell'; /** * Determines the default language of the hosted page. * The values are documented in [Hosted Page Language Support](ref:hosted-page-language-support). */ language: string; /** * Reserved. Default is 'Rapyd'. */ merchant_alias: string; /** * Color of the action button on the hosted page. Response only. * * To configure this field, use the Client Portal. */ merchant_color: string; /** * Contact details for customer support, containing the following fields: * - `email` - Email address. * - `url` - URL for the client's customer support service. * - `phone_number` - Phone number for contacting the client's customer support service. * Response only. * * To configure these fields, use the Client Portal. */ merchant_customer_support: { email: unknown; url: unknown; phone_number: unknown }; /** * URL for the image of the client's logo. */ merchant_logo: string; /** * Identifier for the transaction. Defined by the merchant. Can be used for reconciliation. */ merchant_reference_id: string; /** * URL of the client's website. */ merchant_website: string; /** * A JSON object defined by the client. */ metadata: object; /** * End of the time when the customer can use the checkout page, in [*Unix time*](ref:glossary). * If `page_expiration` is not set, the checkout page expires 14 days after creation. Range: 1 minute to 30 days. */ page_expiration: number; /** * Length of time for the payment to be completed after it is created, measured in seconds. When both `expiration` and `payment_expiration` are set, the payment expires at the earlier time. */ payment_expiration: number; /** * Describes the fees that can be charged for a payment transaction. See [Payment Fees Object](ref:payment-fees-object). */ payment_fees: Partial<PaymentFees>; /** * Object that describes the payment method. Contains the following fields: * - `type` - The type of the payment method. Required. * - `fields` - Contains the fields that are required for the payment method. See [Get Payment Method Required Fields](ref:get-payment-method-required-fields). * - `name` - Name of the payment method. * - `address` - 'Address' object that describes the address associated with the payment. See [Address Object](ref:address-object). Do not use an address ID. * - `metadata` - 'Metadata' object defined by the merchant. See [Metadata Object](ref:metadata-object). * * **Note:** This behavior is different from [Create Payment](ref:create-payment). */ payment_method: { type: unknown; fields: unknown; name: unknown; address: unknown; metadata: unknown }; /** * The type of the payment method. For example, **it_visa_card**. * * To get a list of payment methods for a country, use [List Payment Methods by Country](ref:list-payment-methods-by-country). * * See [Determining Payment Methods](ref:determining-payment-methods). */ payment_method_type: string; /** * A list of the categories of payment method that are supported on the checkout page. The categories appear on the page in the order provided. One or more of the following: * - **bank_redirect** * - **bank_transfer** * - **card** * - **cash** * - **ewallet** * * See [Determining Payment Methods](ref:determining-payment-methods). */ payment_method_type_categories: ('bank_redirect' | 'bank_transfer' | 'card' | 'cash' | 'ewallet')[]; /** * List of payment methods that are excluded from display on the checkout page. * * See [Determining Payment Methods](ref:determining-payment-methods). */ payment_method_types_exclude: (string)[]; /** * List of payment methods that are displayed on the checkout page. The payment methods appear on the page in the order provided. * * See [Determining Payment Methods](ref:determining-payment-methods). */ payment_method_types_include: (string)[]; /** * URL of the checkout page that is shown to the customer. */ redirect_url: string; /** * When `fixed_side` is **sell**, it is the currency received by the merchant. * * When `fixed_side` is **buy**, it is the currency charged to the buyer (customer). The checkout page displays the following information: * - The original amount and currency. * - The converted amount in the requested currency. * - The exchange rate. * * Three-letter ISO 4217 code. * * Relevant to payments with FX. */ requested_currency: string; /** * Indicates the payment status. One of the following values: * - **NEW** - New payment. * - **ACT** - Active payment. * - **CLO** - Closed payment. */ status: 'NEW' | 'ACT' | 'CLO'; /** * Time of creation of the checkout page, in [*Unix time*](ref:glossary). Response only. */ timestamp: number; };