PHP Класс WC_Payment_Gateway

Extended by individual payment gateways to handle payments.
Автор: WooThemes
Наследование: extends WC_Settings_API
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$availability string Available for all counties or specific.
$chosen boolean Chosen payment method id.
$countries array Countries this gateway is allowed for.
$description string Payment method description for the frontend.
$enabled string yes or no based on whether the method is enabled.
$has_fields boolean True if the gateway shows fields on the checkout.
$icon string Icon for the gateway.
$max_amount integer Maximum transaction amount, zero does not define a maximum.
$method_description string Gateway description.
$method_title string Gateway title.
$new_method_label string Optional label to show for "new payment method" in the payment method/token selection radio selection.
$order_button_text string Set if the place order button should be renamed on selection.
$supports array Supported features such as 'default_credit_card_form', 'refunds'.
$title string Payment method title for the frontend.
$view_transaction_url string Optional URL to view a transaction.

Защищенные свойства (Protected)

Свойство Тип Описание
$tokens array Contains a users saved tokens for this gateway.

Открытые методы

Метод Описание
admin_options ( ) Output the gateway settings screen.
credit_card_form ( array $args = [], array $fields = [] ) Core credit card form which gateways can used if needed. Deprecated - inheirt WC_Payment_Gateway_CC instead.
get_description ( ) : string Return the gateway's description.
get_icon ( ) : string Return the gateway's icon.
get_method_description ( ) : string Return the description for admin screens.
get_method_title ( ) : string Return the title for admin screens.
get_new_payment_method_option_html ( ) Displays a radio button for entering a new payment method (new CC details) instead of using a saved method.
get_return_url ( WC_Order $order = null ) : string Get the return url (thank you page).
get_saved_payment_method_option_html ( WC_Payment_Token $token ) : string Gets saved payment method HTML from a token.
get_title ( ) : string Return the gateway's title.
get_tokens ( ) : array Returns a users saved tokens for this gateway.
get_transaction_url ( WC_Order $order ) : string Get a link to the transaction on the 3rd party gateway size (if applicable).
has_fields ( ) : boolean Check if the gateway has fields on the checkout.
init_settings ( ) Init settings for gateways.
is_available ( ) : boolean Check if the gateway is available for use.
payment_fields ( ) If There are no payment fields show the description if set.
process_payment ( integer $order_id ) : array Process Payment.
process_refund ( integer $order_id, float $amount = null, string $reason = '' ) : boolean Process refund.
save_payment_method_checkbox ( ) Outputs a checkbox for saving a new payment method to the database.
saved_payment_methods ( ) Grab and display our saved payment methods.
set_current ( ) Set as current gateway.
supports ( string $feature ) : boolean Check if a gateway supports a given feature.
tokenization_script ( ) Enqueues our tokenization script to handle some of the new form options.
validate_fields ( ) : boolean Validate frontend fields.

Защищенные методы

Метод Описание
get_order_total ( ) : float Get the order total in checkout and pay_for_order.

Описание методов

admin_options() публичный Метод

Output the gateway settings screen.
public admin_options ( )

credit_card_form() публичный Метод

Core credit card form which gateways can used if needed. Deprecated - inheirt WC_Payment_Gateway_CC instead.
public credit_card_form ( array $args = [], array $fields = [] )
$args array
$fields array

get_description() публичный Метод

Return the gateway's description.
public get_description ( ) : string
Результат string

get_icon() публичный Метод

Return the gateway's icon.
public get_icon ( ) : string
Результат string

get_method_description() публичный Метод

Return the description for admin screens.
public get_method_description ( ) : string
Результат string

get_method_title() публичный Метод

Return the title for admin screens.
public get_method_title ( ) : string
Результат string

get_new_payment_method_option_html() публичный Метод

Only displayed when a gateway supports tokenization.
С версии: 2.6.0

get_order_total() защищенный Метод

Get the order total in checkout and pay_for_order.
protected get_order_total ( ) : float
Результат float

get_return_url() публичный Метод

Get the return url (thank you page).
public get_return_url ( WC_Order $order = null ) : string
$order WC_Order
Результат string

get_saved_payment_method_option_html() публичный Метод

Gets saved payment method HTML from a token.
С версии: 2.6.0
public get_saved_payment_method_option_html ( WC_Payment_Token $token ) : string
$token WC_Payment_Token Payment Token
Результат string Generated payment method HTML

get_title() публичный Метод

Return the gateway's title.
public get_title ( ) : string
Результат string

get_tokens() публичный Метод

Returns a users saved tokens for this gateway.
С версии: 2.6.0
public get_tokens ( ) : array
Результат array

get_transaction_url() публичный Метод

Get a link to the transaction on the 3rd party gateway size (if applicable).
public get_transaction_url ( WC_Order $order ) : string
$order WC_Order the order object.
Результат string transaction URL, or empty string.

has_fields() публичный Метод

Check if the gateway has fields on the checkout.
public has_fields ( ) : boolean
Результат boolean

init_settings() публичный Метод

Init settings for gateways.
public init_settings ( )

is_available() публичный Метод

Check if the gateway is available for use.
public is_available ( ) : boolean
Результат boolean

payment_fields() публичный Метод

Override this in your gateway if you have some.
public payment_fields ( )

process_payment() публичный Метод

Process the payment. Override this in your gateway. When implemented, this should. return the success and redirect in an array. e.g: return array( 'result' => 'success', 'redirect' => $this->get_return_url( $order ) );
public process_payment ( integer $order_id ) : array
$order_id integer
Результат array

process_refund() публичный Метод

If the gateway declares 'refunds' support, this will allow it to refund. a passed in amount.
public process_refund ( integer $order_id, float $amount = null, string $reason = '' ) : boolean
$order_id integer
$amount float
$reason string
Результат boolean True or false based on success, or a WP_Error object.

save_payment_method_checkbox() публичный Метод

Outputs a checkbox for saving a new payment method to the database.
С версии: 2.6.0

saved_payment_methods() публичный Метод

Grab and display our saved payment methods.
С версии: 2.6.0

set_current() публичный Метод

Set this as the current gateway.
public set_current ( )

supports() публичный Метод

Gateways should override this to declare support (or lack of support) for a feature. For backward compatibility, gateways support 'products' by default, but nothing else.
С версии: 1.5.7
public supports ( string $feature ) : boolean
$feature string string The name of a feature to test support for.
Результат boolean True if the gateway supports the feature, false otherwise.

tokenization_script() публичный Метод

Enqueues our tokenization script to handle some of the new form options.
С версии: 2.6.0
public tokenization_script ( )

validate_fields() публичный Метод

Validate payment fields on the frontend.
public validate_fields ( ) : boolean
Результат boolean

Описание свойств

$availability публичное свойство

Available for all counties or specific.
public string $availability
Результат string

$chosen публичное свойство

Chosen payment method id.
public bool $chosen
Результат boolean

$countries публичное свойство

Countries this gateway is allowed for.
public array $countries
Результат array

$description публичное свойство

Payment method description for the frontend.
public string $description
Результат string

$enabled публичное свойство

yes or no based on whether the method is enabled.
public string $enabled
Результат string

$has_fields публичное свойство

True if the gateway shows fields on the checkout.
public bool $has_fields
Результат boolean

$icon публичное свойство

Icon for the gateway.
public string $icon
Результат string

$max_amount публичное свойство

Maximum transaction amount, zero does not define a maximum.
public int $max_amount
Результат integer

$method_description публичное свойство

Gateway description.
public string $method_description
Результат string

$method_title публичное свойство

Gateway title.
public string $method_title
Результат string

$new_method_label публичное свойство

Optional label to show for "new payment method" in the payment method/token selection radio selection.
public string $new_method_label
Результат string

$order_button_text публичное свойство

Set if the place order button should be renamed on selection.
public string $order_button_text
Результат string

$supports публичное свойство

Supported features such as 'default_credit_card_form', 'refunds'.
public array $supports
Результат array

$title публичное свойство

Payment method title for the frontend.
public string $title
Результат string

$tokens защищенное свойство

Contains a users saved tokens for this gateway.
protected array $tokens
Результат array

$view_transaction_url публичное свойство

Optional URL to view a transaction.
public string $view_transaction_url
Результат string