PayPalPaymentGateway
extends AbstractPaymentGateway
in package
Tags
Table of Contents
- OPTION_NAME_PAYPAL_WEBHOOK_ID = 'mpa_paypal_webhook_id'
- $description : string
- Public description.
- $hasSandboxSupport : bool
- $id : string
- Unprefixed payment gateway ID.
- $isEnabled : bool
- $isInternal : bool
- If true, then don't show this payment gateway on the settings page.
- $isSandbox : bool
- $name : string
- Gateway name (label) on the settings page.
- $publicName : string
- Public name (label) shown on the frontend.
- $paypalClientId : mixed
- $paypalSecret : mixed
- $supportedCurrenciesAndTheirDecimals : mixed
- $webhookListener : mixed
- __construct() : mixed
- enqueueScripts() : void
- An empty method is provided to add wp_enqueue_script() handlers of each of the payment methods, if necessary.
- getDescription() : string
- getFields() : array<string|int, mixed>
- getFrontendData() : array<string|int, mixed>
- getId() : string
- getMode() : string
- getName() : string
- getPayPalAPIContext() : ApiContext
- getPublicName() : string
- isActive() : bool
- isEnabled() : bool
- isInternal() : bool
- isOnlinePayment() : bool
- isSandbox() : bool
- isSupportsSandbox() : bool
- preparePaymentIntent() : string|WP_Error
- Creates PayPal order via REST API request
- printBillingFields() : mixed
- processPayment() : mixed
- getAdminDescription() : string
- getOption() : mixed
- getOptionName() : string
- getOptionNameRaw() : string
- isTranslatableOption() : bool
- setupProperties() : mixed
- getPayPalClient() : PayPalHttpClient
- isCurrencyFromSettingsSupported() : mixed
- maybeDeletePayPalWebhook() : mixed
- maybeRegisterPayPalWebhook() : mixed
Constants
OPTION_NAME_PAYPAL_WEBHOOK_ID
public
mixed
OPTION_NAME_PAYPAL_WEBHOOK_ID
= 'mpa_paypal_webhook_id'
Tags
Properties
$description
Public description.
protected
string
$description
= ''
Tags
$hasSandboxSupport
protected
bool
$hasSandboxSupport
= true
Tags
$id
Unprefixed payment gateway ID.
protected
string
$id
= 'paypal'
Tags
$isEnabled
protected
bool
$isEnabled
= false
Tags
$isInternal
If true, then don't show this payment gateway on the settings page.
protected
bool
$isInternal
= false
Tags
$isSandbox
protected
bool
$isSandbox
= false
Tags
$name
Gateway name (label) on the settings page.
protected
string
$name
= 'PayPal'
Tags
$publicName
Public name (label) shown on the frontend.
protected
string
$publicName
= ''
Tags
$paypalClientId
private
mixed
$paypalClientId
= ''
Tags
$paypalSecret
private
mixed
$paypalSecret
= ''
Tags
$supportedCurrenciesAndTheirDecimals
private
mixed
$supportedCurrenciesAndTheirDecimals
= array('AUD' => 2, 'BRL' => 2, 'CAD' => 2, 'CNY' => 2, 'CZK' => 2, 'DKK' => 2, 'EUR' => 2, 'HKD' => 2, 'HUF' => 0, 'ILS' => 2, 'JPY' => 0, 'MYR' => 2, 'MXN' => 2, 'TWD' => 0, 'NZD' => 2, 'NOK' => 2, 'PHP' => 2, 'PLN' => 2, 'GBP' => 2, 'RUB' => 2, 'SGD' => 2, 'SEK' => 2, 'CHF' => 2, 'THB' => 2, 'USD' => 2)
Tags
$webhookListener
private
mixed
$webhookListener
= null
Tags
Methods
__construct()
public
__construct() : mixed
Tags
Return values
mixed —enqueueScripts()
An empty method is provided to add wp_enqueue_script() handlers of each of the payment methods, if necessary.
public
enqueueScripts() : void
Return values
void —getDescription()
public
getDescription() : string
Tags
Return values
string —getFields()
public
getFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Raw field args.
getFrontendData()
public
getFrontendData() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getId()
public
getId() : string
Tags
Return values
string —getMode()
public
getMode() : string
Tags
Return values
string —'live'|'sandbox'
getName()
public
getName() : string
Tags
Return values
string —getPayPalAPIContext()
public
getPayPalAPIContext() : ApiContext
Tags
Return values
ApiContext —getPublicName()
public
getPublicName() : string
Tags
Return values
string —isActive()
public
isActive() : bool
Tags
Return values
bool —Whether gateway is enabled and supports current plugin settings, like currency.
isEnabled()
public
isEnabled() : bool
Tags
Return values
bool —isInternal()
public
isInternal() : bool
Tags
Return values
bool —If true, then don't show this payment gateway on the settings page.
isOnlinePayment()
public
isOnlinePayment() : bool
Tags
Return values
bool —isSandbox()
public
isSandbox() : bool
Tags
Return values
bool —Is sandbox enabled.
isSupportsSandbox()
public
isSupportsSandbox() : bool
Tags
Return values
bool —preparePaymentIntent()
Creates PayPal order via REST API request
public
preparePaymentIntent(Payment $payment) : string|WP_Error
Parameters
- $payment : Payment
Tags
Return values
string|WP_Error —PayPal order id
printBillingFields()
public
printBillingFields() : mixed
Tags
Return values
mixed —processPayment()
public
processPayment(mixed $payment, mixed $paymentDetails) : mixed
Parameters
- $payment : mixed
- $paymentDetails : mixed
Tags
Return values
mixed —getAdminDescription()
protected
getAdminDescription() : string
Tags
Return values
string —Payment gateway description on the top of the page, before the first field.
getOption()
protected
getOption(string $option[, mixed $default = '' ]) : mixed
Parameters
- $option : string
- $default : mixed = ''
-
Optional. '' by default.
Tags
Return values
mixed —getOptionName()
protected
getOptionName(string $option) : string
Parameters
- $option : string
Tags
Return values
string —Prefixed option name.
getOptionNameRaw()
protected
getOptionNameRaw(string $option) : string
Parameters
- $option : string
Tags
Return values
string —Unprefixed option name.
isTranslatableOption()
protected
isTranslatableOption(string $option) : bool
Parameters
- $option : string
Tags
Return values
bool —setupProperties()
protected
setupProperties() : mixed
Tags
Return values
mixed —getPayPalClient()
private
getPayPalClient() : PayPalHttpClient
Tags
Return values
PayPalHttpClient —isCurrencyFromSettingsSupported()
private
isCurrencyFromSettingsSupported() : mixed
Tags
Return values
mixed —maybeDeletePayPalWebhook()
private
maybeDeletePayPalWebhook() : mixed
Tags
Return values
mixed —maybeRegisterPayPalWebhook()
private
maybeRegisterPayPalWebhook() : mixed