#textualmold9830
1 messages · Page 1 of 1 (latest)
Here is how I create them:
CouponCreateParams couponCreateParams = new CouponCreateParams.Builder().setDuration(CouponCreateParams.Duration.ONCE).setCurrency("ron").setPercentOff(BigDecimal.valueOf(10.0)).setMaxRedemptions(1L).build();
Coupon coupon = Coupon.create(couponCreateParams);
coupon.setDuration("once");
coupon.setCurrency("ron");
coupon.setDurationInMonths(1L);
coupon.setPercentOff(BigDecimal.valueOf(10.0));
coupon.setMaxRedemptions(1L);
PromotionCodeCreateParams codeCreateParams = PromotionCodeCreateParams.builder().setCoupon(coupon.getId()).setMaxRedemptions(1L).setActive(true).build();
PromotionCode code = PromotionCode.create(codeCreateParams);
System.out.println(sessionWithLineItems.getCustomerDetails().getEmail());
System.out.println(coupon.getId());
System.out.println(code.getId());```
hello! can you share the coupon / promo code and a Checkout Session id?
coupon: yl3seGig
coupon ID: zW0JHomU
promocode ID: promo_1NauLpJFxOphmeluh1n28TSf
session id:
cs_test_b1EgGIFaiHpduZeOrPNgIKiTQ1kguJrRgVrW4vXpen7NZRN4zcSCbMC6za
can i get a Checkout Session that isn't expired?
How do I get such thing?
create a new Checkout Session
Like this?
Session session = new Session();
how did you create the session id initially?
you just need to go through that flow again
I didn't create the ID.
Go to the checkout link?
Thanks!
hrm, gimme a while to get back to you
it's in the promo object
https://stripe.com/docs/api/promotion_codes/retrieve, it's in https://stripe.com/docs/api/promotion_codes/object#promotion_code_object-code
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Got it. Thanks!