I am trying to use the Pay Pal Pro plug in to let users purchase 3 different pieces of content on my site. If the PayPal purchase goes through, I want to store the fact that they have made the purchase for future sessions.
I thought I could just store the purchased content in the user meta fields when gform_paypal_fulfillment is triggered. So far I am not having much luck. I am not sure if the method is getting called or not.
Am I on the right track or is there a simplier/better way to track purchases associated with users?
Here is the function I was using from functions.php:
add_action("gform_paypal_fulfillment", "process_order", 10, 4);
function process_order($entry, $config, $transaction_id, $amount) {
$user_id = get_current_user_id();
if($user_id)
{
$key = 'boughtEthics';
$value = $entry['3.3'];
update_user_meta( $user_id, $key, $value);
$key = 'boughtGeneralTax';
$value = $entry['4.3'];
update_user_meta( $user_id, $key, $value);
$key = 'boughtCurrentTax';
$value = $entry['5.3'];
update_user_meta( $user_id, $key, $value);
}
}