'id' => array( 'type' => 'string', 'description' => esc_html__( 'The unique identifier for the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_order' => array( 'type' => 'integer', 'description' => esc_html__( 'The sort order of the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_type' => array( 'type' => 'string', 'description' => esc_html__( 'The type of payment provider. Use this to differentiate between the various items in the list and determine their intended use.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( 'type' => 'string', 'description' => esc_html__( 'The title of the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( 'type' => 'string', 'description' => esc_html__( 'The description of the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'supports' => array( 'description' => esc_html__( 'Supported features for this provider.', 'woocommerce' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'string', ), ), 'plugin' => array( 'type' => 'object', 'description' => esc_html__( 'The corresponding plugin details of the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( '_type' => array( 'type' => 'string', 'enum' => array( PaymentsProviders::EXTENSION_TYPE_WPORG, PaymentsProviders::EXTENSION_TYPE_MU_PLUGIN, PaymentsProviders::EXTENSION_TYPE_THEME, PaymentsProviders::EXTENSION_TYPE_UNKNOWN, ), 'description' => esc_html__( 'The type of the containing entity. Generally this is a regular plugin but it can also be a non-standard entity like a theme or a must-user plugin.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( 'type' => 'string', 'description' => esc_html__( 'The slug of the containing entity.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'file' => array( 'type' => 'string', 'description' => esc_html__( 'The plugin main file. This is a relative path to the plugins directory.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( 'type' => 'string', 'enum' => array( PaymentsProviders::EXTENSION_NOT_INSTALLED, PaymentsProviders::EXTENSION_INSTALLED, PaymentsProviders::EXTENSION_ACTIVE, ), 'description' => esc_html__( 'The status of the containing entity.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'image' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the provider image.', 'woocommerce' ), 'readonly' => true, ), 'icon' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the provider icon (square aspect ratio - 72px by 72px).', 'woocommerce' ), 'readonly' => true, ), 'links' => array( 'type' => 'array', 'description' => esc_html__( 'Links for the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'object', 'properties' => array( '_type' => array( 'type' => 'string', 'description' => esc_html__( 'The type of the link.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'url' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the link.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), 'state' => array( 'type' => 'object', 'description' => esc_html__( 'The general state of the provider with regards to it\'s payments processing.', 'woocommerce' ), 'properties' => array( 'enabled' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the provider is enabled for use on checkout.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'account_connected' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the provider has a payments processing account connected.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'needs_setup' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the provider needs setup.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'test_mode' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the provider is in test mode for payments processing.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'dev_mode' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the provider is in dev mode. Having this true usually leads to forcing test payments. ', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'management' => array( 'type' => 'object', 'description' => esc_html__( 'The management details of the provider.', 'woocommerce' ), 'properties' => array( '_links' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'settings' => array( 'type' => 'object', 'description' => esc_html__( 'The link to the settings page for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to the settings page for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), ), ), 'onboarding' => array( 'type' => 'object', 'description' => esc_html__( 'Onboarding-related details for the provider.', 'woocommerce' ), 'properties' => array( 'type' => array( 'type' => 'string', 'description' => esc_html__( 'The type of onboarding process the provider supports.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'state' => array( 'type' => 'object', 'description' => esc_html__( 'The state of the onboarding process.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), ), 'messages' => array( 'type' => 'object', 'description' => esc_html__( 'Various messages to possibly show the user.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'additionalProperties' => array( 'type' => 'string', 'description' => esc_html__( 'Message to show the user.', 'woocommerce' ), 'readonly' => true, ), ), 'steps' => array( 'type' => 'array', 'description' => esc_html__( 'The onboarding steps in case this provider supports native in-context onboarding.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_links' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'preload' => array( 'type' => 'object', 'description' => esc_html__( 'The onboarding preload link for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to do onboarding preload for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'onboard' => array( 'type' => 'object', 'description' => esc_html__( 'The start/continue onboarding link for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to start/continue onboarding for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'disable_test_account' => array( 'type' => 'object', 'description' => esc_html__( 'The link to disable the test account for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to POST to disable the test account for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'reset' => array( 'type' => 'object', 'description' => esc_html__( 'The link to reset the provider state/account and restart the onboarding.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to POST to for resetting the provider onboarding.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), 'recommended_payment_methods' => array( 'type' => 'array', 'description' => esc_html__( 'The list of recommended payment methods details for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'object', 'description' => esc_html__( 'The details for a recommended payment method.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'id' => array( 'type' => 'string', 'description' => esc_html__( 'The unique identifier for the payment method.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_order' => array( 'type' => 'integer', 'description' => esc_html__( 'The sort order of the payment method.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'enabled' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the payment method should be recommended as enabled or not.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'required' => array( 'type' => 'boolean', 'description' => esc_html__( 'Whether the payment method should be required (and force-enabled) or not.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( 'type' => 'string', 'description' => esc_html__( 'The title of the payment method. Does not include HTML tags.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( 'type' => 'string', 'description' => esc_html__( 'The description of the payment method. It can contain basic HTML.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'icon' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the payment method icon or a base64-encoded SVG image.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'notice' => array( 'type' => 'object', 'description' => esc_html__( 'An optional notice to display for this payment method (e.g., verification requirements).', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'badge' => array( 'type' => 'string', 'description' => esc_html__( 'Short text for a badge/chip displayed next to the payment method title.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'message' => array( 'type' => 'string', 'description' => esc_html__( 'Warning message displayed when the payment method is enabled. Plain text only.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'link_text' => array( 'type' => 'string', 'description' => esc_html__( 'Text for the call-to-action link in the notice.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'link_url' => array( 'type' => 'string', 'description' => esc_html__( 'URL for the call-to-action link in the notice.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), ), 'context' => array( 'type' => 'object', 'description' => esc_html__( 'Various contextual data for the onboarding process to use.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'tags' => array( 'type' => 'array', 'description' => esc_html__( 'The tags associated with the provider.', 'woocommerce' ), 'uniqueItems' => true, 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'string', 'description' => esc_html__( 'Tag associated with the provider.', 'woocommerce' ), 'readonly' => true, ), ), '_suggestion_id' => array( 'type' => 'string', 'description' => esc_html__( 'The suggestion ID matching this provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_incentive' => $this->get_schema_for_incentive(), '_links' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'attach' => array( 'type' => 'object', 'description' => esc_html__( 'The link to mark the suggestion as attached. This should be called when an extension is installed.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to attach the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'hide' => array( 'type' => 'object', 'description' => esc_html__( 'The link to hide the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to hide the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), ), ); } /** * Get the schema for a suggestion. * * @return array The schema for a suggestion. */ private function get_schema_for_suggestion(): array { return array( 'type' => 'object', 'description' => esc_html__( 'A suggestion with full details.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'id' => array( 'type' => 'string', 'description' => esc_html__( 'The unique identifier for the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_priority' => array( 'type' => 'integer', 'description' => esc_html__( 'The priority of the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_type' => array( 'type' => 'string', 'description' => esc_html__( 'The type of the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( 'type' => 'string', 'description' => esc_html__( 'The title of the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( 'type' => 'string', 'description' => esc_html__( 'The description of the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'plugin' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( '_type' => array( 'type' => 'string', 'enum' => array( PaymentsProviders::EXTENSION_TYPE_WPORG ), 'description' => esc_html__( 'The type of the plugin.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( 'type' => 'string', 'description' => esc_html__( 'The slug of the plugin.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( 'type' => 'string', 'enum' => array( PaymentsProviders::EXTENSION_NOT_INSTALLED, PaymentsProviders::EXTENSION_INSTALLED, PaymentsProviders::EXTENSION_ACTIVE, ), 'description' => esc_html__( 'The status of the plugin.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'image' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the image.', 'woocommerce' ), 'readonly' => true, ), 'icon' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the icon (square aspect ratio).', 'woocommerce' ), 'readonly' => true, ), 'links' => array( 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'object', 'properties' => array( '_type' => array( 'type' => 'string', 'description' => esc_html__( 'The type of the link.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'url' => array( 'type' => 'string', 'description' => esc_html__( 'The URL of the link.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), '_incentive' => $this->get_schema_for_incentive(), 'tags' => array( 'description' => esc_html__( 'The tags associated with the suggestion.', 'woocommerce' ), 'type' => 'array', 'uniqueItems' => true, 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'string', 'description' => esc_html__( 'The tags associated with the suggestion.', 'woocommerce' ), 'readonly' => true, ), ), 'category' => array( 'type' => 'string', 'description' => esc_html__( 'The category of the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_links' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'attach' => array( 'type' => 'object', 'description' => esc_html__( 'The link to mark the suggestion as attached. This should be called when an extension is installed.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to attach the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'hide' => array( 'type' => 'object', 'description' => esc_html__( 'The link to hide the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to hide the suggestion.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), ), ); } /** * Get the schema for an incentive. * * @return array The incentive schema. */ private function get_schema_for_incentive(): array { return array( 'type' => 'object', 'description' => esc_html__( 'The active incentive for the provider.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'id' => array( 'type' => 'string', 'description' => esc_html__( 'The incentive unique ID. This ID needs to be used for incentive dismissals.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'promo_id' => array( 'type' => 'string', 'description' => esc_html__( 'The incentive promo ID. This ID need to be fed into the onboarding flow.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( 'type' => 'string', 'description' => esc_html__( 'The incentive title. It can contain stylistic HTML.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( 'type' => 'string', 'description' => esc_html__( 'The incentive description. It can contain stylistic HTML.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'short_description' => array( 'type' => 'string', 'description' => esc_html__( 'The short description of the incentive. It can contain stylistic HTML.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cta_label' => array( 'type' => 'string', 'description' => esc_html__( 'The call to action label for the incentive.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tc_url' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to the terms and conditions for the incentive.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'badge' => array( 'type' => 'string', 'description' => esc_html__( 'The badge label for the incentive.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), '_dismissals' => array( 'type' => 'array', 'description' => esc_html__( 'The dismissals list for the incentive. Each dismissal entry includes a context and a timestamp. The `all` entry means the incentive was dismissed for all contexts.', 'woocommerce' ), 'uniqueItems' => true, 'context' => array( 'view', 'edit' ), 'readonly' => true, 'items' => array( 'type' => 'object', 'properties' => array( 'context' => array( 'type' => 'string', 'description' => esc_html__( 'Context ID in which the incentive was dismissed.', 'woocommerce' ), 'readonly' => true, ), 'timestamp' => array( 'type' => 'integer', 'description' => esc_html__( 'Unix timestamp representing when the incentive was dismissed.', 'woocommerce' ), 'readonly' => true, ), ), ), ), '_links' => array( 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'dismiss' => array( 'type' => 'object', 'description' => esc_html__( 'The link to dismiss the incentive.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to dismiss the incentive.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), 'onboard' => array( 'type' => 'object', 'description' => esc_html__( 'The start/continue onboarding link for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'href' => array( 'type' => 'string', 'description' => esc_html__( 'The URL to start/continue onboarding for the payment gateway.', 'woocommerce' ), 'context' => array( 'view', 'edit' ), 'readonly' => true, ), ), ), ), ), ), ); } }