1
최신 버전 인 Recurly API 2.7을 사용하고 있습니다. 송장 객체에서 쿠폰 세부 정보를 가져 오는 데 문제가 있습니다.Recurly_CouponRedemptionList에서 쿠폰 세부 정보를 얻는 방법
이 결과에서 첫 번째 보너스 상품의 쿠폰 객체를 가져오고 싶습니다.
$i = $ss->invoice->get();
if ($i->redemptions) {
$r = $i->redemptions->get();
print_r($r);
if ($r->count > 0) {
$coupon = $r[0]->coupon->get();
}
}
하지만 $ r [0]은 Recurly_CouponRedemption 개체를 반환하지 않습니다.
Recurly_CouponRedemptionList Object
(
[_position:Recurly_Pager:private] => 0
[_count:protected] => 1
[_objects:protected] => Array
(
[0] => Recurly_CouponRedemption Object
(
[_values:protected] => Array
(
[coupon] => Recurly_Stub Object
(
[objectType] => coupon
[_href:protected] => https://xxx.recurly.com/v2/accounts/test
[_client:protected] => Recurly_Client Object
(
[_apiKey:Recurly_Client:private] =>
[_acceptLanguage:Recurly_Client:private] => en-US
)
[_links:protected] => Array
(
)
)
[account] => Recurly_Stub Object
(
[objectType] => account
[_href:protected] => https://xxx.recurly.com/v2/accounts/test
[_client:protected] => Recurly_Client Object
(
[_apiKey:Recurly_Client:private] =>
[_acceptLanguage:Recurly_Client:private] => en-US
)
[_links:protected] => Array
(
)
)
[uuid] => 0b00000000000000000000000
[single_use] =>
[total_discounted_in_cents] => 500
[currency] => USD
[state] => active
[coupon_code] => 5off
[created_at] => DateTime Object
(
[date] => 2017-01-11 16:30:09
[timezone_type] => 2
[timezone] => Z
)
[updated_at] => DateTime Object
(
[date] => 2017-01-11 16:30:09
[timezone_type] => 2
[timezone] => Z
)
)
[_unsavedKeys:protected] => Array
(
)
[_errors:protected] => Recurly_ErrorList Object
(
[transaction] =>
[transaction_error] =>
[errors:Recurly_ErrorList:private] => Array
(
)
)
[_href:protected] =>
[_client:protected] => Recurly_Client Object
(
[_apiKey:Recurly_Client:private] =>
[_acceptLanguage:Recurly_Client:private] => en-US
)
[_links:protected] => Array
(
)
)
)
[_href:protected] => test
[_client:protected] => Recurly_Client Object
(
[_apiKey:Recurly_Client:private] =>
[_acceptLanguage:Recurly_Client:private] => en-US
)
[_links:protected] => Array
(
)
)
감사합니다.