The gform_stripe_fulfillment action allows you to perform custom actions after a Stripe checkout session is completed.
Usage
do_action('gform_stripe_fulfillment', $session, $entry, $feed, $form);
Parameters
- $session (array): The session object.
- $entry (array): The entry object.
- $feed (array): The feed object.
- $form (array): The form object.
More information
See Gravity Forms Docs: gform_stripe_fulfillment
Examples
Send Email Notification on Successful Checkout
Notify the site admin when a Stripe Checkout session has been completed successfully.
add_action('gform_stripe_fulfillment', 'notify_on_checkout_success', 10, 4); function notify_on_checkout_success($session, $entry, $feed, $form) { $admin_email = get_bloginfo('admin_email'); wp_mail($admin_email, 'Payment via Stripe Checkout successful!', 'Message about the successful payment'); }
Update User Metadata on Checkout
Update user metadata with the Stripe checkout session ID after a successful checkout.
add_action('gform_stripe_fulfillment', 'update_user_metadata_on_checkout', 10, 4); function update_user_metadata_on_checkout($session, $entry, $feed, $form) { $user_id = get_current_user_id(); update_user_meta($user_id, 'stripe_checkout_session_id', $session->id); }
Add Custom Order Notes
Add custom order notes to the entry after a successful checkout.
add_action('gform_stripe_fulfillment', 'add_custom_order_notes', 10, 4); function add_custom_order_notes($session, $entry, $feed, $form) { $note = 'Custom order note'; gform_add_note($entry['id'], $note, 'user', false); }
Change Entry Status
Change the entry status to “Completed” after a successful checkout.
add_action('gform_stripe_fulfillment', 'change_entry_status', 10, 4); function change_entry_status($session, $entry, $feed, $form) { GFAPI::update_entry_property($entry['id'], 'status', 'Completed'); }
Send Custom Data to External API
Send custom data to an external API after a successful checkout.
add_action('gform_stripe_fulfillment', 'send_data_to_external_api', 10, 4); function send_data_to_external_api($session, $entry, $feed, $form) { $data = array( 'entry_id' => $entry['id'], 'total' => $entry['payment_amount'], 'email' => $entry['2'], // Replace '2' with your email field ID ); $response = wp_remote_post('https://your-api.example.com/endpoint', array( 'body' => $data, )); }