Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ecommerce/OptionKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class OptionKeys {

const BUY_NOW = 'is_enable_buy_now';

// PayPal advanced settings.
const PAYPAL_ENABLE_VAULTING = 'tutor_paypal_enable_vaulting';

/**
* Get billing field options
*
Expand Down
5 changes: 4 additions & 1 deletion ecommerce/PaymentGateways/Configs/PaypalConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tutor\PaymentGateways\Configs;

use Tutor\Ecommerce\OptionKeys;
use Tutor\Ecommerce\Settings;
use Ollyo\PaymentHub\Core\Payment\BaseConfig;
use Ollyo\PaymentHub\Contracts\Payment\ConfigContract;
Expand Down Expand Up @@ -129,12 +130,14 @@ public function getApiURL() {
public function createConfig(): void {
parent::createConfig();

$enable_vaulting = (bool) tutor_utils()->get_option( OptionKeys::PAYPAL_ENABLE_VAULTING, true );

$config = array(
'client_id' => $this->getClientID(),
'merchant_email' => $this->getMerchantEmail(),
'api_url' => $this->getApiURL(),
'client_secret' => $this->getClientSecret(),
'save_payment_method' => true,
'save_payment_method' => $enable_vaulting,
'webhook_id' => $this->webhook_id
);

Expand Down
15 changes: 15 additions & 0 deletions ecommerce/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,21 @@ public static function add_ecommerce_settings( $fields ) {
),
),
),
array(
'label' => __( 'PayPal Settings', 'tutor' ),
'desc' => __( 'Advanced configuration options for PayPal.', 'tutor' ),
'slug' => 'paypal_settings',
'block_type' => 'uniform',
'fields' => array(
array(
'key' => OptionKeys::PAYPAL_ENABLE_VAULTING,
'type' => 'toggle_switch',
'label' => __( 'Enable PayPal Vaulting (Save Payment Methods)', 'tutor' ),
'default' => 'on',
'desc' => __( 'Allow PayPal to save customer payment methods for future purchases.', 'tutor' ),
),
),
),
),
);

Expand Down