我正在尝试使用wepay创建一个简单的结帐页面,我的结帐代码(取自SDK示例)在我登录时对所有者(我)非常有效,但是当我作为一个没有创建帐户的不同用户登录时(在他们的下面?)它会显示该帐户无效或不属于该用户。
那么,新登录的用户应该如何向帐户(我的)付款,换句话说,如何付款?
这是供参考的代码。account_id不适用于新登录的用户,因为他们还没有创建它。
$wepay = new WePay($_SESSION['wepay_access_token']);
$checkout = $wepay->request('checkout/create', array(
'account_id' => 501999810,
'amount' => 1.00,
'currency'=> 'USD',
'short_description'=> 'Selling 42 Pens',
'type'=> 'goods'
));也许我有一些完全不对劲的东西,但是那个account_id是我想要收到付款的地方?
任何帮助都将不胜感激!
发布于 2017-06-06 00:26:00
一旦您注册了用户,您必须通过调用/account/create创建一个实际的商家帐户。
获得用户的访问令牌后,您可以使用用户的访问令牌和相关信息调用/account/create,以便将帐户实际附加到用户。/account/create调用将返回一个account_id。这个account_id就是您在/checkout/create调用中使用的那个。
因此,在您通过/account/create创建帐户之前,用户无法接受付款。
发布于 2018-11-28 14:15:59
$productData['data']['seller_data']['wepay_access_token']="STAGE_ea6cd2dffa3dfa23bd4817f210936fadada9fa91e906f353e15813c6cf920fb8";
$productData['data']['seller_data'}['wepay_account_id']="287443494";
$wepay = new WePay($productData['data']['seller_data']['wepay_access_token']);
$checkOutData = array(
//"account_id" => 12345678,
"account_id" => $productData['data']['seller_data'}['wepay_account_id'],
"amount" => 500,
"type" => "goods",
"currency" => "USD",
"short_description" => "Purchase made at test site",
"long_description" => "The charges made in this payment are of the order placed in test",
"delivery_type" => "point_of_sale",
"fee" => array(
"app_fee" => 15,
//'fee_payer' => 'payer_from_app'
'fee_payer' => 'payee_from_app'
),
//"auto_release"=>false,
"payment_method" => array(
"type" => "credit_card",
"credit_card" => array(
"id" => 2178689241,
"auto_capture" => false
)
)
);
try {
$checkoutResult = $wepay->request('checkout/create', $checkOutData);
} catch (Exception $e) {
$data['status'] = '0';
$data['message'] = 'We could not complete checkout!';
return $this->SetOutput();
}
You can get seller access token and account id using
$user_id=20;
$access_token="STAGE_ea6cd2dffa3dfa23bd4817f210936fadada9fa91e906f353e15813c6cf920fb8":
$userName="test user";
$description="sell products";
try {
$wepay = new WePay($access_token);
if (empty($userName)) {
try {
$uresponse = $wepay->request('/user');
$userName = $uresponse->user_name;
} catch (WePayException $e) {
$uresponse['status'] = '0';
$uresponse['message'] = $e->getMessage();
return $uresponse;
}
}
$response = $wepay->request('account/create/', array(
'name' => $userName,
'description' => $description,
'reference_id' => '"' . $user_id . '"'
));
} catch (WePayException $e) {
$response['status'] = '0';
$response['message'] = $e->getMessage();
return $response;
}https://stackoverflow.com/questions/43529310
复制相似问题