#maxman101

1 messages · Page 1 of 1 (latest)

craggy lightBOT
timber epoch
#

Hi there!

#

Pasting your other messages here:

seems like that has changes
once used, they stay sticky at the customer
thats a breaking change?

#

I guess it depends what type of coupon you are using.

brisk sedge
#

hey

#

its a once coupon

#

req_exnd0OEMaoLxe7

#
      "id": "juZqVDZL",
      "object": "coupon",
      "amount_off": 5000,
      "created": 1691053690,
      "currency": "eur",
      "dashboard_currency_options": {
        "eur": {
          "amount_off": 5000
        }
      },
      "duration": "once",
      "duration_in_months": null,
      "livemode": false,
      "max_redemptions": null,
      "metadata": {
      },
      "name": "FIXED-50",
      "owning_merchant": "acct_1EQgCWCrrVPAjQHJ",
      "owning_merchant_info": "acct_1EQgCWCrrVPAjQHJ",
      "percent_off": null,
      "redeem_by": null,
      "times_redeemed": 1,
      "valid": true
    },
timber epoch
#

Then once the coupon is used the coupon shoud be removed.

brisk sedge
#

but its not

#

check my test customer

#

did an invoice, but coupon still active on the customer

timber epoch
#

Thanks! Give me a few minutes to look into this.

brisk sedge
#
  "id": "juZqVDZL",
  "object": "coupon",
  "amount_off": 5000,
  "created": 1691053690,
  "currency": "eur",
  "dashboard_currency_options": {
    "eur": {
      "amount_off": 5000
    }
  },
  "duration": "once",
  "duration_in_months": null,```
#

this used to work for me, but now we just noticed this changed behavior

#

any idea whats wrong?

#

we did not change any code on our side

#

hello?

sleek lily
#

Hey! Taking over for my colleague. Let me catch up.

brisk sedge
#

sure

#

so why is my once coupon kinda sticky on the customer

#

even if used on an invoice with amount > 0

sleek lily
#

I'm seeing that this coupon was applied in these invoices in_1NaxWPCrrVPAjQHJCMNNyrpm, in_1NaxXQCrrVPAjQHJMHr8w3sP and in_1NaxYBCrrVPAjQHJepnPto2R (not paid yet)

brisk sedge
#

yes

#

fynn is our test customer

#

especially in_1NaxYBCrrVPAjQHJepnPto2R. wich has 10 € amount due and coupon used

#

but why is the coupon still at the customer?

sleek lily
#

I'm suspecting that the coupon wasn't 100% applied, because the invoice total amout was < the coupon discount...

#

doing some tests...

brisk sedge
#

but this used to work fine for months on our side

sleek lily
#

Double checking something...

brisk sedge
#

ok thanks

#

seems like a change on stripe's side

sleek lily
#

Wait what you wont to achieve here ?

#

You wont the coupon be used only one time by the customer or be used one time for a subscription ?

brisk sedge
#

only one time per customer

#

like: hey customer here you get a one time 50€ off

#

as is said, this used to work for months

#

invoice created, coupon used, coupon not ! on the customer anymore

#

but now it stays sticky

sleek lily
brisk sedge
#

we dont use subscriptions

sleek lily
brisk sedge
#

we only create invoices by ourself

#

well i create a coupon

#

req_BXoST6nXPQqwCI

#
  "id": "juZqVDZL",
  "object": "coupon",
  "amount_off": 5000,
  "created": 1691053690,
  "currency": "eur",
  "dashboard_currency_options": {
    "eur": {
      "amount_off": 5000
    }
  },
  "duration": "once",
  "duration_in_months": null,
  "livemode": false,
  "max_redemptions": null,
  "metadata": {
  },
  "name": "FIXED-50",
  "owning_merchant": "acct_1EQgCWCrrVPAjQHJ",
  "owning_merchant_info": "acct_1EQgCWCrrVPAjQHJ",
  "percent_off": null,
  "redeem_by": null,
  "times_redeemed": 0,
  "valid": true
}
#

then i apply this coupon to the customer

sleek lily
brisk sedge
#

sure

#

now that customer has the 50off once coupon

#

now i create an invoice

#

item amount is 30€

#

coupon is beeing used as seen

#

now i would expect on invoice finalization that the coupon on the customer is gone after usage

#

invoice finalized: in_1NayRXCrrVPAjQHJj3JEHK5R

#

but still the customer has the coupon on his account: cus_ONiv5EzEs4ieme

timber epoch
#

Thanks for the detailed explanation, I'll try to reproduce on my end

sleek lily
brisk sedge
#

no, as this behavior suddenly changed

#

this is how it used to work

#

whats coupon=once then for?

timber epoch
#

I managed to reproduce the issue. Indeed that's odd, looking into this.

#

Do you have a customer ID example where the behavior was different?

brisk sedge
#

hmm interestingly not

#

but could swear it was like this

#

how am i supposed to implement a one time coupon?

#

ah

#

here:

#

live data

#
Nov 9, 2022, 10:18 AM
#

and after that, coupon is gone

craggy lightBOT
mint anvil
#

and after that, coupon is gone
what does that mean, where exactly (which API parameter) are you looking to see that?

note that it's normal for discount to be null on the Subscription if you use a one-time coupon on the first invoice, that's how it works(there is no ongoing discount on the Subscription).

brisk sedge
#

i dont use subscriptions !

#

i only create invoice manually

#

and would like. customer.coupon to be applied once

#

how am i supposed to use the coupon once?

#

that isnt possible anymore?

#

or did that change with a stripe api version change?

mint anvil
#

it's definitely possible

brisk sedge
#

we are looking at some lost money due to this change

#

sales team is not happy

#

what happend?

#

basically coupon->once does not mean ONCE anymore !

mint anvil
#

I'm afraid you're nor making sense. Can you you focus on the technical question?

brisk sedge
#

sure

mint anvil
#

I'm looking at in_1MA6lFCrrVPAjQHJ4DMyl7eA. What is the problem with it, what do you see versus what you expected to see?

brisk sedge
#

in_1MA6lFCrrVPAjQHJ4DMyl7eA is fine

#

coupon applied to customer, invoice created, coupon used, coupon gone on the customer

#

so how to use a once coupon correctly?

#

so its gone after usage

#

that is the behavior i am aiming for

#

lets replicate this on test data

#

has coupon: €50.00 off once

#

now i would expect the coupon to be gone ONCE used for an invoice

#

correct?

mint anvil
#

depends what you mean by "gone".

brisk sedge
#

like used, not valid anymore

#

a one-time discount by 50€

mint anvil
#

to be clear duration:once is a field specifically intended for subscriptions, it just means if you apply it to a customer, the next invoice for that customer is discounted, and not any repeat Invoices after that.

Applying to a one-off invoice works too

brisk sedge
#

okay

#

i am creating one-off invoices

#

app(StripeClient::class)->invoices->create($payload)

#

the coupon is beeing applied

#

but its active for more than one invoice

#

like i can create 20 invoices with 50€ amount, and its always discounted by the coupon

#

for one customer

#

do you see my issue? recurring one-off invoices still get the once coupon applied !

mint anvil
#

AFAIK duration is for Subscriptions, it's tied to the concept of a Subscription , coupons were built for Subscriptions as a product. duration is used to control if repeart Invoices in a subscription get the coupon again or not.
Have you ever seen this act differently?

brisk sedge
#

well then, whats the proper way to add discount to an one-off invoice?

mint anvil
#

I get that it's confusing but I believe it's just a quirk of the API that's always been that way, happy to look if you have an example of it working differently

mint anvil
#

or you can use a negative InvoiceItem instead of a coupon.

brisk sedge
#

and manage the coupon behavior on my side?

#

probably the way to go, as using stripe susbcriptions didnt work for us

#

i like to maintaing 100% behavior on my side

#

but: i could swear the coupon behavior has changed on stripe's side!

#

when i implemented it, like 1-2 years ago it worked like mentioned

mint anvil
#

if you have an example of it working differently we can definitely investigate!

brisk sedge
#

man this is weird

#

but okay

#

then i will implement it myself completely

#

maybe this changed on stripes side?

mint anvil
#

if you have an example of it working differently we can definitely investigate!

#

no one on my team is aware of anything changing and they also tested this scenario just now and saw the same behaviour as you

brisk sedge
#

okay

#

docs/api sometimes are a little weird

#

anyway thanks for investigation