Automattic\WooCommerce\Gateways\PayPal
Request::generate_shipping_callback_token
Generate and store a shipping callback token for the order. The token is stored in the database cache and can be validated later.
Метод класса: Request{}
Хуков нет.
Возвращает
string. The generated token.
Использование
// private - только в коде основоного (родительского) класса $result = $this->generate_shipping_callback_token( $order ): string;
- $order(WC_Order) (обязательный)
- The order object.
Код Request::generate_shipping_callback_token() Request::generate shipping callback token WC 11.2.2
private function generate_shipping_callback_token( WC_Order $order ): string {
$token = bin2hex( random_bytes( 32 ) );
// Store the token in order meta for validation.
$order->update_meta_data( PayPalConstants::PAYPAL_ORDER_META_SHIPPING_CALLBACK_TOKEN, $token );
$order->save();
return $token;
}