• I am trying to update a user’s customer metadata field when a subscription is payment is made.

    The goal being:

    User first subscribes > Trigger this function

    User automatically pays for subsequent months > Trigger this function

    The Function:

    function my_change_meta_on_payment_received($morder) {
    update_user_meta($morder->user_id, 'meta_field_1', 1);
    }
    add_action('pmpro_subscription_payment_completed', 'my_change_meta_on_payment_received', 10, 1);

    (Note – I have dumbed this function down to a very basic test, change ‘meta_field_1‘ to “1”).

    What’s Happening:

    Nothing is happening. Would this be due to running this in a ‘testing’ environment?

    I have tested this with my Payment Gateway set to: Testing Only, but also tried Stripe – both with the Gateway Environment set to: Sandbox/Testing.

    When testing with Stripe, I have successfully “Connected in test mode”.

    When testing with Stripe, I have successfully “Connected in test mode”.

    As a further question – I’m getting this working in the test environment, should that continue to work once I have it live with Stripe or I need to redo the code in some way?

    The page I need help with: [log in to see the link]

  • You must be logged in to reply to this topic.