WooCommerce Code Reference

DefaultPaymentGateways
in package

Default Payment Gateways

Table of Contents

$recommendation_priority  : array<string|int, mixed>
This is the default priority for countries that are not in the $recommendation_priority_map.
get_all()  : array<string|int, mixed>
Get default specs.
get_rules_for_cbd()  : array<string|int, mixed>
Get default rules for CBD based on given argument.
get_rules_for_countries()  : object
Get rules that match the store base location to one of the provided countries.
get_rules_for_selling_venues()  : object
Get rules that match the store's selling venues.
get_rules_selling_offline()  : object
Get rules for when selling offline for core profiler.
get_wcpay_countries()  : array<string|int, mixed>
Get array of countries supported by WCPay depending on feature flag.
get_default_recommendation_priority()  : int
Get the default recommendation priority for a payment gateway.
get_recommendation_priority()  : int|null
Get recommendation priority for a given payment gateway by id and country.

Properties

$recommendation_priority

This is the default priority for countries that are not in the $recommendation_priority_map.

private static array<string|int, mixed> $recommendation_priority = array( 'woocommerce_payments' => 1, 'woocommerce_payments:with-in-person-payments' => 1, 'woocommerce_payments:without-in-person-payments' => 1, 'stripe' => 2, 'woo-mercado-pago-custom' => 3, // PayPal Payments. 'ppcp-gateway' => 4, 'mollie_wc_gateway_banktransfer' => 5, 'razorpay' => 5, 'payfast' => 5, 'payubiz' => 6, 'square_credit_card' => 6, 'klarna_payments' => 6, // Klarna Checkout. 'kco' => 6, 'paystack' => 6, 'eway' => 7, 'amazon_payments_advanced' => 7, 'affirm' => 8, 'afterpay' => 9, 'zipmoney' => 10, 'payoneer-checkout' => 11, )

Priority is used to determine which payment gateway to recommend first. The lower the number, the higher the priority.

Methods

get_rules_for_cbd()

Get default rules for CBD based on given argument.

public static get_rules_for_cbd(bool $should_have) : array<string|int, mixed>
Parameters
$should_have : bool

Whether or not the store should have CBD as an industry (true) or not (false).

Return values
array<string|int, mixed>Rules to match.

get_rules_for_countries()

Get rules that match the store base location to one of the provided countries.

public static get_rules_for_countries(array<string|int, mixed> $countries) : object
Parameters
$countries : array<string|int, mixed>

Array of countries to match.

Return values
objectRules to match.

get_rules_for_selling_venues()

Get rules that match the store's selling venues.

public static get_rules_for_selling_venues(array<string|int, mixed> $selling_venues) : object
Parameters
$selling_venues : array<string|int, mixed>

Array of venues to match.

Return values
objectRules to match.

get_default_recommendation_priority()

Get the default recommendation priority for a payment gateway.

private static get_default_recommendation_priority(string $id) : int

This is used when a country is not in the $recommendation_priority_map array.

Parameters
$id : string

Payment gateway id.

Return values
intPriority.

get_recommendation_priority()

Get recommendation priority for a given payment gateway by id and country.

private static get_recommendation_priority(string $gateway_id, string $country_code) : int|null

If country is not supported, return null.

Parameters
$gateway_id : string

Payment gateway id.

$country_code : string

Store country code.

Return values
int|nullPriority. Priority is 0-indexed, so 0 is the highest priority.