API ReferenceGateways

Gateways

List the gateways and currencies the merchant has enabled.

Guide: Payments and refunds.

Get gateways

paylexer_get_gateways( array $args = [] )

Returns the gateways the merchant enabled for this site that are open for checkout.

Parameters

NameDescription
currencyOnly gateways that accept it.
subscriptionstrue for gateways that support subscriptions.
test_modeInclude gateways whose live verification failed.
include_blockedAlso list gateways blocked for checkout, such as during a maintenance window.

Use include_blocked for settings screens, never checkout.

Responses

ResultDescription
arrayA list of gateways.

Each gateway:

KeyDescription
codee.g. stripe. Pass it to paylexer_create_checkout. See Supported gateways.
name, label, description, iconDisplay fields.
icon_idsCard icon IDs the merchant picked. Pass them to paylexer_payment_icons().
currencies["USD","EUR"]. Empty means any.
supportssubscriptions, trial, sign_up_fee, refunds, partial_refunds.

Example

$gateways = paylexer_get_gateways( array( 'currency' => 'USD' ) );

Returns

array(
	array(
		'code'       => 'stripe',
		'name'       => 'Stripe',
		'currencies' => array( 'USD', 'EUR' ),
		'supports'   => array( 'refunds', 'partial_refunds' ),
	),
)

Get currencies

paylexer_get_currencies()

Every currency the merchant's gateways accept (blocked ones included), keyed by code.

Add the ones your platform doesn't list.

Responses

ResultDescription
arrayKeyed by code, each with code, name, symbol, decimals.

Example

$currencies = paylexer_get_currencies();

Returns

array(
	'USD' => array( 'code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$', 'decimals' => 2 ),
)

Payment icons

paylexer_payment_icons( array $icon_ids )

The card icons the merchant picked for a gateway, as HTML to show beside its name at checkout (what PayLexer's own platforms show instead of the gateway logo).

Responses

ResultDescription
stringHTML, or '' when none are configured: show the name alone.

Example

echo paylexer_payment_icons( $gateway['icon_ids'] );