Automattic\WooCommerce\Gateways\PayPal
Buttons::get_client_id
Get the client-id for the PayPal buttons.
Method of the class: Buttons{}
No Hooks.
Returns
String|null. The PayPal client-id, or null if the request fails.
Usage
$Buttons = new Buttons(); $Buttons->get_client_id(): ?string;
Changelog
| Since 10.5.0 | Introduced. |
Buttons::get_client_id() Buttons::get client id code WC 10.8.1
public function get_client_id(): ?string {
if ( ! $this->gateway->should_use_orders_v2() ) {
return null;
}
$option_key = self::CLIENT_ID_OPTION . ( $this->gateway->testmode ? '_sandbox' : '_live' );
$client_id = get_option( $option_key, null );
if ( empty( $client_id ) ) {
$client_id = $this->request->fetch_paypal_client_id();
if ( empty( $client_id ) ) {
return null;
}
update_option( $option_key, $client_id );
}
return $client_id;
}