#tymm
1 messages · Page 1 of 1 (latest)
Yep promotion code is mean to share with your customer, and they apply it when checkout on your website
And many customer can use the same promotion code
where should i put this code the customer typed when i call the upcoming invoice api?
It's not compatible with Invoice unfortunately. Only coupon and discount can
ok thanks
hi, i applied a coupon that was not meant for a product. however the upcoming invoice api is not throwing error, how do u suggest i handle this? i am expecting error from the api
Um if you use test clock to advance do you see the error you expected?
what do u mean
just tried calling the upcoming invoice api after advancing time , still same
So if you use a Test Clock to test the Subcription, in the Upcoming Invoice API you expect an error because the coupon is not meant for that product, right. There is one way to validate, that if you advance the test clock to make the Upcoming Invoice really happen, you can see if it errored
I mean advance over the timing the Invoice will be generated
to see the real invoice
that would be too late and awkward in the flow. i want to show the user some error and stop them from proceeding to finalizing the invoice.
I know, I mean we are just testing.
Okie so there maybe misunderstanding about coupon and product
which coupon and how are you calling the Upcoming Invoice?
InvoiceUpcomingParams.Builder paramsBuilder = InvoiceUpcomingParams.builder()
.setCustomer(customer.getId())
.setSubscription(existingSub.getId())
.setSubscriptionProrationBehavior(InvoiceUpcomingParams.SubscriptionProrationBehavior.ALWAYS_INVOICE)
.addSubscriptionItem(
InvoiceUpcomingParams.SubscriptionItem.builder()
.setId(existingSiId)
.setPrice(priceId)
.build())
.setSubscriptionProrationDate(nowEpoch)
.setCoupon(couponCode == null ? "" : couponCode);
return Invoice.upcoming(paramsBuilder.build());
coupon id = IMCRAZY
the final amount that the customer has to pay is not wrong, if it applied it would be half price. but the inconsistent behavior between applying an invalid coupon and a coupon that is not meant for a product is giving me trouble handling these cases elegantly
upcoming invoice should be this : req_ODOs8weetIJpBc or req_yuZBwXZqrYGdge
subscription : req_TJOaTuK3ThrTls
req_ODOs8weetIJpBc or req_yuZBwXZqrYGdge is the request to get an Invoice. I meant the Upcoming Invoice API request
Um only applied to a Products mean if there is a price of that product it will apply, otherwise it won't take any effect, but won't error at all