Integrating WP Full Pay with other systems
WP Full Pay fires WordPress actions and WordPress filters when certain events occur.
You can integrate WP Full Pay with other system by hooking into these actions and filters, and running your own code.
Possible integrations include, but not limited to:
- Inserting a row into the database with some customer data after payment
- Adding the customer’s email address to an email list in Mailchimp
- Sending an SMS notification when a new subscription is made
For v7+ the objects returned from the \StripeWPFS\StripeClient are stdClass or arrays and not native Stripe objects. Review your customization code prior to upgrading
Table of contents:
Plugin action catalog
You can find all supported actions in the tables below. Click on an action to jump into the detailed description and usage example.
Actions related to payments
Action | Description |
---|---|
fullstripe_before_payment_charge | Triggered before a one-time payment (inline form) |
fullstripe_after_payment_charge | Triggered after a one-time payment (inline form) |
fullstripe_before_checkout_payment_charge | Triggered before a one-time payment (checkout form) |
fullstripe_after_checkout_payment_charge | Triggered after a one-time payment (checkout form) |
fullstripe_before_subscription_charge | Triggered before a subscription payment (inline form) |
fullstripe_after_subscription_charge | Triggered after a subscription payment (inline form) |
fullstripe_before_checkout_subscription_charge | Triggered before a subscription payment (checkout form) |
fullstripe_after_checkout_subscription_charge | Triggered after a subscription payment (checkout form) |
fullstripe_before_donation_charge | Triggered before a donation payment (inline form) |
fullstripe_after_donation_charge | Triggered after a donation payment (inline form) |
fullstripe_before_checkout_donation_charge | Triggered before a donation payment (checkout form) |
fullstripe_after_checkout_donation_charge | Triggered after a donation payment (checkout form) |
fullstripe_before_card_capture | Triggered before saving a card (inline form) |
fullstripe_after_card_capture | Triggered after saving a card (inline form) |
fullstripe_before_checkout_card_capture | Triggered before saving a card (checkout form) |
fullstripe_after_checkout_card_capture | Triggered after saving a card (checkout form) |
Actions related to subscription state
Action | Description |
---|---|
fullstripe_before_subscription_cancellation | Triggered before a subscription is canceled |
fullstripe_after_subscription_cancellation | Triggered after a subscription is canceled |
fullstripe_before_subscription_update | Triggered before a subscription is updated |
fullstripe_after_subscription_update | Triggered after a subscription is updated |
fullstripe_before_subscription_activation | Triggered before a subscription is activated |
fullstripe_after_subscription_activation | Triggered after a subscription is activated |
Plugin filter catalog
You can find all supported filters in the table below. Click on a filter to jump into the detailed description and usage example.
Filter | Description |
---|---|
fullstripe_select_subscription_plan | Set the subscription plan selected by default via URL parameter. Triggered when a plan selector parameter is found in the page URL. |
fullstripe_set_custom_amount | Set the custom payment amount entered by default via URL parameter. Triggered when a custom amount parameter is found in the page URL. |
fullstripe_add_transaction_metadata | Add metadata to transactions. Triggered before the page is loaded so that metadata can be added to the transaction from URL parameters. |
fullstripe_get_upgrade_downgrade_plans | Tell the customer portal which subscription plans should be offered for upgrading/downgrading the current plan. Triggered before the list of subscription plans is displayed to the customer on the “Customer portal” page. |
fullstripe_customer_portal_header | Display extra content at the top of the customer portal pane. Triggered before the “Customer portal” page is displayed. |
fullstripe_customer_portal_footer | Display extra content at the bottom of the customer portal pane. Triggered before the “Customer portal” page is displayed. |
fullstripe_modify_email_subject | Modify the subject of plugin email notications. Triggered before sending a plugin email notification. |
fullstripe_modify_email_message | Modify the body of plugin email notications. Triggered before sending a plugin email notification. |
fullstripe_thank_you_output | Modify the thank you page. Triggered before displaying a thank you page. |
fullstripe_thank_you_url_parameters | Modify the URL parameters added to the thank you page URL. Triggered before opening the thank you page. |
fullstripe_thank_you_post_types | Modify the post types whose pages are offered as thank ypu pages in WP admin. Triggered before displaying the thank you page selector in WP admin. |
fullstripe_billing_countries | Filter the billing countries. Triggered before displaying a form where the billing country is collected. |
fullstripe_shipping_countries | Filter the shipping countries. Triggered before displaying a form where the shipping country is collected. |
fullstripe_payment_intent_parameters | Modify the PaymentIntent parameters. Triggered before creating a PaymentIntent via the Stripe API. |
fullstripe_checkout_session_parameters | Modify the CheckoutSession parameters. Triggered before creating a CheckoutSession via the Stripe API. |
fullstripe_determine_tax_rates | Filter the tax rates. Triggered before payment is made to determine the Stripe tax rates used for the payment. |
fullstripe_determine_tax_label | Filter the tax label. Triggered before an inline payment or subscription form using Stripe Tax is (re)rendered. |
fullstripe_members_supported_post_types | Filter the custom post types used for protected content. Triggered before the Wordpress page editor is displayed to the user. |
fullstripe_form_field_configuration | Set which form fields can be pre-filled via URL parameters, and which form fields should be read-only once they are set. |
Plugin actions
fullstripe_before_payment_charge
The fullstripe_before_payment_charge action is fired before a one-time payment transaction is about to be started on an inline form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_payment_charge' action hook example for WP Full Stripe. * It blocks the payment if the payment amount is less than $20. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * priceId => Id of Stripe price being purchased. Null for custom amounts. * productName => Name of the Stripe product being purchased. * currency => ISO code of the payment currency (eg. USD) * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, initialized in the same API mode as the current transaction */ function beforeInlinePaymentCharge( $params ) { $amount = $params['amount']; if ( $amount < 2000 ) { $ex = new WPFS_UserFriendlyException( "Price must be $20 or more" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_payment_charge', 'beforeInlinePaymentCharge', 10, 1 );
fullstripe_after_payment_charge
The fullstripe_after_payment_charge action is fired after a successful one-time payment on an inline form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
The example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_payment_charge' action hook example for WP Full Stripe. * It logs the payment amount, form name, and customer email address * to the webserver error log. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * priceId => Id of Stripe price being purchased. Null for custom amounts. * productName => Name of the Stripe product being purchased. * currency => ISO code of the payment currency (eg. USD) * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripePaymentIntent => Instance of the \StripeWPFS\PaymentIntent object created in the transaction * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterInlinePaymentCharge( $params ) { $paymentIntent = $params[ 'stripePaymentIntent' ]; $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $paymentIntent->customer ); $customerEmail = $stripeCustomer->email; $paymentCurrency = $paymentIntent->currency; $paymentAmount = $paymentIntent->amount_received; $paymentMetadata = $paymentIntent->metadata; $paymentFormName = $params['formName']; error_log(__FUNCTION__ . "(): Successful payment of " . $paymentAmount . " " . $paymentCurrency . " on form '" . $paymentFormName . "' from " . $customerEmail . " ." ); } add_action('fullstripe_after_payment_charge', 'afterInlinePaymentCharge', 10, 1);
fullstripe_before_checkout_payment_charge
The fullstripe_before_checkout_payment_charge action is fired before a one-time payment transaction is about to be started on a checkout form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_checkout_payment_charge' action hook example for WP Full Stripe. * It blocks the payment if the payment amount is less than $20. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * priceId => Id of Stripe price being purchased. Null for custom amounts. * productName => Name of the Stripe product being purchased. * currency => ISO code of the payment currency (eg. USD) * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeCheckoutPaymentCharge( $params ) { $amount = $params['amount']; if ( $amount < 2000 ) { $ex = new WPFS_UserFriendlyException( "Price must be $20 or more" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_checkout_payment_charge', 'beforeCheckoutPaymentCharge', 10, 1 );
fullstripe_after_checkout_payment_charge
The fullstripe_after_checkout_payment_charge action is fired after a successful one-time payment on a checkout form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_checkout_payment_charge' action hook example for WP Full Stripe. * It sends email notification about the successful payment to a preset email address. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * priceId => Id of Stripe price being purchased. Null for custom amounts. * productName => Name of the Stripe product being purchased. * currency => ISO code of the payment currency (eg. USD) * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripePaymentIntent => Instance of the \StripeWPFS\PaymentIntent object created in the transaction * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterCheckoutPaymentCharge( $params ) { $paymentIntent = $params[ 'stripePaymentIntent' ]; $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $paymentIntent->customer ); $customerEmail = $stripeCustomer->email; $paymentCurrency = $paymentIntent->currency; $paymentAmount = $paymentIntent->amount_received; $sender_name = html_entity_decode( get_bloginfo( 'name' ) ); $sender_email = 'noreply@example.com'; $recipient_email = 'john.doe@example.com'; $subject = 'New sale!'; $headers[] = "From: $sender_name <$sender_email>"; $headers[] = "Content-type: text/html"; $message = "Successful payment of " . $paymentAmount . " " . $paymentCurrency . " from " . $customerEmail . " ."; $send_result = wp_mail( $recipient_email, $subject, $message, $headers ); } add_action('fullstripe_after_checkout_payment_charge', 'afterCheckoutPaymentCharge', 10, 1);
fullstripe_before_subscription_charge
The fullstripe_before_subscription_charge action is fired before a subscription is about to be started on an inline form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_subscription_charge' action hook example for WP Full Stripe. * It blocks the subscripton if the quantity is less than 3. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * productName => Name of the Stripe product being purchased * planId => Id of Stripe recurring price being purchased * currency => ISO code of the payment currency (eg. USD) * amount => Plan amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * setupFee => Setup fee amount (it's in cents for non-zerodecimal currencies like the USD, EUR). Zero if there is no setup fee. * quantity => Number of plans purchased * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeInlineSubscriptionCharge( $params ) { $amount = $params['quantity']; if ( $quantity < 3 ) { $ex = new WPFS_UserFriendlyException( "Please purchase at least 3 subscriptions" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_subscription_charge', 'beforeInlineSubscriptionCharge', 10 , 1 );
fullstripe_after_subscription_charge
The fullstripe_after_subscription_charge action is fired after the customer successfully subscribed on an inline form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_subscription_charge' action hook example for WP Full Stripe. * It registers a Wordpress user, and sends the user registration email to the customer. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * productName => Name of the Stripe product being purchased * planId => Id of Stripe recurring price being purchased * currency => ISO code of the payment currency (eg. USD) * amount => Plan amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * setupFee => Setup fee amount (it's in cents for non-zerodecimal currencies like the USD, EUR). Zero if there is no setup fee. * quantity => Number of plans purchased * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripeSubscription => Instance of the \StripeWPFS\Subscription object * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterInlineSubscriptionCharge( $params ) { $stripeSubscription = $params['stripeSubscription']; $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); $userData = array(); $sanitizedName = trim($stripeCustomer->name); $userData['display_name'] = $sanitizedName; // Extract first name and last name from customer's name $lastPos = strrpos($sanitizedName, " "); if ($lastPos === false) { $userData['first_name'] = $sanitizedName; $userData['last_name'] = ""; } else { $userData['first_name'] = trim(substr($sanitizedName, 0, $lastPos)); $userData['last_name'] = trim(substr($sanitizedName, $lastPos)); } $userData['nickname'] = $userData['first_name']; $userData['user_login'] = $stripeCustomer->email; $userData['user_pass'] = wp_generate_password( $length = 20, $include_standard_special_chars = false );; $userData['user_email'] = $stripeCustomer->email; $user_id = wp_insert_user( $userData ); // You can also add a role to the WP user, but you need the id of the role $user = get_user_by( 'id', $user_id ); //$user->add_role( $planRole ); // Send email with credentials to customer wp_new_user_notification($user_id,null,'user'); } add_action('fullstripe_after_subscription_charge', 'afterInlineSubscriptionCharge', 10, 1);
fullstripe_before_checkout_subscription_charge
The fullstripe_before_subscription_charge action is fired before a subscription is about to be started on a checkout form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_checkout_subscription_charge' action hook example for WP Full Stripe. * It blocks the subscripton if the quantity is less than 3. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * productName => Name of the Stripe product being purchased * planId => Id of Stripe recurring price being purchased * currency => ISO code of the payment currency (eg. USD) * amount => Plan amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * setupFee => Setup fee amount (it's in cents for non-zerodecimal currencies like the USD, EUR). Zero if there is no setup fee. * quantity => Number of plans purchased * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeCheckoutSubscriptionCharge( $params ) { $amount = $params['quantity']; if ( $quantity < 3 ) { $ex = new WPFS_UserFriendlyException( "Please purchase at least 3 subscriptions" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_checkout_subscription_charge', 'beforeCheckoutSubscriptionCharge', 10, 1 );
fullstripe_after_checkout_subscription_charge
The fullstripe_after_checkout_subscription_charge action is fired after the customer successfully subscribed on a checkout form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_checkout_subscription_charge' action hook example for WP Full Stripe. * It adds the subscriber's email address to a Mailchimp list. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * productName => Name of the Stripe product being purchased * planId => Id of Stripe recurring price being purchased * currency => ISO code of the payment currency (eg. USD) * amount => Plan amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * setupFee => Setup fee amount (it's in cents for non-zerodecimal currencies like the USD, EUR). Zero if there is no setup fee. * quantity => Number of plans purchased * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripeSubscription => Instance of the \StripeWPFS\Subscription object * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function checkoutAfterSubscription( $params ) { $stripeSubscription = $params['stripeSubscription']; $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // SET THESE CONSTANTS $MAILCHIMP_AUDIENCE_ID = 'YOUR-AUDIENCE-ID'; $MAILCHIMP_API_KEY = 'YOUR-API-KEY'; $MAILCHIMP_SERVER = 'YOUR_SERVER_ID'; // SET THESE CONSTANTS $APP_AGENT = 'Your website agent'; $MAILCHIMP_API_ENDPOINT = 'https://' . $MAILCHIMP_SERVER . '.api.mailchimp.com/3.0/lists/' . $MAILCHIMP_AUDIENCE_ID . '/members/'; $response = wp_remote_post( $MAILCHIMP_API_ENDPOINT, array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.1', 'blocking' => true, 'headers' => array( 'Content-Type' => 'application/json', 'Authorization' => 'apikey '. $MAILCHIMP_API_KEY, ), 'body' => wp_json_encode( array( "email_address" => $stripeCustomer->email, "status" => "subscribed" )), 'cookies' => array() )); if ( is_wp_error( $response ) ) { error_log( "Something went wrong: " . $response->get_error_message() ); } } add_action('fullstripe_after_checkout_subscription_charge', 'checkoutAfterSubscription', 10, 1 );
fullstripe_before_donation_charge
The fullstripe_before_donation_charge action is fired before a donation transaction is about to be started on an inline form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_donation_charge' action hook example for WP Full Stripe. * It blocks the donation if the donation amount is less than $5. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * currency => ISO code of the payment currency (eg. USD) * frequency => The donation frequency, possible values: * one-time * daily * weekly * monhtly * annual * amount => Donation amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeInlineDonationCharge( $params ) { $amount = $params['amount']; if ( $amount < 500 ) { $ex = new WPFS_UserFriendlyException( "Please donate $5 or more" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_donation_charge', 'beforeInlineDonationCharge', 10, 1 );
fullstripe_after_donation_charge
The fullstripe_after_donation_charge action is fired after a successful donation on an inline form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_donation_charge' action hook example for WP Full Stripe. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * currency => ISO code of the payment currency (eg. USD) * frequency => The donation frequency, possible values: * one-time * daily * weekly * monhtly * annual * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripePaymentIntent => Instance of the \StripeWPFS\PaymentIntent object created in the transaction * stripeSubscription => Instance of the \StripeWPFS\Subscription object created in the transaction for recurring donations * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterInlineDonationCharge( $params ) { $stripePaymentIntent = $params['stripePaymentIntent']; $stripeSubscription = $params['stripeSubscription']; // Do your thing here } add_action('fullstripe_after_donation_charge', 'afterInlineDonationCharge', 10, 1);
fullstripe_before_checkout_donation_charge
The fullstripe_before_checkout_donation_charge action is fired before a donation transaction is about to be started on a checkout form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_checkout_donation_charge' action hook example for WP Full Stripe. * It blocks the donation if the donation amount is less than $5. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * currency => ISO code of the payment currency (eg. USD) * frequency => The donation frequency, possible values: * one-time * daily * weekly * monhtly * annual * amount => Donation amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeCheckoutDonationCharge( $params ) { $amount = $params['amount']; if ( $amount < 500 ) { $ex = new WPFS_UserFriendlyException( "Please donate $5 or more" ); $ex->setTitle( 'Not allowed' ); throw $ex; } } add_action('fullstripe_before_checkout_donation_charge', 'beforeCheckoutDonationCharge', 10, 1 );
fullstripe_after_checkout_donation_charge
The fullstripe_after_checkout_donation_charge action is fired after a successful donation on a checkout form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_checkout_donation_charge' action hook example for WP Full Stripe. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * currency => ISO code of the payment currency (eg. USD) * frequency => The donation frequency, possible values: * one-time * daily * weekly * monhtly * annual * amount => Payment amount (it's in cents for non-zerodecimal currencies like the USD, EUR) * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripePaymentIntent => Instance of the \StripeWPFS\PaymentIntent object created in the transaction * stripeSubscription => Instance of the \StripeWPFS\Subscription object created in the transaction for recurring donations * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterCheckoutDonationCharge( $params ) { $stripePaymentIntent = $params['stripePaymentIntent']; $stripeSubscription = $params['stripeSubscription']; // Do your thing here } add_action('fullstripe_after_checkout_donation_charge', 'afterCheckoutDonationCharge', 10, 1);
fullstripe_before_card_capture
The fullstripe_before_card_capture action is fired before a Stripe customer is about to be saved on a inline form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_card_capture' action hook example for WP Full Stripe. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeInlineSaveCard( $params ) { $stripeClient = $params['stripeClient']; // Do your thing here } add_action('fullstripe_before_card_capture', 'beforeInlineSaveCard', 10, 1 );
fullstripe_after_card_capture
The fullstripe_after_card_capture action is fired after the Stripe customer has been successfully created on a save card inline form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_card_capture' action hook example for WP Full Stripe. * It posts an API request with the email address as a parameter in the content body. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripeCustomer => Instance of the \StripeWPFS\Customer object created in the transaction * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterInlineSaveCard( $params ) { $stripeCustomer = $params['stripeCustomer']; $url = 'http://myapi.com'; $data = array ( 'email' => $stripeCustomer->email ); $response = wp_remote_post( $url, array( 'body' => $data, )); if ( !is_wp_error ($response) ) { // The call was successful } else { // The call was NOT successful, handle error } } add_action('fullstripe_after_card_capture', 'afterInlineSaveCard', 10, 1);
fullstripe_before_checkout_card_capture
The fullstripe_before_checkout_card_capture action is fired before a Stripe customer is about to be saved on a checkout form.
You can block the transaction by throwing an exception.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_checkout_card_capture' action hook example for WP Full Stripe. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction */ function beforeCheckoutSaveCard( $params ) { $stripeClient = $params['stripeClient']; // Do your thing here } add_action('fullstripe_before_checkout_card_capture', 'beforeCheckoutSaveCard', 10, 1 );
fullstripe_after_checkout_card_capture
The fullstripe_after_checkout_card_capture action is fired after the Stripe customer has been successfully created on a save card checkout form.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the customer and the transaction. See the example below for details. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_checkout_card_capture' action hook example for WP Full Stripe. * It posts an API request with the email address as a parameter in the content body. * * @param array $params with the following keys: * email => Email address of the customer * urlParameters => Array of URL parameters * formName => Name of the form the payment is being made on * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the same API mode as the current transaction * stripeCustomer => Instance of the \StripeWPFS\Customer object created in the transaction * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration */ function afterCheckoutSaveCard( $params ) { $stripeCustomer = $params['stripeCustomer']; $url = 'http://myapi.com'; $data = array ( 'email' => $stripeCustomer->email ); $response = wp_remote_post( $url, array( 'body' => $data, )); if ( !is_wp_error ($response) ) { // The call was successful } else { // The call was NOT successful, handle error } } add_action('fullstripe_after_checkout_card_capture', 'afterCheckoutSaveCard', 10, 1);
fullstripe_before_subscription_cancellation
The fullstripe_before_subscription_cancellation action is fired before a subscription is canceled in Stripe.
Action parameters:
Name | Description |
---|---|
$subscriptionId | The identifier of the Stripe subscription. |
An example implementation with the documentation of the ‘subscriptionId’ parameter:
<?php /** * A 'fullstripe_before_subscription_cancellation' action hook example for WP Full Stripe. * * @param string $subscriptionId => Identifier of the Stripe subscription which is about to be cancelled */ function beforeSubscriptionCancellation( $subscriptionId ) { $stripeSubscription = MM_WPFS_API_v1::getStripeSubscription( $subscriptionId ); $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // Do your thing here } add_action('fullstripe_before_subscription_cancellation', 'beforeSubscriptionCancellation', 10, 1);
fullstripe_after_subscription_cancellation
The fullstripe_after_subscription_cancellation action is fired after a subscription has been canceled in Stripe.
Action parameters:
Name | Description |
---|---|
$subscriptionId | The identifier of the Stripe subscription. |
An example implementation with the documentation of the ‘subscriptionId’ parameter:
<?php /** * A 'fullstripe_after_subscription_cancellation' action hook example for WP Full Stripe. * * @param string subscriptionId => Identifier of the Stripe subscription which was cancelled */ function afterSubscriptionCancellation( $subscriptionId ) { $stripeClient = MM_WPFS_API_v1::getStripeClient(); $filter = array( 'expand' => array( 'customer', 'plan.product' ) ); $subscription = $stripeClient->subscriptions->retrieve( $subscriptionId, $filter ); $stripeCustomer = $subscription->customer; $customerName = $stripeCustomer->name; $customerEmail = $stripeCustomer->email; $subscriptionId = $subscription->id; $planName = $subscription->plan->product->name; $sender_name = html_entity_decode( get_bloginfo( 'name' ) ); $sender_email = 'subscriptions@example.com'; $recipient_email = "${customerEmail}"; $subject = 'Your subscription has been canceled'; $headers[] = "From: $sender_name <$sender_email>"; $headers[] = "Bcc: ${sender_email}"; $headers[] = "Content-type: text/html"; $message = "<html><body> <p>Dear ${customerName},</p> <p>Your ${planName} has been canceled. We are sorry to see you go.</p> <p>If you have any questions, contact us by replying to this email or by writing us at info@example.com.</p> <br/> </body></html>"; $send_result = wp_mail( $recipient_email, $subject, $message, $headers ); } add_filter( 'fullstripe_after_subscription_cancellation', 'afterSubscriptionCancellation', 10, 1);
fullstripe_before_subscription_update
The fullstripe_before_subscription_update action is fired before a subscription is updated on the “Customer Portal” page or via the plugin’s API.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the changes made to the subscription. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_before_subscription_update' action hook example for WP Full Stripe. * * @param array $params with the following keys: * stripeSubscriptionId => Identifier of the Stripe subscription * planId => Identifier of the new Stripe recurring price * quantity => The new subscription quantity */ function beforeSubscriptionUpdate( $params ) { $subscriptionId = $params['stripeSubscriptionId']; $stripeSubscription = MM_WPFS_API_v1::getStripeSubscription( $subscriptionId ); $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // Do your thing here } add_action('fullstripe_before_subscription_update', 'beforeSubscriptionUpdate', 10, 1);
fullstripe_after_subscription_update
The fullstripe_after_subscription_update action is fired after a subscription has been updated updated on the “Customer Portal” page or via the plugin’s API.
Action parameters:
Name | Description |
---|---|
$params | An array containing data about the changes made to the subscription. |
An example implementation with the documentation of the ‘params’ parameter:
<?php /** * A 'fullstripe_after_subscription_update' action hook example for WP Full Stripe. * * @param array $params with the following keys: * stripeSubscriptionId => Identifier of the Stripe subscription * planId => Identifier of the new Stripe recurring price * quantity => The new subscription quantity */ function afterSubscriptionUpdate( $params ) { $subscriptionId = $params['stripeSubscriptionId']; $stripeSubscription = MM_WPFS_API_v1::getStripeSubscription( $subscriptionId ); $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // Do your thing here } add_action('fullstripe_after_subscription_update', 'afterSubscriptionUpdate', 10, 1);
fullstripe_before_subscription_activation
The fullstripe_before_subscription_activation action is fired before a canceled subscription is reactivated by the customer on the “Customer portal” page.
Action parameters:
Name | Description |
---|---|
$subscriptionId | The identifier of the Stripe subscription. |
An example implementation with the documentation of the ‘subscriptionId’ parameter:
<?php /** * A 'fullstripe_before_subscription_activation' action hook example for WP Full Stripe. * * @param string subscriptionId => Identifier of the Stripe subscription which is about to be reactivated */ function beforeSubscriptionActivation( subscriptionId ) { $stripeSubscription = MM_WPFS_API_v1::getStripeSubscription( subscriptionId ); $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // Do your thing here } add_action('fullstripe_before_subscription_activation', 'beforeSubscriptionActivation', 10, 1);
fullstripe_after_subscription_activation
The fullstripe_after_subscription_activation action is fired after a canceled subscription has been reactivated by the customer on the “Customer portal” page.
Action parameters:
Name | Description |
---|---|
$subscriptionId | The identifier of the Stripe subscription. |
An example implementation with the documentation of the ‘subscriptionId’ parameter:
<?php /** * A 'fullstripe_after_subscription_activation' action hook example for WP Full Stripe. * * @param string subscriptionId => Identifier of the Stripe subscription which is about to be reactivated */ function afterSubscriptionActivation( subscriptionId ) { $stripeSubscription = MM_WPFS_API_v1::getStripeSubscription( subscriptionId ); $stripeCustomer = MM_WPFS_API_v1::getStripeCustomer( $stripeSubscription->customer ); // Do your thing here } add_action('fullstripe_after_subscription_activation', 'afterSubscriptionActivation', 10, 1);
Plugin filters
fullstripe_select_subscription_plan
The fullstripe_select_subscription_plan filter is used to control which subscription plan is selected by default when the page is loaded.
The filter is called when the URL parameter dedicated to selecting the default subscription plan is found in the page URL when loading a form.
Filter parameters and return value:
Name | Description |
---|---|
$selectedPlanId | The identifier of the subscription plan set by a previous filter of this filter chain. |
$formName | Name of the form that triggered the filter. |
$formPlanIds | An associative array of plan ids assigned to the current form. |
$planIdParamValue | Value of the ‘wpfsPlan’ URL parameter |
Return value | Identifier of the subscription plan that will be selected by default |
An example implementation of the filter:
<?php /** * Default implementation of the 'fullstripe_select_subscription_plan' Wordpress filter * for WP Full Stripe. * * @param $selectedPlanId Plan id set by a previous filter instance * @param $formName Name of the form that triggered the filter * @param $formPlanIds An associative array of plan ids assigned to the current form * @param $planIdParamValue Value of the wpfsPlan URL parameter * * @return integer The id of the plan to be selected on form $formName */ function selectSubscriptionPlan($selectedPlanId, $formName, $formPlanIds, $planIdParamValue) { $resultPlanId = $selectedPlanId; if (in_array($planIdParamValue, $formPlanIds)) { $resultPlanId = $planIdParamValue; } return $resultPlanId; } add_filter('fullstripe_select_subscription_plan', 'selectSubscriptionPlan', 10, 4);
fullstripe_set_custom_amount
The fullstripe_set_custom_amount filter is used to set the custom payment amount of a one-time payment form via an URL parameter.
The filter is called when the URL parameter dedicated to setting the custom payment amount is found in the page URL when loading a form.
Filter parameters and return value:
Name | Description |
---|---|
$customAmount | Custom payment amount set by a previous filter of this filter chain. |
$formName | Name of the form that triggered the filter. |
$customAmountParamValue | The value of the ‘wpfsAmount’ URL parameter |
Return value | Custom payment amount that will be entered by default |
An example implementation of the filter:
<?php /** * Default implementation of the 'fullstripe_set_custom_amount' Wordpress filter * for WP Full Stripe. * * @param $customAmount Payment amount set by a previous filter instance * @param $formName Name of the form that triggered the filter * @param $customAmountParamValue The value of the wpfsAmount * * @return integer The initial payment amount to be set on form $formName */ function set_custom_amount($customAmount, $formName, $customAmountParamValue) { return $customAmountParamValue; } add_action('fullstripe_set_custom_amount', 'set_custom_amount', 10, 3);
fullstripe_add_transaction_metadata
The fullstripe_add_transaction_metadata filter is used to set transaction metadata via URL parameters.
The filter is called when the page containing the form is loaded.
Filter parameters and return value:
Name | Description |
---|---|
$metadata | Associative array of metadata set by a previous filter instance. |
$formName | Name of the form that triggered the filter. |
$pageParams | Associative array of page URL parameters. |
Return value | Associative array of metadata to be added to the transaction |
An example implementation of the filter:
/** * Example implementation of the 'fullstripe_add_transaction_metadata' Wordpress filter * for WP Full Stripe. * * @param $metadata Associative array of metadata set by a previous filter instance * @param $formName Name of the form that triggered the filter * @param $pageParams Associative array of page URL parameters * * @return Associative array of metadata to be added to the transaction */ function set_affiliate_metadata($metadata, $formName, $pageParams) { $result_meta = is_null($metadata) ? array() : $metadata; if (array_key_exists('affid', $pageParams)) { $result_meta['affid'] = $pageParams['affid']; } return $result_meta; } add_action('fullstripe_add_transaction_metadata', 'set_affiliate_metadata', 10, 3);
Where can you find metadata on the Stripe dashboard?
Go to the Where are custom fields on the Stripe dashboard? knowledge base article for instructions.
fullstripe_get_upgrade_downgrade_plans
The fullstripe_get_upgrade_downgrade_plans filter is used to set the list of subscription plans the customer is offered on the “Customer portal” page when upgrading/downgrading a subscription.
The filter is called before the “Customer portal” page is loaded.
The filter is useful when the Customer portal must offer more plans for upgrade/downgrade than the plans originally offered by the subscription form. This can happen when subscription forms with a single plan are integrated into pricing tables.
Filter parameters and return value:
Name | Description |
---|---|
$formPlanIds | Array of recurring price ids set by a previous filter instance. |
$formName | Name of the form using which the current subscription was purchased. |
Return value | Array of recurring price ids that is offered to the customer for upgrading/downgrading. |
An example implementation of the filter:
<?php /** * A 'fullstripe_get_upgrade_downgrade_plans' filter hook example for WP Full Stripe. * * @param array $formPlanIds => Array of recurring price ids set by a previous filter instance * @param string $formName => Name of the form using which the current subscription was purchased * * @return array $formPlanIds Array of recurring price ids that is offered to the customer for upgrading/downgrading */ function getUpgradeDowngradePlans( $formPlanIds, $formName ) { return ['price_4fgv4t5fdgfdgdfg', 'price_5tGxv45tGFsv3', 'price_bFG6hgFSnb34fC']; } add_action('fullstripe_get_upgrade_downgrade_plans', 'getUpgradeDowngradePlans', 10, 2);
fullstripe_customer_portal_header
The fullstripe_customer_portal_header filter is used to display extra content at the top of the “Customer portal” page.
The filter is called before the “Customer portal” page is loaded.
Filter parameters and return value:
Name | Description |
---|---|
$content | Header content set by a previous filter instance. |
$params | An array containing data about the customer and the Stripe client. See the example below for details. |
Return value | Header content modified by the filter |
An example implementation of the filter:
<?php /** * A 'fullstripe_customer_portal_header' filter hook example for WP Full Stripe. * * @param string $content Header content set by a previous filter instance. * @param array $params with the following keys: * email => Email address of the logged-in customer * stripeCustomerId => Stripe customer id of the logged-in customer * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the API mode selected in the plugin's settings * * @return string Filtered content */ function customerPortalHeader( $headerContent, $params ) { $email = $params['email']; $stripeCustomerId = $params['stripeCustomerId']; $stripeClient = $params['stripeClient']; $headerContent .= '<h3>Header</h3>'; $headerContent .= '<p>Email: ' . $email . '</p>'; $headerContent .= '<p>stripeCustomerId: ' . $stripeCustomerId . '</p>'; return $headerContent; } add_filter( 'fullstripe_customer_portal_header', 'customerPortalHeader', 10, 2 );
fullstripe_customer_portal_footer
The fullstripe_customer_portal_footer filter is used to display extra content at the bottom of the “Customer portal” page.
The filter is called before the “Customer portal” page is loaded.
Filter parameters and return value:
Name | Description |
---|---|
$content | Header content set by a previous filter instance. |
$params | An array containing data about the customer and the Stripe client. See the example below for details. |
Return value | Header content modified by the filter |
An example implementation of the filter:
<?php /** * A 'fullstripe_customer_portal_footer' filter hook example for WP Full Stripe. * * @param string $content Footer content set by a previous filter instance. * @param array $params with the following keys: * email => Email address of the logged-in customer * stripeCustomerId => Stripe customer id of the logged-in customer * stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the API mode selected in the plugin's settings * * @return string Filtered content */ function customerPortalFooter( $headerContent, $params ) { $email = $params['email']; $stripeCustomerId = $params['stripeCustomerId']; $stripeClient = $params['stripeClient']; $headerContent .= '<h3>Footer</h3>'; $headerContent .= '<p>Email: ' . $email . '</p>'; $headerContent .= '<p>stripeCustomerId: ' . $stripeCustomerId . '</p>'; return $headerContent; } add_filter( 'fullstripe_customer_portal_footer', 'customerPortalFooter', 10, 2 );
fullstripe_modify_email_subject
The fullstripe_modify_email_subject filter is used to change the subject of an email notification which is to be sent by the plugin.
The filter is called before placeholder tokens are resolved in the email subject and before the email is sent out.
Filter parameters and return value:
Name | Description |
---|---|
$subject | Email subject set by a previous filter instance. |
$params | An array containing data about email to be sent. See the example below for details. |
Return value | Filtered email subject |
An example implementation of the filter:
<?php /** * A 'fullstripe_modify_email_subject' filter hook example for WP Full Stripe. * * @param string $subject Email subject set by a previous filter instance * @param array $params with the following keys: * template => Identifier of the mail template to be sent. Possible values: * PaymentReceipt - One-time payment receipt * SubscriptionReceipt - Subscription receipt * SubscriptionEnded - Payment-in-istallments subscription terminated by plugin * DonationReceipt - Donation receipt * CardSaved - Saved card notification * ManageSubscriptionsSecurityCode - One-time login code for Customer portal * registrationSuccessful - Registration email sent by WP Full Stripe Members * formName => Name of the form the payment was submitted on. * Null if email is not payment related. * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration * * @return string Filtered email subject */ function modifyEmailSubject( $subject, $params ) { $result = $subject; $prefix = '[Full Stripe] '; if ( strpos( $result, $prefix ) === false ) { $subject = $prefix . $result; } return $result; } add_action('fullstripe_modify_email_subject', 'modifyEmailSubject', 10, 2);
fullstripe_modify_email_message
The fullstripe_modify_email_message filter is used to change the body of an email notification which is to be sent by the plugin.
The filter is called before placeholder tokens are resolved in the email body and before the email is sent out.
Filter parameters and return value:
Name | Description |
---|---|
$body | Email body set by a previous filter instance. |
$params | An array containing data about email to be sent. See the example below for details. |
Return value | Filtered email body |
An example implementation of the filter:
<?php /** * A 'fullstripe_modify_email_message' filter hook example for WP Full Stripe. * * @param string $body Email body set by a previous filter instance * @param array $params with the following keys: * template => Identifier of the mail template to be sent. Possible values: * PaymentReceipt - One-time payment receipt * SubscriptionReceipt - Subscription receipt * SubscriptionEnded - Payment-in-istallments subscription terminated by plugin * DonationReceipt - Donation receipt * CardSaved - Saved card notification * ManageSubscriptionsSecurityCode - One-time login code for Customer portal * registrationSuccessful - Registration email sent by WP Full Stripe Members * formName => Name of the form the payment was submitted on. * Null if email is not payment related. * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration * * @return string Filtered email body */ function modifyEmailMessage( $body, $params ) { $result = $body; $template = $params['template']; if ( $template === 'registrationSuccessful' ) { // Do something with the email body here } return $result; } add_action('fullstripe_modify_email_message', 'modifyEmailMessage', 10, 2);
fullstripe_thank_you_output
The fullstripe_thank_you_output filter is used to change the contents of content area marked by the thank you shortcode before it’s displayed.
The filter is called before placeholder tokens are resolved.
Filter parameters and return value:
Name | Description |
---|---|
$params | An array containing data about the thank you page. See the example below for details. |
Return value | Filtered contents marked by the thank you shortcode |
An example implementation of the filter:
<?php /** * A 'fullstripe_thank_you_output' filter hook example for WP Full Stripe. * It sends a conversion to the affiliate system called Tapfiliate. * * @param string output Contents of the thank you shortcode * @param array $params with the following keys: * formType => Type of the form that opened the thank you page. Possible values: * payment (one-time) * subscription * donation * save_card * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration * * @return string Filtered contents of the thank you shortcode */ function thankYouOutput($output, $params) { if ($params['formType'] === 'subscription') { $rawPlaceholders = $params['rawPlaceholders']; $rawAmount = $rawPlaceholders['%AMOUNT%']; $amount = round($rawAmount / 100, 2); $tapBlock = <<<EOT <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script> <script type="text/javascript"> (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap'); tap('create', 'YOUR ACCOUNT ID', { integration: "stripe" }); tap('conversion', '%TRANSACTION_ID%', ${amount}, {customer_id: '%STRIPE_CUSTOMER_ID%'}); </script> EOT; $output = $output . $tapBlock; } return $output; } add_filter('fullstripe_thank_you_output', 'thankYouOutput', 10, 2);
fullstripe_thank_you_url_parameters
The fullstripe_thank_you_url_parameters filter is used to add URL parameters to the thank you page URL.
The filter is called before the thank you page URL is opened.
Filter parameters and return value:
Name | Description |
---|---|
$urlParams | An associative array of URL parameters returned by previous filters of the chain. |
$filterParams | An array containing data about form opening the thank you page. See the example below for details. |
Return value | Filtered associative array of URL parameters to be added to the thank you page URL. |
An example implementation of the filter:
<?php /** * A 'fullstripe_thank_you_url_parameters' filter hook example for WP Full Stripe. * It adds the transaction id and the customer's email address as URL parameters to the thank you page URL. * * @param string $urlParams Associative array of URL parameters returned by previous filters of the chain. * @param array $filterParams with the following keys: * formName => Name of the form that opened the thank you page. * formType => Type of the form that opened the thank you page. Possible values: * inline_payment * checkout_payment * inline_subscription * checkout_subscription * inline_donation * checkout_donation * inline_save_card * checkout_save_card * rawPlaceholders => All placeholder tokens, no decoration * decoratedPlaceholders => All placeholder tokens with decoration * * @return string Filtered array of URL parameters */ function thankYouUrlParameters( $urlParams, $filterParams ) { $result = $urlParams; $rawPlaceholders = $filterParams['rawPlaceholders']; $result['id'] = $rawPlaceholders['%TRANSACTION_ID%']; $result['email'] = $rawPlaceholders['%CUSTOMER_EMAIL%']; return $result; } add_filter('fullstripe_thank_you_url_parameters', 'thankYouUrlParameters', 10, 2);
fullstripe_thank_you_post_types
The fullstripe_thank_you_post_types filter is used to extend the list of pages/posts offered by forms as thank you page candidates in WP admin.
The filter is called before a form is opened for editing in WP admin.
Filter parameters and return value:
Name | Description |
---|---|
$postTypes | An array of post types returned by previous filters of the chain. |
$filterParams | An array containing data about the form to be opened for editing. See the example below for details. |
Return value | Filtered array of post types. |
An example implementation of the filter:
<?php /** * A 'fullstripe_thank_you_url_parameters' filter hook example for WP Full Stripe. * It adds the transaction id and the customer's email address as URL parameters to the thank you page URL. * * @param string $postTypes Array of post types returned by previous filters of the chain. * @param array $params with the following keys: * formName => Name of the form to be opened for editing * formType => Type of the form to be opened for editing. Possible values: * inline_payment * checkout_payment * inline_subscription * checkout_subscription * inline_donation * checkout_donation * inline_save_card * checkout_save_card * * @return string Filtered array of post types */ function thankYouPostTypes( $postTypes, $params ) { $result = $postTypes; if ( false === array_search( 'post', $postTypes ) ) { array_push( $result, 'post' ); } return $result; } add_filter('fullstripe_thank_you_post_types', 'thankYouPostTypes', 10, 2);
fullstripe_billing_countries
The fullstripe_billing_countries filter is used to collect the list of countries that should be offered as billing countries on forms.
The filter is called before a form is displayed.
Filter parameters and return value:
Name | Description |
---|---|
$countryCodes | An array of 2-letter ISO country codes returned by previous filters of the chain. |
$filterParams | An array containing data about the form that will display the billing country options. See the example below for details. |
Return value | Filtered array of 2-letter ISO country codes. |
An example implementation of the filter:
<?php /** * A 'fullstripe_billing_countries' filter hook example for WP Full Stripe. * It sets Spain as the only country offered in billing country dropdown on all forms. * * @param string $countryCodes Array of 2-letter ISO country codes returned by previous filters of the chain. * @param array $params with the following keys: * formName => Name of the form that requires the list of billing countries. * formType => Type of the form that requires the list of billing countries. Possible values: * inline_payment * checkout_payment * inline_subscription * checkout_subscription * inline_donation * checkout_donation * inline_save_card * checkout_save_card * * @return string Filtered array of 2-letter ISO country codes */ function getBillingCountries( $countryCodes, $params) { $result = $countryCodes; // Set Spain as the only billing country for every form $result = [ 'ES' ]; return $result; } add_filter('fullstripe_billing_countries', 'getBillingCountries', 10, 2 );
fullstripe_shipping_countries
The fullstripe_shipping_countries filter is used to collect the list of countries that should be offered as shipping countries on forms.
The filter is called before a form is displayed.
Filter parameters and return value:
Name | Description |
---|---|
$countryCodes | An array of 2-letter ISO country codes returned by previous filters of the chain. |
$filterParams | An array containing data about the form that will display the shipping country options. See the example below for details. |
Return value | Filtered array of 2-letter ISO country codes. |
An example implementation of the filter:
<?php /** * A 'fullstripe_shipping_countries' filter hook example for WP Full Stripe. * * @param string $countryCodes Array of 2-letter ISO country codes returned by previous filters of the chain. * @param array $params with the following keys: * formName => Name of the form that requires the list of shipping countries. * formType => Type of the form that requires the list of shipping countries. Possible values: * inline_payment * checkout_payment * inline_subscription * checkout_subscription * inline_donation * checkout_donation * inline_save_card * checkout_save_card * * @return string Filtered array of 2-letter ISO country codes */ function getShippingCountries( $countryCodes, $params) { $result = $countryCodes; // Set Italy, United States, and Hungary as the shipping countries if the name of the form is 'paymentInlineDefault' // For every other form, display all countries if ( $params['formName'] === 'paymentInlineDefault' ) { $result = [ 'IT', 'US', 'HU' ]; } return $result; } add_filter('fullstripe_shipping_countries', 'getShippingCountries', 10, 2 );
fullstripe_payment_intent_parameters
The fullstripe_payment_intent_parameters filter is used to change the Stripe PaymentIntent parameters.
The filter is called before the plugin creates the PaymentIntent.
Name | Description |
---|---|
$params | An array containing the PaymentIntent parameters |
Return value | Filtered PaymentIntent parameters |
An example implementation of the filter:
<?php /** * A 'fullstripe_payment_intent_parameters' filter hook example for WP Full Stripe. * * @param array params PaymentIntent parameters * * @return array Filtered PaymentIntent parameters */ function paymentIntentParameters( $params ) { $result = $params; // Modify the parameters return $result; } add_filter('fullstripe_payment_intent_parameters', 'paymentIntentParameters', 10, 1 );
fullstripe_checkout_session_parameters
The fullstripe_checkout_session_parameters filter is used to change the Stripe CheckoutSession parameters.
The filter is called before the plugin creates the CheckoutSession.
Name | Description |
---|---|
$params | An array containing the CheckoutSession parameters |
Return value | Filtered CheckoutSession parameters |
An example implementation of the filter:
<?php /** * A 'fullstripe_checkout_session_parameters' filter hook example for WP Full Stripe. * This examples enables Stripe Tax for all checkout sessions. * * @param array params CheckoutSession parameters * * @return array Filtered CheckoutSession parameters */ function checkoutSessionParameters( $params ) { $result = $params; if ( false === array_key_exists( 'automatic_tax', $result ) ) { $result['automatic_tax'] = [ 'enabled' => true, ]; } return $result; } add_filter('fullstripe_checkout_session_parameters', 'checkoutSessionParameters', 10, 1 );
fullstripe_determine_tax_rates
The fullstripe_determine_tax_rates filter is used to select the Stripe tax rates based on tax id, tax country, and tax state of the customer.
The filter is called when a vat id is entered or modified, or a new tax country or tax state is selected on a form.
Name | Description |
---|---|
$taxRates | The Stripe tax rates selected by the plugin or a previous filter of the filter chain. |
$params | An array containing tax-related data about the customer. See the example below for details. |
Return value | Filtered Stripe tax rates |
An example implementation of the filter:
<?php /** * A 'fullstripe_determine_tax_rates' filter hook example for WP Full Stripe. * It implements an EU tax rate filter for business buyers in the EU. The EU tax ID is not validated. * * @param array taxRates The Stripe tax rates selected by the plugin or a previous filter of the filter chain. * @param array params array $params with the following keys: * country => Tax country selected by the customer * state => Tax state/region selected by the customer * taxId => Tax id entered by the customer * * @return array Filtered tax rates */ function determineTaxRates( $taxRates, $params ) { $result = $taxRates; $euCountries = array('LU', 'MT', 'CY', 'DE', 'RO', 'AT', 'EE', 'FR', 'SK', 'SE', 'BE', 'BG', 'CZ', 'ES', 'NL', 'LT', 'LV', 'IT', 'PT', 'SI', 'IE', 'PL', 'FI', 'GR', 'HR', 'DK', 'HU'); $country = $params['country']; $taxId = $params['taxId']; if ( array_search( $country, $euCountries) && ! empty( $taxId )) { $result = []; } return $result; } add_filter('fullstripe_determine_tax_rates', 'determineTaxRates', 10, 2 );
fullstripe_determine_tax_label
The fullstripe_determine_tax_label filter is used to set the tax label when Stripe Tax is used to calculate tax.
The filter is called by inline payment and subscription forms when the form is either opened or updated due to an applied coupon, a set tax id, or a changed address.
Name | Description |
---|---|
$label | The tax label set by the plugin or a previous filter of the filter chain. |
$params | An array containing data about the tax calculation. See the example below for details. |
Return value | Filtered tax label |
An example implementation of the filter:
<?php /** * A 'fullstripe_determine_tax_label' filter hook example for WP Full Pay. * * @param string $label The tax label returned by the previous filter instance. * @param array $params with the following keys: * taxableAmount => The net payment amount, in cents. * amount => The tax amount, in cents. * inclusive => Boolean value indicating whether the tax amount is included in the product price. * taxabilityReason => Taxability reason, see https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_amounts-taxability_reason for more information, * country => The buyer's uppercase ISO country code. * state => The buyer's state or region. Applicable only in case of US and Canada. * postalCode => The buyer's state or region. Applicable only in case of US and Canada. * taxIdType => The buyer's tax id type. It's set only when the buyer's tax information is collected, otherwise null. * taxId => The buyer's tax id. It's set only when the buyer's tax information is collected, otherwise null. * * @return string Tax label */ function determineTaxLabel( $label, $params ) { $result = $label; $euCountries = array('LU', 'MT', 'CY', 'DE', 'RO', 'AT', 'EE', 'FR', 'SK', 'SE', 'BE', 'BG', 'CZ', 'ES', 'NL', 'LT', 'LV', 'IT', 'PT', 'SI', 'IE', 'PL', 'FI', 'GR', 'HR', 'DK', 'HU'); $country = $params['country']; if ( array_search( $country, $euCountries)) { $result = 'VAT'; } return $result; } add_filter('fullstripe_determine_tax_label', 'determineTaxLabel', 10, 3 );
fullstripe_members_supported_post_types
The fullstripe_members_supported_post_types filter is used to return the custom post types that can be protected by the plugin.
The filter is called when the Wordpress page editor is about to open a content for editing.
Name | Description |
---|---|
$postTypes | The post types array provided by the plugin or a previous filter of the filter chain. |
$params | An array containing additional parameters. Not used currently. |
Return value | Filtered custom post types array |
An example implementation of the filter:
<?php /** * A 'fullstripe_members_supported_post_types' filter hook example for WP Full Stripe Members. * It implements a filter hook that adds the 'post' post type to the supported custom post types. * * @param array postTypes The custom post types provided by the plugin or a previous filter of the filter chain. * @param array params array $params An array containing additional parameters. Not used currently. * * @return array Filtered custom post types array */ function addCustomPostTypes( $postTypes, $params ) { $result = $postTypes; if ( false === array_search('post', $postTypes) ) { array_push( $result, 'post' ); } return $result; } add_filter('fullstripe_members_supported_post_types', 'addCustomPostTypes', 10, 2 );
fullstripe_form_field_configuration
The fullstripe_form_field_configuration filter is used to configure which form fields can be pre-filled via URL parameters, and which form fields should be read-only once they are set.
The filter is called before the plugin renders the form.
Name | Description |
---|---|
$config | A field configuration array of the form that is about to be rendered. |
$params | An array containing data about the form. See the example below for details. |
Return value | Filtered form field configuration array |
An example implementation of the filter:
<?php /** * A 'fullstripe_form_field_configuration' filter hook example for WP Full Pay. * * @param array $config The field configuration returned by the previous filter instance. * @param array $params with the following keys: * formName => Name of the form. * formType => Type of the form. Possible values: * inline_payment * checkout_payment * inline_subscription * checkout_subscription * inline_donation * checkout_donation * inline_save_card * checkout_save_card * * @return array Field configuration */ function formFieldConfiguration( $config, $params ) { $result = $config; $formName = $params['formName']; if ( $formName === 'payment' ) { WPFS_API_v2::setIsFormFieldConfigurable( $result, 'cardholdersName', true ); WPFS_API_v2::setIsFormFieldConfigurable( $result, 'email', true ); WPFS_API_v2::setIsFormFieldReadonly( $result, 'email', true ); } return $result; } add_filter('fullstripe_form_field_configuration', 'formFieldConfiguration', 10, 2 );
Use this filter in conjunction with the following API functions: