#some1ataplace_api
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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
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)
separate charges and transfers i believe. This would not be for a subscription though, one time payments.
i actually have a form being used before stripe checkout for the promo code
Why?
because i have multiple payment apis besides stripe that use it
You can do that as well
It's covered in the above link I just shared
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.
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
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
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
๐ 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_
yes
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
That is an affiliate marketer example. I have yet to setup the course one, but I imagine it would be the same way.
Ah, so all still in test mode, I see
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.
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?
correct
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.
exactly
I always get confused though, this would be the coupon object or promo object? Wondering the exact API calls to make here.
A Coupon needs to be created first. Then you can opt to create a customer-facing Promo Code for that Coupon
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?
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.
okay
But what is interesting though, I am using 1 time payments for these courses, I don't think think they are tied to any product or price id's
Example:
https://dashboard.stripe.com/test/payments/pi_3PYYeDIeTJrsS1re162ENpqb
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
oh wait, it looks like i do have a course order product
https://dashboard.stripe.com/test/products/prod_QOyoxotb51dTbo
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It has been a while though, not sure if I made this via dashboard or code
Ah interesting. You're not using Separate Charges & Transfers here: https://dashboard.stripe.com/test/logs/req_uXQINEJkeaAT0i
You're using destination charges
stripe.Transfer.create(amount=int((converted_amount / 100) * settings.STRIPE_CONNECT_AFFILIATE_PERCENT),currency="usd",destination=affiliate_connected_account,)
In this case, you created an inline Price using price_data but under Product prod_QOyoxotb51dTbo. No promo codes were used here though
okay cool, thanks for helping me figure that out, since it has been a while i have done this
Sure thing!
So basically, I create via the API something like this:
https://dashboard.stripe.com/test/coupons/CoL1bA5a
and then create a promo code for that coupon id. So how do I tie it to the specific course author's course?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You'd do so when creating the Coupon: https://docs.stripe.com/api/coupons/create#create_coupon-applies_to
okay so to any course order product https://dashboard.stripe.com/test/products/prod_QOyoxotb51dTbo
But I don't want customers using Course Author A's promo code on Course Author B's courses.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Right, so you should have a 1:1 relationship between Course Author and Product, then tie Coupons to specific Products
oh boy, so each author would get their own dedicated product id?
Yes, there's no way around this if you want to limit coupons (and promo codes) to be used for specific courses only
shoot
not even using metadata for a promo code on creation with the author in it? Then I can look it up somehow?
Not sure I follow
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
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?
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,
}],
I see
So, Checkout only allows for a single promo code. Is that okay in this case?
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
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
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
Okay, that should all work fine as long as the Promo Code is tied to a Coupon that applies to Course A
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.
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 specifyapplies_to.productsas 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
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
If you want to add multiple coupons/discounts, you can't use Checkout. You'll need to integrate directly with PaymentIntents and calculate the total amount yourself or directly with Subscriptions (if you're working with recurring payments) and use stackable discounts: https://docs.stripe.com/billing/subscriptions/coupons?dashboard-or-api=api#stackable-coupons
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.
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
I create 1 off prices I think in my current setup
Right, so you'd have to figure out the final amount (including discounts) prior to creating the Checkout Session
I think that is what I will do. But you are saying that isn't very efficient or well organized?
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)