Webworkz Plugins Documentation
Using an Action Hook
For developers looking to trigger a Stripe Checkout session programmatically, the plugin provides the {mswr-initiate-stripe-payment}
action hook. This method offers maximum flexibility, allowing you to initiate payments from within your theme or plugin code.
How It Works
- Trigger the Action – Call
do_action( 'mswr-initiate-stripe-payment', $args );
where$args
is an associative array of parameters. - Modify Parameters (Optional) – The
{mswr-pre-stripe-checkout}
filter will be triggered after initiating withdo_action
, providing an additional opportunity to modify parameters before passing them to Stripe.
Example Usage
$args = array(
'amount' => 5000, // Amount in cents (e.g., 5000 = $50.00)
'currency' => 'NZD',
'product' => 'Membership Payment',
'success_url' => site_url('/payment-success'),
'cancel_url' => site_url('/payment-cancel'),
$result=do_action( 'mswr-initiate-stripe-payment', $args );
Parameters
The parameters available for this method are the same as those outlined in the Technical Reference section.