#_api

1 messages ยท Page 1 of 1 (latest)

blazing charmBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1300907875077722142

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

full verge
#

This is a feeble attempt

#

our existing process :

pallid wind
#

I don't think you can add negative amount line items in a checkout session ๐Ÿค”

#

Let me see if there's a workaround

full verge
#

thank you. so far, we have this whole process without importing all our product to stripe. we set up the cart on the fly per transaction.

#

We have implemented most of this :

#

just coupons and gift certificates now. which really, just need a place to apply and show the discounted amount, with a reference to the code used sent back to us

pallid wind
#

Gotcha. Unfortunately, there's no workaround to pass negative items to the checkout session.

The only way to provide discounts using Checkout Sessions is to use promo codes/coupons created on Stripe

full verge
#

is there a beta feature or something ? i was looking at this thing

#

not sure if it would apply

pallid wind
full verge
#

hmm. so like a pre-created coupon of fixed amount ?

pallid wind
#

correct

full verge
#

that could work. is there a way to ensure they can only be applied via the api ?

#

(eg, don't want a bunch of coupons created, then someone come along and use one)

pallid wind
full verge
#

This is the hashing I am using for creating a line item (roughly, this shows an attempt for coupon code entry at 0$)

        // create a line item for stripe checkout
        formParams["line_items[#itemIndex#][price_data][currency]"] = "usd";
        formParams["line_items[#itemIndex#][price_data][product_data][name]"] = "COUPON: #discountCode#";
        formParams["line_items[#itemIndex#][price_data][unit_amount]"] = 0;
        formParams["line_items[#itemIndex#][quantity]"] = 1;
pallid wind
full verge
#

we have to do everything manually since coldfusion is not really supported.

full verge
pallid wind
#

One option would be to delete the coupon if the cart is abandoned

full verge
#

that specific customer doesn't exist in your system yet

#

ok, if the coupon can not be applied by typing a code in stripe, then it should be fine.

pallid wind
#

๐Ÿ‘

full verge
#

could you provide an example like this on how I would set a stripe coupon to our cart -- not on an item

        // create a line item for stripe checkout
        line_items[0][price_data][currency] = "usd";
        line_items[0][price_data][product_data][name] = "COUPON: #discountCode#";
        line_items[0][price_data][unit_amount] = 0;
        line_items[0][quantity] = 1;
pallid wind
#

My test request was in stripe-node with following body:

options = ({
    line_items: [
        {
          price_data: {
            unit_amount: 10000,
            currency: 'usd',
            product_data: {
              name: 'test'
            },
          },
          quantity: 1
        }
    ],
    discounts: [
      {
        coupon: 'me9ftfRt'
      }
    ],
  success_url: url,
  mode: 'payment'
})
full verge
#

so it's a separate thing

pallid wind
#

so discounts would look like

  discounts[0][coupon]="xxxx"
full verge
#

^ ya. thank you

full verge
#

thank you so much ๐Ÿ™‚

pallid wind
full verge
#

last question, a bit unrelated.

pallid wind
#

Sure

full verge
#

would you happen to know a rough eta on when google pay/apple pay/link/etc one-click checkouts will be enabled for the beta feature for custom shipping

pallid wind
full verge
#

fair. i have already attempted to reach out to the team via support chat & ticket.

#

thank you so much again.