#default_user_Bq67qllUp5l4mHuk0ao

1 messages · Page 1 of 1 (latest)

dull cloakBOT
mystic olive
#

Hi
if valide=true, the coupon can be applied otherwise no.

neat osprey
#

iof the coupon is no longer active

#

what will be the value valid?

#

my flow of coupon is so :

  1. user type promo code
  2. backend checks if code exist using stripe.promotionCodes.list({ code });
  3. if copun exist - it gets added to customer and gets redeemed
  4. the retrned object from customer.update containes the copun
  5. sending this object back to user where they can see copun name
#

the problem with the flow:
if the copun is at max redeemed - even though its still added to customer
the returned object is valid = false
and we do not return it to customer

#

step number 5 is skipped

#

even though the customer has coupon

#

now, either we can ignore the value of valid

#

or change the flow

#

what do you suggest is the better flow?

mystic olive
neat osprey
#

i understnad - but in what case ?

mystic olive
#

if the copun is at max redeemed - even though its still added to customer
That means the coupon can no longer be used for another customer.

#

I'm not sure I understand the issue here, do you have a coupon example ?

neat osprey
#

yes

#

check req_c9GxrxXm51TJu2

#

the coupon there is on time use,
we added it to customer
the returned answer is the coupon is not valid -- even though for this customer it is beecause its already assigned

#

so for me its hard to know when its not valid because its actually not active or becasue in the future it will not be active

mystic olive
#

the returned answer is the coupon is not valid -- even though for this customer it is beecause its already assigned
yes because it was already used.

mystic olive
neat osprey
#

so in the flow above - i can ignore the valid value given the whole flow workeD?

mystic olive
#

You can ignore it yes, but the coupon isn't valid and won't be applied at the end

neat osprey
#

but the coupon was assigned to the customer already

#

so why it wont be applied?

mystic olive
#

That coupon was used before or this is the first time you assigned to that customer ?

neat osprey
#

first time

#

?

mystic olive
#

so it will be applied for that customer once.

#

If you want, what you can do is to check valid status before attaching the coupon to the customer, if valid attach it otherwise use another coupon. Then ignore the valid status in the response.

neat osprey
#

ok thanks
but nothing will happen between checkong the field to the assignment?

mystic olive
#

Nope, I invite you to can continue your testing scenario.