Functions
Table of Contents
Functions
- stripe_wc() : WC_Stripe_Manager
- Returns the global instance of the WC_Stripe_Manager. This function replaces the wc_stripe function as of version 3.2.8
- wc_stripe_get_template() : mixed
- wc_stripe_get_template_html() : string
- Wrapper for wc_get_template_html that returns Stripe specififc templates in an html string.
- wcs_stripe_active() : bool
- Return true if WCS is active.
- wc_stripe_token_field() : mixed
- wc_stripe_payment_intent_field() : mixed
- wc_stripe_hidden_field() : mixed
- wc_stripe_mode() : string
- Return the mode for the plugin.
- wc_stripe_test_mode() : mixed
- wc_stripe_get_secret_key() : mixed
- Return the secret key for the provided mode.
- wc_stripe_get_publishable_key() : mixed
- Return the publishable key for the provided mode.
- wc_stripe_get_account_id() : string
- Return the merchant's Stripe account.
- wc_stripe_get_customer_id() : mixed
- Return the stripe customer ID
- wc_stripe_save_customer() : mixed
- wc_stripe_delete_customer() : mixed
- wc_stripe_woocommerce_payment_token_deleted() : mixed
- wc_stripe_log() : mixed
- Log the provided message in the WC logs directory.
- wc_stripe_log_error() : mixed
- wc_stripe_log_info() : mixed
- wc_stripe_order_mode() : mixed
- Return the mode that the order was created in.
- wc_stripe_payment_gateways() : mixed
- wc_stripe_get_payment_gateways() : array<string|int, WC_Payment_Gateway_Stripe>
- wc_stripe_order_cancelled() : mixed
- Cancel the Stripe charge
- wc_stripe_order_status_completed() : mixed
- wc_stripe_update_customer_location() : mixed
- wc_stripe_update_shipping_methods() : mixed
- wc_stripe_shipping_address_serviceable() : bool
- Return true if there are shipping packages that contain rates.
- wc_stripe_get_display_items() : mixed
- wc_stripe_get_shipping_options() : mixed
- wc_stripe_set_checkout_error() : mixed
- wc_stripe_output_checkout_error() : mixed
- wc_stripe_add_allowed_html() : mixed
- wc_stripe_process_shop_subscription_meta() : mixed
- Save WCS meta data when it's changed in the admin section.
- wc_stripe_available_payment_gateways() : mixed
- Filter the WC payment gateways based on criteria specific to Stripe functionality.
- wc_stripe_get_local_payment_params() : array<string|int, mixed>
- wc_stripe_get_available_local_gateways() : array<string|int, WC_Payment_Gateway>
- wc_stripe_set_idempotency_key() : mixed
- wc_stripe_get_idempotency_key() : mixed
- wc_stripe_api_options() : array<string|int, mixed>
- wc_stripe_payment_complete_order_status() : mixed
- wc_stripe_add_number_precision() : number
- Converts the amount to cents.
- wc_stripe_remove_number_precision() : mixed
- Remove precision from a number.
- wc_stripe_get_custom_forms() : mixed
- Return an array of credit card forms.
- wc_stripe_order_has_shipping_address() : mixed
- wc_stripe_display_prices_including_tax() : mixed
- wc_stripe_pre_orders_active() : mixed
- Return true if the WC pre-orders plugin is active
- wc_stripe_get_order_from_source_id() : mixed
- wc_stripe_get_order_from_transaction() : WC_Order|WC_Refund|bool|WC_Order_Refund
- wc_stripe_stash_cart() : mixed
- Stash the WC cart contents in the session and empty it's contents.
- wc_stripe_stash_product_cart() : mixed
- wc_stripe_restore_cart() : mixed
- wc_stripe_restore_cart_after_product_checkout() : mixed
- wc_stripe_get_customer_payment_tokens() : array<string|int, WC_Payment_Token>
- wc_stripe_credit_card_labels() : string
- wc_stripe_get_error_messages() : mixed
- Return an array of Stripe error messages.
- wc_stripe_get_currencies() : mixed
- Return an array of Stripe currencies where the value of each currency is the curency multiplier.
- wc_stripe_filter_order_id() : mixed
- Function that triggers a filter on the order id.
- wc_stripe_remove_order_locks() : mixed
- Removes order locks that have expired so the options table does not get cluttered with transients.
- wc_stripe_get_checkout_fields() : array<string|int, mixed>
- Returns an array of checkout fields needed to complete an order.
- wc_stripe_filter_address_state() : string
- Filters a state value, making sure the abbreviated state value recognized by WC is returned.
- wc_stripe_get_current_page() : mixed
- wc_stripe_get_site_locale() : mixed|void
- wc_stripe_is_processing_webhook() : bool
- wc_stripe_process_source_chargeable() : mixed
- Processes the charge via webhooks for local payment methods like P24, EPS, etc.
- wc_stripe_process_charge_succeeded() : mixed
- When the charge has succeeded, the order should be completed.
- wc_stripe_process_payment_intent_succeeded() : mixed
- wc_stripe_process_charge_failed() : mixed
- wc_stripe_process_create_refund() : mixed
- Function that processes the charge.refund webhook. If the refund is created in the Stripe dashboard, a refund will be created in the WC system to keep WC and Stripe in sync.
- wc_stripe_retry_source_chargeable() : mixed
- wc_stripe_charge_dispute_created() : mixed
- wc_stripe_charge_dispute_closed() : mixed
- wc_stripe_review_opened() : mixed
- wc_stripe_review_closed() : mixed
- wc_stripe_process_requires_action() : mixed
- wc_stripe_process_charge_pending() : mixed
Functions
stripe_wc()
Returns the global instance of the WC_Stripe_Manager. This function replaces the wc_stripe function as of version 3.2.8
stripe_wc() : WC_Stripe_Manager
Tags
Return values
WC_Stripe_Managerwc_stripe_get_template()
wc_stripe_get_template(string $template_name[, array<string|int, mixed> $args = array() ]) : mixed
Parameters
- $template_name : string
- $args : array<string|int, mixed> = array()
Tags
wc_stripe_get_template_html()
Wrapper for wc_get_template_html that returns Stripe specififc templates in an html string.
wc_stripe_get_template_html(string $template_name[, array<string|int, mixed> $args = array() ]) : string
Parameters
- $template_name : string
- $args : array<string|int, mixed> = array()
Tags
Return values
stringwcs_stripe_active()
Return true if WCS is active.
wcs_stripe_active() : bool
Return values
boolwc_stripe_token_field()
wc_stripe_token_field(WC_Payment_Gateway_Stripe $gateway) : mixed
Parameters
- $gateway : WC_Payment_Gateway_Stripe
wc_stripe_payment_intent_field()
wc_stripe_payment_intent_field(WC_Payment_Gateway_Stripe $gateway) : mixed
Parameters
- $gateway : WC_Payment_Gateway_Stripe
wc_stripe_hidden_field()
wc_stripe_hidden_field(string $id[, string $class = '' ][, string $value = '' ]) : mixed
Parameters
- $id : string
- $class : string = ''
- $value : string = ''
wc_stripe_mode()
Return the mode for the plugin.
wc_stripe_mode() : string
Return values
stringwc_stripe_test_mode()
wc_stripe_test_mode() : mixed
wc_stripe_get_secret_key()
Return the secret key for the provided mode.
wc_stripe_get_secret_key([string $mode = '' ]) : mixed
If no mode given, the key for the active mode is returned.
Parameters
- $mode : string = ''
Tags
wc_stripe_get_publishable_key()
Return the publishable key for the provided mode.
wc_stripe_get_publishable_key([string $mode = '' ]) : mixed
If no mode given, the key for the active mode is returned.
Parameters
- $mode : string = ''
Tags
wc_stripe_get_account_id()
Return the merchant's Stripe account.
wc_stripe_get_account_id() : string
Tags
Return values
stringwc_stripe_get_customer_id()
Return the stripe customer ID
wc_stripe_get_customer_id([int $user_id = '' ][, string $mode = '' ]) : mixed
Parameters
- $user_id : int = ''
- $mode : string = ''
Tags
wc_stripe_save_customer()
wc_stripe_save_customer(string $customer_id, int $user_id[, string $mode = '' ]) : mixed
Parameters
- $customer_id : string
- $user_id : int
- $mode : string = ''
wc_stripe_delete_customer()
wc_stripe_delete_customer(int $user_id[, string $mode = '' ][, bool $global = false ]) : mixed
Parameters
- $user_id : int
- $mode : string = ''
- $global : bool = false
Tags
wc_stripe_woocommerce_payment_token_deleted()
wc_stripe_woocommerce_payment_token_deleted(int $token_id, WC_Payment_Token $token) : mixed
Parameters
- $token_id : int
- $token : WC_Payment_Token
Tags
wc_stripe_log()
Log the provided message in the WC logs directory.
wc_stripe_log(int $level, string $message) : mixed
Parameters
- $level : int
- $message : string
Tags
wc_stripe_log_error()
wc_stripe_log_error(string $message) : mixed
Parameters
- $message : string
Tags
wc_stripe_log_info()
wc_stripe_log_info(string $message) : mixed
Parameters
- $message : string
Tags
wc_stripe_order_mode()
Return the mode that the order was created in.
wc_stripe_order_mode(WC_Order|int $order) : mixed
Values can be live or test
Parameters
- $order : WC_Order|int
Tags
wc_stripe_payment_gateways()
wc_stripe_payment_gateways(array<string|int, mixed> $gateways) : mixed
Parameters
- $gateways : array<string|int, mixed>
Tags
wc_stripe_get_payment_gateways()
wc_stripe_get_payment_gateways() : array<string|int, WC_Payment_Gateway_Stripe>
Tags
Return values
array<string|int, WC_Payment_Gateway_Stripe>wc_stripe_order_cancelled()
Cancel the Stripe charge
wc_stripe_order_cancelled(int $order_id, WC_Order $order) : mixed
Parameters
- $order_id : int
- $order : WC_Order
wc_stripe_order_status_completed()
wc_stripe_order_status_completed(int $order_id, WC_Order $order) : mixed
Parameters
- $order_id : int
- $order : WC_Order
Tags
wc_stripe_update_customer_location()
wc_stripe_update_customer_location(array<string|int, mixed> $address) : mixed
Parameters
- $address : array<string|int, mixed>
Tags
wc_stripe_update_shipping_methods()
wc_stripe_update_shipping_methods(array<string|int, mixed> $methods) : mixed
Parameters
- $methods : array<string|int, mixed>
Tags
wc_stripe_shipping_address_serviceable()
Return true if there are shipping packages that contain rates.
wc_stripe_shipping_address_serviceable([array<string|int, mixed> $packages = array() ]) : bool
Parameters
- $packages : array<string|int, mixed> = array()
Tags
Return values
boolwc_stripe_get_display_items()
wc_stripe_get_display_items([string $page = 'cart' ][, WC_Order $order = null ]) : mixed
Parameters
- $page : string = 'cart'
- $order : WC_Order = null
Tags
wc_stripe_get_shipping_options()
wc_stripe_get_shipping_options([WC_Order $order = null ][, array<string|int, mixed> $packages = array() ]) : mixed
Parameters
- $order : WC_Order = null
- $packages : array<string|int, mixed> = array()
Tags
wc_stripe_set_checkout_error()
wc_stripe_set_checkout_error() : mixed
Tags
wc_stripe_output_checkout_error()
wc_stripe_output_checkout_error(string $template_name) : mixed
Parameters
- $template_name : string
Tags
wc_stripe_add_allowed_html()
wc_stripe_add_allowed_html(mixed $tags, mixed $context) : mixed
Parameters
- $tags : mixed
- $context : mixed
Tags
wc_stripe_process_shop_subscription_meta()
Save WCS meta data when it's changed in the admin section.
wc_stripe_process_shop_subscription_meta(int $post_id, WP_Post $post) : mixed
By default WCS saves the payment method title as the gateway title. This method saves the payment method title in a human readable format suitable for the frontend.
Parameters
- $post_id : int
- $post : WP_Post
wc_stripe_available_payment_gateways()
Filter the WC payment gateways based on criteria specific to Stripe functionality.
wc_stripe_available_payment_gateways(array<string|int, WC_Payment_Gateway> $gateways) : mixed
Parameters
- $gateways : array<string|int, WC_Payment_Gateway>
Tags
wc_stripe_get_local_payment_params()
wc_stripe_get_local_payment_params() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>wc_stripe_get_available_local_gateways()
wc_stripe_get_available_local_gateways(array<string|int, mixed> $gateways) : array<string|int, WC_Payment_Gateway>
Parameters
- $gateways : array<string|int, mixed>
Tags
Return values
array<string|int, WC_Payment_Gateway>wc_stripe_set_idempotency_key()
wc_stripe_set_idempotency_key(string|int $key) : mixed
Parameters
- $key : string|int
Tags
wc_stripe_get_idempotency_key()
wc_stripe_get_idempotency_key() : mixed
Tags
wc_stripe_api_options()
wc_stripe_api_options(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>wc_stripe_payment_complete_order_status()
wc_stripe_payment_complete_order_status(string $order_status, int $order_id[, WC_Order $order = null ]) : mixed
Parameters
- $order_status : string
- $order_id : int
- $order : WC_Order = null
Tags
wc_stripe_add_number_precision()
Converts the amount to cents.
wc_stripe_add_number_precision(float $value[, string $currency = '' ][, string $round = true ]) : number
Stripe processes all requests in cents.
Parameters
- $value : float
- $currency : string = ''
- $round : string = true
Tags
Return values
numberwc_stripe_remove_number_precision()
Remove precision from a number.
wc_stripe_remove_number_precision(mixed $value[, string $currency = '' ][, bool $round = true ][, mixed $dp = null ]) : mixed
Parameters
- $value : mixed
- $currency : string = ''
- $round : bool = true
- $dp : mixed = null
Tags
wc_stripe_get_custom_forms()
Return an array of credit card forms.
wc_stripe_get_custom_forms() : mixed
Tags
wc_stripe_order_has_shipping_address()
wc_stripe_order_has_shipping_address(WC_Order $order) : mixed
Parameters
- $order : WC_Order
Tags
wc_stripe_display_prices_including_tax()
wc_stripe_display_prices_including_tax() : mixed
Tags
wc_stripe_pre_orders_active()
Return true if the WC pre-orders plugin is active
wc_stripe_pre_orders_active() : mixed
Tags
wc_stripe_get_order_from_source_id()
wc_stripe_get_order_from_source_id(string $source_id) : mixed
Parameters
- $source_id : string
Tags
wc_stripe_get_order_from_transaction()
wc_stripe_get_order_from_transaction(string $transaction_id) : WC_Order|WC_Refund|bool|WC_Order_Refund
Parameters
- $transaction_id : string
Tags
Return values
WC_Order|WC_Refund|bool|WC_Order_Refundwc_stripe_stash_cart()
Stash the WC cart contents in the session and empty it's contents.
wc_stripe_stash_cart(WC_Cart $cart[, bool $product_cart = true ]) : mixed
If $product_cart is true, add the stashed product(s) to the cart.
Parameters
- $cart : WC_Cart
- $product_cart : bool = true
Tags
wc_stripe_stash_product_cart()
wc_stripe_stash_product_cart(WC_Cart $cart[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $cart : WC_Cart
- $params : array<string|int, mixed> = array()
Tags
wc_stripe_restore_cart()
wc_stripe_restore_cart(WC_Cart $cart) : mixed
Parameters
- $cart : WC_Cart
Tags
wc_stripe_restore_cart_after_product_checkout()
wc_stripe_restore_cart_after_product_checkout() : mixed
Tags
wc_stripe_get_customer_payment_tokens()
wc_stripe_get_customer_payment_tokens(array<string|int, WC_Payment_Token> $tokens, int $user_id, string $gateway_id) : array<string|int, WC_Payment_Token>
Parameters
- $tokens : array<string|int, WC_Payment_Token>
- $user_id : int
- $gateway_id : string
Tags
Return values
array<string|int, WC_Payment_Token>wc_stripe_credit_card_labels()
wc_stripe_credit_card_labels(array<string|int, mixed> $labels) : string
Parameters
- $labels : array<string|int, mixed>
Tags
Return values
stringwc_stripe_get_error_messages()
Return an array of Stripe error messages.
wc_stripe_get_error_messages() : mixed
Tags
wc_stripe_get_currencies()
Return an array of Stripe currencies where the value of each currency is the curency multiplier.
wc_stripe_get_currencies() : mixed
Tags
wc_stripe_filter_order_id()
Function that triggers a filter on the order id.
wc_stripe_filter_order_id(int $order_id, ApiResource $object) : mixed
Allows 3rd parties to convert the order_id from the metadata of the Stripe object.
Parameters
- $order_id : int
- $object : ApiResource
Tags
wc_stripe_remove_order_locks()
Removes order locks that have expired so the options table does not get cluttered with transients.
wc_stripe_remove_order_locks() : mixed
Tags
wc_stripe_get_checkout_fields()
Returns an array of checkout fields needed to complete an order.
wc_stripe_get_checkout_fields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>wc_stripe_filter_address_state()
Filters a state value, making sure the abbreviated state value recognized by WC is returned.
wc_stripe_filter_address_state(string $state, string $country) : string
Example: Texas = TX
Parameters
- $state : string
- $country : string
Tags
Return values
stringwc_stripe_get_current_page()
wc_stripe_get_current_page() : mixed
Tags
wc_stripe_get_site_locale()
wc_stripe_get_site_locale() : mixed|void
Tags
Return values
mixed|voidwc_stripe_is_processing_webhook()
wc_stripe_is_processing_webhook() : bool
Tags
Return values
boolwc_stripe_process_source_chargeable()
Processes the charge via webhooks for local payment methods like P24, EPS, etc.
wc_stripe_process_source_chargeable(Source $source, WP_REST_Request $request) : mixed
Parameters
- $source : Source
- $request : WP_REST_Request
Tags
wc_stripe_process_charge_succeeded()
When the charge has succeeded, the order should be completed.
wc_stripe_process_charge_succeeded(Charge $charge, WP_REST_Request $request) : mixed
Parameters
- $charge : Charge
- $request : WP_REST_Request
Tags
wc_stripe_process_payment_intent_succeeded()
wc_stripe_process_payment_intent_succeeded(PaymentIntent $intent, WP_REST_Request $request, Event $event) : mixed
Parameters
- $intent : PaymentIntent
- $request : WP_REST_Request
- $event : Event
Tags
wc_stripe_process_charge_failed()
wc_stripe_process_charge_failed(Charge $charge, WP_REST_Request $request) : mixed
Parameters
- $charge : Charge
- $request : WP_REST_Request
Tags
wc_stripe_process_create_refund()
Function that processes the charge.refund webhook. If the refund is created in the Stripe dashboard, a refund will be created in the WC system to keep WC and Stripe in sync.
wc_stripe_process_create_refund(Charge $charge) : mixed
Parameters
- $charge : Charge
Tags
wc_stripe_retry_source_chargeable()
wc_stripe_retry_source_chargeable(mixed $source_id) : mixed
Parameters
- $source_id : mixed
Tags
wc_stripe_charge_dispute_created()
wc_stripe_charge_dispute_created(Dispute $dispute) : mixed
Parameters
- $dispute : Dispute
wc_stripe_charge_dispute_closed()
wc_stripe_charge_dispute_closed(Dispute $dispute) : mixed
Parameters
- $dispute : Dispute
wc_stripe_review_opened()
wc_stripe_review_opened(Review $review) : mixed
Parameters
- $review : Review
wc_stripe_review_closed()
wc_stripe_review_closed(Review $review) : mixed
Parameters
- $review : Review
wc_stripe_process_requires_action()
wc_stripe_process_requires_action(PaymentIntent $payment_intent) : mixed
Parameters
- $payment_intent : PaymentIntent
wc_stripe_process_charge_pending()
wc_stripe_process_charge_pending(Charge $charge) : mixed
Parameters
- $charge : Charge