#some1ataplace_api

1 messages ยท Page 1 of 1 (latest)

rocky slateBOT
#

๐Ÿ‘‹ 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/1267943043953328138

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

fast grotto
#

Have you built anything yet?

#

Do you already have connect accounts?

pseudo ravine
#

i have stripe connect accounts and i am using the transfer object to transfer funds via stripe checkout

#

But that is it so far, all I really want to know is how to do the coupon/promo piece

fast grotto
#

Sounds like you're doing destination charges then

#

Or separate charges and transfers

#

In that case, you'd need to create coupons on the platform (same as your products/prices)

pseudo ravine
#

separate charges and transfers i believe. This would not be for a subscription though, one time payments.

fast grotto
pseudo ravine
#

i actually have a form being used before stripe checkout for the promo code

fast grotto
#

Why?

pseudo ravine
#

because i have multiple payment apis besides stripe that use it

fast grotto
#

You can do that as well

#

It's covered in the above link I just shared

pseudo ravine
#

okay cool, looks like i am doing that for my other forms already, but how do i allow anyone on the front end to create their own promo codes and specify they want to create for example 20 promo codes for this 1 course they are selling, each promo code works 1 time, gives a 20

#

% off for the order.

rocky slateBOT
pseudo ravine
#

Or maybe say something like 1 promo code, but 20 usages for people all over the world to use it. Gives a 20% discount. Stuff like that

fast grotto
#

Is there a particular reason you're doing separate charges + transfers? What account type did you choose? Generally if you want your account holders to manage things like products, prices, coupons, you'd want direct charges + standard accounts

pseudo ravine
#

express

#

i may not remember, it has been a while and i am coming back to it now

#

but i can tell you my scenarios

#

Affiliate connect account = a connect account shares an affiliate link, they get paid as long as a customer buys something on my site.

course content creator connect account = anyone could create a course on my site (like udemy), and they get paid as long as someone buys their course

#

2 connect accounts in this case

sudden sandal
#

๐Ÿ‘‹ stepping in for my teammate

#

and in both cases, the end customer has a relationship with you (the platform) not the affiliates or course content creators?

#

Do you happen to have your platform's account ID? It should start with acct_

pseudo ravine
#

yes

#

That is an affiliate marketer example. I have yet to setup the course one, but I imagine it would be the same way.

sudden sandal
#

Ah, so all still in test mode, I see

pseudo ravine
#

yes

#

Basically all I want to do is make a form for my course creators to create their own promo codes so that they can do all the marketing themselves and share the promo codes places.

sudden sandal
#

So if you're doing separate charges & transfers, all Products and Prices will belong to your platform account. This means that your form will need to determine which Products and Prices correspond to a given content creator before you can allow that content creator to create a coupon and promo code

#

Is that clear?

pseudo ravine
#

correct

sudden sandal
#

So you can have some form on some admin/manage dashboard in your app where actions taken on that form trigger API requests to create Coupons, create Promo Codes, etc.

pseudo ravine
#

exactly

#

I always get confused though, this would be the coupon object or promo object? Wondering the exact API calls to make here.

sudden sandal
#

A Coupon needs to be created first. Then you can opt to create a customer-facing Promo Code for that Coupon

pseudo ravine
#

And a new coupon would be created each time for every single user? Or can all connect users share 1 coupon? But they each make multiple promo codes?

#

Each connect account has their own courses though, so I would imagine different coupon codes?

sudden sandal
#

Right. Let's say you create a Coupon but have it apply to a specific Product (a Product tied to a specific content creator). Any Promo Codes created for this Coupon would only apply to Prices within this Product.

pseudo ravine
#

okay

#

It has been a while though, not sure if I made this via dashboard or code

sudden sandal
pseudo ravine
#

stripe.Transfer.create(amount=int((converted_amount / 100) * settings.STRIPE_CONNECT_AFFILIATE_PERCENT),currency="usd",destination=affiliate_connected_account,)

sudden sandal
#

In this case, you created an inline Price using price_data but under Product prod_QOyoxotb51dTbo. No promo codes were used here though

pseudo ravine
#

okay cool, thanks for helping me figure that out, since it has been a while i have done this

sudden sandal
#

Sure thing!

pseudo ravine
sudden sandal
pseudo ravine
sudden sandal
#

Right, so you should have a 1:1 relationship between Course Author and Product, then tie Coupons to specific Products

pseudo ravine
#

oh boy, so each author would get their own dedicated product id?

sudden sandal
#

Yes, there's no way around this if you want to limit coupons (and promo codes) to be used for specific courses only

pseudo ravine
#

shoot

#

not even using metadata for a promo code on creation with the author in it? Then I can look it up somehow?

sudden sandal
#

Not sure I follow

pseudo ravine
#

I would prefer not to make so many product ids for each user. I already have 1 product id for people to add courses to the cart to buy them.

#

If you have any other alternatives to a 1:1 mapping of author to product id i would prefer that

sudden sandal
#

Let's take a step back for a bit. Given your charge flow, all Products and Prices live on your platform account. How are you tracking which Products and Prices correspond to which author?

pseudo ravine
#

I did not incorporate that yet. All I have is functionality of buying any course (course order product) and having my website make any necessary course ownership changes in the database

#

yes, all products and prices for the current state live in the platform account

#

what about this?

Every time a user creates a course, I make API calls where each new course has its own product ID.

But then, my checkout code will change because each time the product will change. A user could also buy multiple courses in the cart from more than 1 author.

                    line_items=[{
                        'price_data': {
                            'currency': 'usd',
                            'unit_amount': converted_amount, 
                            'product': settings.STRIPE_COURSE_ORDER_PRODUCT_ID,
                            #'product_data': {
                            #    'name': 'Order'
                            #},
                        },
                        'quantity': 1,
                    }],
sudden sandal
#

I see

#

So, Checkout only allows for a single promo code. Is that okay in this case?

pseudo ravine
#

yes for now, although now I am wondering if I should make multiple form entries for promo codes...

#

I imagine I would have to manipulate the converted_amount price and figure out which courses are being bought

sudden sandal
#

multiple form entries for promo codes
I don't quite follow here

#

If you're using Checkout, Checkout allows a customer to provide a single promo code

pseudo ravine
#

Course A = $5
Course B = $2
Author C owns Course A
Author D owns Course B
Customer puts both Course A and Course B in the cart, and uses customer A's promo code of 50% off.
New price = $2.5+$2 = $4.5

sudden sandal
#

Okay, that should all work fine as long as the Promo Code is tied to a Coupon that applies to Course A

pseudo ravine
#

Right. I would probably use metadata specifying this promo code is for course A.

#

Then I am wondering how I could make an array of promo codes and then have it apply to all the courses in checkout.

sudden sandal
#

I would probably use metadata specifying this promo code is for course A
I don't follow this. When you create the Coupon, you'd specify applies_to.products as the Product ID for course A

#

how I could make an array of promo codes and then have it apply to all the courses in checkout
I don't follow this either

pseudo ravine
#

I think I will go with this, I am going to get going now I think, I will be on mobile.

#

Please feel free to keep resonding, I will try my best to respond

#

ah, my dpaste forms should have promo codes in the array

#

not coupon codes in the array

sudden sandal
pseudo ravine
#

ah, i don't want to not use checkout, i like it a lot

#

luckily these are not recurring payments, only 1 time

#

i was thinking of just manipulating the final checkout amount before getting to checkout

#

I want to thank you by the way in case I walk away from keyboard. Thank you for helping me through this. I am still curious what you have to say though.

sudden sandal
#

I see. I don't think that will work very well unless you're willing to create one-off prices every time. Say you have a discount to apply for two different courses. You'd have to calculate how much to discount per course then create the Checkout Session with the price data inline and add some description so the end customer knows their discounts were applied successfully. You wouldn't be able to have the customer type in promo codes directly within Checkout

pseudo ravine
#

I create 1 off prices I think in my current setup

sudden sandal
#

Right, so you'd have to figure out the final amount (including discounts) prior to creating the Checkout Session

pseudo ravine
#

I think that is what I will do. But you are saying that isn't very efficient or well organized?

sudden sandal
#

You end up losing a lot of the benefits of using Checkout (fields for promo codes, managing Products and Prices and not having to calculate amounts every time)