从 Stripe 中的 Charge 对象获取卡片信息
Get Card Information from Charge object in Stripe
我在网站上集成了条纹支付方式。我想获取卡片信息。一切正常。付款成功后,我成功地从 $charge->id
变量中检索了付款 ID。所以我的问题是,当我 print_r($charge)
它也显示 Card Object Something like That
Stripe_Card Object ( [_apiKey:protected] => sk_test_...
[_values:protected] => Array ( [id] => card_1BLSPnJ6IzxnlSnmegEq6dbH
[object] => card [address_city] => Lahire [address_country] => Pakistan
我的条纹过程
$customer =Stripe_Customer::create(array(
'email' => $_GET['email'],));
$charge = Stripe_Charge::create(array(
"amount" => $amount_cents,"currency" => "usd","source" =>
$_POST['stripeToken'],"description" => $description,
)
);
我多次尝试使用 $charge->card->address_country
从 $charge
变量中获取卡片信息,但没有任何解决方案。非常感谢您的帮助
费用的付款来源在 source
attribute of the charge object 中返回,因此您应该可以这样做:
$card = $charge->source;
// Do something with $card, e.g. access the billing address' country
// with $card->address_country
我在网站上集成了条纹支付方式。我想获取卡片信息。一切正常。付款成功后,我成功地从 $charge->id
变量中检索了付款 ID。所以我的问题是,当我 print_r($charge)
它也显示 Card Object Something like That
Stripe_Card Object ( [_apiKey:protected] => sk_test_...
[_values:protected] => Array ( [id] => card_1BLSPnJ6IzxnlSnmegEq6dbH
[object] => card [address_city] => Lahire [address_country] => Pakistan
我的条纹过程
$customer =Stripe_Customer::create(array(
'email' => $_GET['email'],));
$charge = Stripe_Charge::create(array(
"amount" => $amount_cents,"currency" => "usd","source" =>
$_POST['stripeToken'],"description" => $description,
)
);
我多次尝试使用 $charge->card->address_country
从 $charge
变量中获取卡片信息,但没有任何解决方案。非常感谢您的帮助
费用的付款来源在 source
attribute of the charge object 中返回,因此您应该可以这样做:
$card = $charge->source;
// Do something with $card, e.g. access the billing address' country
// with $card->address_country