Php WordPress:将条带信息存储为用户\元

Php WordPress:将条带信息存储为用户\元,php,wordpress,stripe-payments,Php,Wordpress,Stripe Payments,我使用Stripe webhook来存储客户在Stripe中被收费时所收取的美元金额 我已经让webhook运行良好,可以通过电子邮件发送费用金额,但似乎无法将其存储在WordPress用户的元字段中 我的代码是这样的: // Retrieve the request's body and parse it as JSON $input = @file_get_contents("php://input"); $event_json = json_decode($input);

我使用Stripe webhook来存储客户在Stripe中被收费时所收取的美元金额

我已经让webhook运行良好,可以通过电子邮件发送费用金额,但似乎无法将其存储在WordPress用户的元字段中

我的代码是这样的:

// Retrieve the request's body and parse it as JSON
    $input = @file_get_contents("php://input");
    $event_json = json_decode($input);

// Check against Stripe to confirm that the ID is valid
    $event = \Stripe\Event::retrieve($event_json->id);

// If charge is successful, store in user meta
    if (isset($event) && $event->type == "charge.succeeded") { 
      $amount = $event->data->object->amount / 100;
    }
    $payment_user_id = 9192321; 
    update_user_meta($payment_user_id, 'payment_history', $amount);
这是因为从stripe接收到的json格式需要转换成某种格式才能存储吗?如果我尝试使用intval($amount)将其转换为整数,它只将其存储为0


提前谢谢

结果证明我很笨,只需要在“if”语句中添加“update\u user\u meta”