#mbillah21-coupon

1 messages ยท Page 1 of 1 (latest)

pale yoke
#

Hello ๐Ÿ‘‹
Not sure I understand the question
Can you provide an example?

dapper pendant
#

Yes, of course

#

I have created one coupon using php api

#

and added two products as "Applicable Products"

#

and it is showing okay on dashboard but not when I tried to retrieve them

#

as you can see, there are two products under "Applicable Products"

#

so the problem is $stripe->coupons->all(); this code not returning those two products

pale yoke
#

Ah okay!
Let me take a quick look

dapper pendant
#

Thank you

pale yoke
#

In PHP it should look something like $stripe->coupons->all([], [ 'expand' => ['data.applies_to'] ]);

dapper pendant
#

creating coupon with products apply is not the problem

#

the problem is to retrieve them

pale yoke
#

Yup I understand.

#

I'm suggesting that you'd need to expand the property while retrieving the coupons

dapper pendant
#

Got unexpected keys in options array: expand

pale yoke
#

try this
$stripe->coupons->all([ 'expand' => ['data.applies_to'] ]);

dapper pendant
#

thank you very much ")

#

it worked ๐Ÿ™‚

pale yoke
#

Great! ๐Ÿ™‚

dapper pendant
#

Would you please help me again to update coupon with all data like duration, max_redemptions, duration_in_months, percent_off, applies_to?

limber crypt
#

Hello! Not sure what you mean, can you provide more details?

dapper pendant
#

I want to update duration, max_redemptions, duration_in_months, percent_off, applies_to these data

#

on coupon

limber crypt
#

Okay, what have you tried so far?

dapper pendant
#

$coupon = $stripe->coupons->update(
'tmCe2fEb',
'name' => '20%',
'duration' => 'repeating',
'max_redemptions' => 1,
'duration_in_months' => 1,
'percent_off' => 20,
'applies_to' => array(
'products' => array(
'prod_LMzhBVqZM4CyQQ',
'prod_LN0CphtkTdmbya',
'prod_LN0OcfLHdK7LAk',
)

    )

);

#

this is what I tried but got an error Received unknown parameters: duration, max_redemptions, duration_in_months, percent_off

limber crypt
dapper pendant
#

Oh Okay