#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/1314081431810609202
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- some1ataplace_api, 1 day ago, 49 messages
- some1ataplace_api, 1 day ago, 35 messages
- some1ataplace_api, 6 days ago, 36 messages
Use case 1: Membership subscription payments.
This is a recurring monthly or yearly payment.
The prices rarely change.
Affiliate marketing connect IDs get rewarded for a portion of the sale.
Use case 2: Donation one time and subscription payments.
This can either be a recurring or one time payment that goes directly to my platform.
Prices get passed into a form by the user and can be any random amounts.
Different customers can donate the same or different amounts.
I have a custom form where the user selects their subscription interval and they can type in their custom subscription amount or one time amount.
Use case 3: Author Tip one time and subscription payments.
This can either be a recurring or one time payment that goes to a stripe author connect id and my platform gets a fee.
Prices get passed into a form by the user and can be any random amounts.
Different customers can tip the same or different amounts.
I have a custom form where the user selects their subscription interval and they can type in their custom subscription amount or one time amount.
Use case 4: Cart payments
A user could buy one or more items forever in their shopping cart.
This is a one time payment only.
Prices are all random depending on how much the sum of the cart items are.
Affiliate marketing connect IDs or Author connect IDs get rewarded for a portion of the sale
Code: https://dpaste.org/cHdoX
Please check and see if I am on the right track.
For the product IDs, I am not sure where I would use "Customer Chooses Price", having a product ID with no prices, having a product ID with prices.
Hi @ripe apex thanks for waiting
Ok, so basically your use cases are either subscrpitions or one-time payments. And yes Stripe can support both. However, we don't have built-in solution for Affiliation and rewards, this is something that you need to build by yourself.
Yes, I built all of it by myself, I just want to make sure I am setting up the checkout sessions and product ids and price ids the correct way
there is more than one way to code things too, if you have recommendations I would love to hear them too
Using checkout is the quickest way to build a subscription integration. You can get started from https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=stripe-hosted
Yes, I built the code already, I mainly am looking for a code review from you and any best practices. Did you look at the dpaste link?
I noticed that you divide the value by 100
"application_fee_amount": int(converted_amount * settings.STRIPE_CONNECT_TIP_PERCENT/100),
The application_fee_amount should be in the currency's smallest unit (e.g., cent). For example, if you want to charge $1.00, you should set 100
This is my converted_amount:
converted_amount = int(round(amount,2) * 100)
That is the value the user types into the form
"STRIPE_CONNECT_TIP_PERCENT":"50",
Or 50% in this case
๐ Taking over this thread, catching up now
sounds good
The more programmer feedback the merrier, I really want to get these codes right with the scenarios and the product ids and prices.
The code looks fine to me from the integration perspective. I'd recommend testing all the Checkout Session integration and ensuring that they meet your business requirements
The codes all work, but then I am confused as to how to set this up:
As you can see, I gotta be doing something wrong here.
The reason why Donation has 206 is because I was creating a price ID and passing it to the checkout session.
Then I stopped doing that, that is yet another way to code things...
If you want to investigate: https://dashboard.stripe.com/test/products/d/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.
What is the problem you're facing? Could you share the actual and expected behaviors?
It'll be helpful to share the Checkout Session ID (cs_xxx) along with your explanation, so that I can understand the problem better
I would think Course Membership needs 2 Price IDs: Yearly and Monthly. Then if inflation/deflation occurs, I would create different price IDs.
For donation and author tips since they are similar, I guess I would do what Author Tip does. I made some transactions with that, and all the prices get created behind the scenes but they do not populate on this page. I guess that is a good thing? Not sure what happens with duplication? Each of the prices are random here.
For course orders / cart orders the prices are random based on the cart item sums.
I mainly need to figure out what the best way is to setup this product catalog and then have it translated via code the correct way.
I think I got it figured out correctly with the dpaste code the way it is now. But when creating a product with that purple button what the heck do I do to configure it correctly?
Here are some donations:
https://dashboard.stripe.com/test/payments/pi_3QS4l8IeTJrsS1re2YPt6U0r
https://dashboard.stripe.com/test/prices/price_1QS4lyIeTJrsS1re3Jge706z
https://dashboard.stripe.com/test/payments/pi_3QRzeCIeTJrsS1re0TcaCawW
Here is an author tip:
https://dashboard.stripe.com/test/subscriptions/sub_1QS00YIeTJrsS1reJ0O2wFM9
https://dashboard.stripe.com/test/prices/price_1QS004IeTJrsS1reZCG9iI6X
I would think Course Membership needs 2 Price IDs: Yearly and Monthly. Then if inflation/deflation occurs, I would create different price IDs.
In such a case, you will create new prices and update them in the existing subscriptions
For donation and author tips since they are similar, I guess I would do what Author Tip does. I made some transactions with that, and all the prices get created behind the scenes but they do not populate on this page. I guess that is a good thing? Not sure what happens with duplication? Each of the prices are random here.
You can use subscription update with the ad-hoc price usingprice_dataproperty: https://docs.stripe.com/api/subscriptions/update#update_subscription-items-price_data
Stripe doesn't create a permanent price for ad-hoc price creating through price_data property, so there won't be any duplicates on the prices if price_data is used.
I mainly need to figure out what the best way is to setup this product catalog and then have it translated via code the correct way.
Product is just a wrapper for the product information. The actual charge amount is based on the prices configured inside the product. You can either create a permanent price in the product or use ad-hoc price withprice_dataproperty.
"Customer chooses" price can be used for initial Checkout Session creation whereas you can use price_data property for future price update if necessary
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Here is a course order from the cart one time:
https://dashboard.stripe.com/test/prices/price_1PYAqXIeTJrsS1re4MmThv5M
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Okay, we are good on Course Memberships.
Hi I m using stripe for payment gateway in my app.
I use customer.subscription.updated webhook events.
when I get this event, I use api for getting active subscription.
this api give me more than one subscription.
I checked this in stripe console and one of this result is incomplete or expired.
how can find active subscription from fetched list in my server.
I used this logic:
Subscription.list(SubscriptionListParams.builder().setCustomer(customerId).build());
@lofty maple looks like you're in the wrong place, this thread is for someone else's question.
- If you have your own thread please chat there.
- If you have a question or a followup to a closed thread use one of the buttons in https://discord.com/channels/841573134531821608/842637025524842496 to get help (we don't reopen closed threads).
Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.
hmm, I did not think of doing a subscription update against author tip or donations. Maybe I will do that
So the product catalog price ids don't really matter? Like those 206 donation ones?
A Checkout Session will always create a new subscription. You shouldn't use the Checkout Session to manage an existing Subscription. Update Subscription API should be used instead
So "Customer chooses" price can be used for donations, author tips, and course orders/cart?
gotcha
So in that case, I should always see the number of price ids in the catalog never incrementing like they do with donations previously did?
I imagined Customer Chooses meant "the prices always change" and are never fixed.
But then Author Tip is not using that, but I am still successful with the transactions.
"Customer chooses" should be used when you allow the customer to enter the amount he/she prefers, i.e. you don't know the amount before hand. For the amount that you know what to charge, you can either create a permanent price or ad-hoc price using price_data
Okay are you thinking that the customer should type in their price inside the checkout session? Because I am having them type in the amounts before the checkout session gets created.
But cart orders do not get typed in beforehand by the user, they get summed up by my system
I will never know the amount beforehand though for cart stuff. It is always random like you are ordering stuff on Amazon
are you thinking that the customer should type in their price inside the checkout session?
Not really. "Customer chooses" is the behaviour of allowing the customer to enter the amount on his/her own in the Checkout Session. If you let the customer enters in your website before creating a Checkout Session, you shouldn't create a price with "Customer chooses"
Or can I get away with https://docs.stripe.com/api/products/create and never touch the product again for all 3 of those product ids? Cart, Donation, Tip.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
just the default create api call, nothing fancy
So since I never allow users to type any amounts inside or on the stripe checkout page, I should never use Customer Chooses?
So since I never allow users to type any amounts inside or on the stripe checkout page, I should never use Customer Chooses?
That's right!
Or can I get away with https://docs.stripe.com/api/products/create and never touch the product again for all 3 of those product ids? Cart, Donation, Tip.
If you use Checkout Session to create ad-hocprice_dataandproduct_data, it's not necessary to create a permanent product: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_data
Product will be needed when updating a subscription since Subscription Update API only supports ad-hoc price, price_data, but not ad-hoc product, product_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay good, that helps. Wow, I figured I would make a product ID to be able to better categorize things for reporting purposes maybe.
Should I still create a product IDs then? Because donation and author tips do involve subscriptions too.
Creating product ID isn't a big lift and you can trace which the price belongs to for easier management
cool, i will make one for all of them then lol.
https://docs.stripe.com/api/prices/create Would you say I should never do this? Create a price id just like this shows and pass the Price ID into the checkout session? Just use the checkout session price_data instead?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
https://docs.stripe.com/api/prices/create Would you say I should never do this? Create a price id just like this shows and never pass the Price ID into the checkout session? Just use the checkout session price_data instead?
This will be up to your business decisions. If your price is dynamic for each customer, i.e. each customer has a different charge amount, then I'd recommend usingprice_data. If the price is the same for all customers, then I'd recommend creating a permanent price using Create Prices API
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay perfect. Thank you so much. I have been so confused for days on this and I was asking not just you and other stripe folks too. Finally I can rest easy.
You were the one who finally helped me
No problem! Happy to help ๐
Until next time haha. There is another product I am thinking of making, but stay tuned. I have to do more research first. But after that is done, I will be done with this monster.