我正在使用带 wordpress 的条连接 api,并且我已经设法设置流程来连接用户,并获取他们的访问令牌和用户 ID。但是,我需要以与 wordpress 用户相关的方式保存它,因为我需要能够稍后回来参考代码,以便向正确的人付款。我用 add_user_meta() 写了几行,但我的 var_dump() 为空。这是一些代码:
global $wpdb;
$table = $wpdb->prefix."stripe_connect";
$wpdb->insert($table , array(
'time' => current_time('mysql'),
'access_token' => $token,
'stripe_publishable_key' => $key,
'stripe_user_id' => $userid)
);
$user_ID = get_current_user_id();
add_user_meta($user_ID, ‘stripe_userid’, $userid, $unique);
add_user_meta($user_ID, ‘stripe_token’, $token, $unique);
$stripeuserid = get_user_meta($user_ID, 'stripe_userid', true);
var_dump($stripeuserid);
$response = '<h4>Thank you for connecting with Stripe. This information has been saved in the database and can be viewed in the Admin Panel.</h4>';