You can run some additional tasks after the simple cart plugin has processed a sale.
Note: This should only be tried by a developer as it involves custom PHP coding.
The plugin includes action hooks that are triggered after the checkout data is processed. These hooks allow you to perform additional custom tasks. Below is a code snippet demonstrating how to use one of these action hooks.
You can add this code to the functions.php
file of your theme or to a custom plugin.
Table of Contents
PayPal Commerce Platform
Here is example code if you are using the PayPal Commerce Platform (PPCP) checkout option.
add_action('wpsc_paypal_checkout_ipn_processed', 'wpsc_custom_post_payment_tasks'); function wpsc_custom_post_payment_tasks($ipn_data) { //You can write the $ipn_data array's content to a file. $firstname = $ipn_data['first_name']; $lastname = $ipn_data['last_name']; $email = $ipn_data['payer_email'] //TODO - Do something with the data }
PayPal Standard
Here is example code if you are using the standard PayPal checkout option.
add_action('wpspc_paypal_ipn_processed', 'wspsc_pp_ipn_tasks'); function wspsc_pp_ipn_tasks($ipn_data) { //You can write the $ipn_data array's content to a file to see //what paypal sends in the IPN $firstname = $ipn_data['first_name']; $lastname = $ipn_data['last_name']; $email = $ipn_data['payer_email'] //Do something with the data }
The PayPal IPN message consists of variables and is available as an array inside your function. You can access an element of the array by using the proper variable name. To see a list of all the available variables please check the PayPal IPN documentation page.
Stripe Checkout
Here is example code if you are using the Stripe checkout option.
add_action('wpspc_stripe_ipn_processed', 'wpsc_stripe_post_payment_tasks'); function wpsc_stripe_post_payment_tasks($ipn_data) { //You can write the $ipn_data array's content to a file. $firstname = $ipn_data['first_name']; $lastname = $ipn_data['last_name']; $email = $ipn_data['payer_email'] //TODO - Do something with the data }
Note: We provide technical support for our premium plugins via our customer only support forum