• Hello,

    I’m trying to build a payment system with WP and I’m getting troubles to get a cookie value (or user_id) outside WP.

    Here’s how the system works:

    1- The user log in
    2- When he click on “Pay” button a cookie is set with the product’s (post) ID
    3- The user is redirected to the payment gateway to insert all his information.
    3- Once he pays the gateway makes a call to an URL (/wp-content/themes/mytheme/success.php or /wp-content/themes/mytheme/cancelled.php) sending by POST all the transaction information
    4- The user is redirected to the main website

    The problem is that I’m not able to get the “product’s ID Cookie” from the success.php or cancelled.php. I also try to get the current_user ID but the result is the same.

    I tryied using:

    $user_id = wp_get_current_user()->ID;
    $user_id = $_COOKIE['producte_id'];

    Any idea?

    Thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Get Cookies or Current User ID outside WP’ is closed to new replies.