#khushboo
1 messages · Page 1 of 1 (latest)
dashboard
In the dashboard I see this when creating a new coupon:
Yes , I have added from here but it is not working properly, This is working for all products.
Can you share an example where it's not working?
Sure
We have two product membership product and strorage product
and i have created coupon for membership product.
The problem we are facing that we are able to use that coupon for storage product as well , While we have created coupon only membership product.
The problem we are facing that we are able to use that coupon for storage product as well
Can you give me a concrete example? Like a Checkout Session ID or Subscription ID where you used a coupon and it was applied to two products?
Here are the Subscription ID
sub_1MKIjnHmFCUaMUjnfysdLtFD
sub_1MKIj7HmFCUaMUjn4f3Zrpyo
Thanks! Give me a few minutes to look into this.
Sure
If you look at sub_1MKIjnHmFCUaMUjnfysdLtFD, this is the first invoice: https://dashboard.stripe.com/test/invoices/in_1MKIj7HmFCUaMUjnDjEMlysl
And if you check carefully the coupon was not applied:
Yes correct, but I have not recieved the error message and transaction was succesful
There's no error message. Stripe just ignored the promo code you passed since it doesn't apply to the product.
Okay, Thank you for your help!
Is there any way to know which coupon is applicable on that product ?
What do you mean? If you retrieve the coupon with the API, you can see the products it applies to: https://stripe.com/docs/api/coupons/object?lang=curl#coupon_object-applies_to
I mean how do i know how many products are there on this coupon.
I tried this-
$couponCheck = Stripe\Coupon::retrieve($couponCode,['expand' => ['applies_to.products']]);
Stripe\Coupon Object
(
[id] => Discount23
[object] => coupon
[amount_off] =>
[created] => 1672319227
[currency] =>
[duration] => forever
[duration_in_months] =>
[livemode] =>
[max_redemptions] => 100
[metadata] => Stripe\StripeObject Object
(
)
[name] => 100%DiscountCoupon
[percent_off] => 100
[redeem_by] =>
[times_redeemed] => 1
[valid] => 1
)
Can you send me your account ID so I can check in to this coupon?
You mean coupon ID ?
Discount23
Account ID, (acct_123)
Unfortunately I can't look up that coupon by its user facing code
I just want to know is there any way that i can know how many product are applied on this coupons ?
The call that you are making looks like it should work, because it isn't I am wondering if this has something to do with how the coupon is configured
acct_1IdQD8HmFCUaMUjn
I could not find the details of the product in it
In the API or the dashboard?
API
Getting this response -
Stripe\Coupon Object
(
[id] => Discount23
[object] => coupon
[amount_off] =>
[created] => 1672319227
[currency] =>
[duration] => forever
[duration_in_months] =>
[livemode] =>
[max_redemptions] => 100
[metadata] => Stripe\StripeObject Object
(
)
[name] => 100%DiscountCoupon
[percent_off] => 100
[redeem_by] =>
[times_redeemed] => 1
[valid] => 1
)
could not find the details of the product in it
Sorry the server got really busy and I got pulled away from looking in to this one. Checking now
Its okay
Oh I found the issue https://stripe.com/docs/api/coupons/object#coupon_object-applies_to
Contains information about what this coupon applies to. This field is not included by default. To include it in the response, expand the applies_to field.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you try explicitly expanding the applies_to parameter when making this call? https://stripe.com/docs/api/expanding_objects#expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But I am sending expand parameter see
Stripe\Coupon::retrieve('Discount23',['expand' => ['applies_to.products']]);
I hope this isn't the issue but can you try passing 'applies_to' without .products?
Just to see if that returns things and the API is being finnicky?
Yes i did
Stripe\Coupon::retrieve('Discount23',['expand' => ['applies_to']]);
But still getting same response . Where is going wrong please guide us .
Stripe\Coupon Object
(
[id] => Discount23
[object] => coupon
[amount_off] =>
[created] => 1672319227
[currency] =>
[duration] => forever
[duration_in_months] =>
[livemode] =>
[max_redemptions] => 100
[metadata] => Stripe\StripeObject Object
(
)
[name] => 100%DiscountCoupon
[percent_off] => 100
[redeem_by] =>
[times_redeemed] => 1
[valid] => 1
)
I wonder if it is the version of the PHP library you are using though that shouldn't affect this as far as I know. Checking in to that
Ok
Looks like you should be fine there.
Can you try the cURL command and see if this info comes back in the raw response?
-u sk_test_1234: \
-d "expand[]"="applies_to" \