#frallain_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/1318887702497591307
๐ 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.
- frallain_api, 5 days ago, 9 messages
- frallain_api, 5 days ago, 85 messages
Any idea? Could it be related to the Stripe API version used?
(the second request is on our Production account)
In both envs, we've set the API to use 2024-04-10
Oh, but in fact it's set for the API, not the dashboard..
nevermind, we have the same behavior in our backend code with the API, so there is something strange still
Yes that should be a different API version used.
can you tell me the behavior of the v2024-04-10 of the API?
I'm not sure I understand what you are looking for exactly ?
If you are looking for the changelog of each API version, you can refer to this guide:
https://docs.stripe.com/changelog
Both envs use the same API version (2024-04-10) but give different output
Are you looking at API calls that the Dashboard makes?
No, I am looking at the calls made by our SDK to the API, but I can confirm that the dashboard behaves the same
Why is the URL https://dashboard.stripe.com...?
OK let met get the exact request IDs
In fact there is no logs for successful GET calls...
You should change the filters in the list of logs
OK this is https://dashboard.stripe.com/logs/req_lXvJGS5vmdGjCx that I am calling this way
upcoming_invoice = stripe_client.get_upcoming_invoice(
customer_stripe_id,
expand=[
# payment methods
"customer.invoice_settings.default_payment_method", # Stripe PaymentMethod API
"customer.default_source", # deprecated Stripe Source API
# coupons
"customer.discount.coupon.applies_to",
"discounts.coupon.applies_to",
"subscription.discounts.coupon.applies_to",
# schedule
"subscription.schedule",
],
)
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
And what about the other request?
Trying to find it
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
called the same way
Do you have the Response body in the logs for GET on your side?
because on my side I get a "We do not save the response body for successful GET requests."
No, but I will look at other attributes
from our logs, it does a GET https://api.stripe.com/v1/invoices/upcoming with
customer=cus_NGXwuNvFgaJDur&expand%5B0%5D=customer.invoice_settings.default_payment_method&expand%5B1%5D=customer.default_source&expand%5B2%5D=customer.discount.coupon.applies_to&expand%5B3%5D=discounts.coupon.applies_to&expand%5B4%5D=subscription.discounts.coupon.applies_to&expand%5B5%5D=subscription.schedule,
Okay, I can see the default_source properties of different types, which is why they have a different structure:
cus_NGXwuNvFgaJDurhasdefault_source=src_1Mcc7jI9qXomtXqSTSy54Xmqwhich is a Source object.cus_RQBCnW8cRtx7xmhasdefault_source=card_1QXKpcH2GG3UYmlxSjYbeulMwhich is a Card object.
Sources is a deprecated concept, and this wouldn't be the issue with PaymentMethods. I suggest you to migrate to PaymentMethods as soon as possible.
Alright I see, thank you very much!
Happy to help.
last question, in tests
to setup a merchant with a source, this is the code I use:
stripe_customer = stripe.Customer.create(
email="legacy_credit_card_customer@test.fixture",
source="tok_visa",
coupon=customer_coupon_id,
metadata=metadata,
**additional_kwargs,
)
but, as we found out, this create a source of type Card
How to create a source of type Source?
Please don't use Sources. I don't think it's possible.
You can achieve the same by using payment_methods:
payment_method: 'pm_card_visa`
invoice_settings: {
default_payment_method: 'pm_card_visa'
}
Yes but it's for testing purpose : we have many customers on sources, we need to support them.
Don't worry, we do not create sources anymore but payment methods
๐ taking over for my colleague. Let me catch up.
OK I could make it work and reproduce the original bug with
stripe_customer = stripe.Customer.create(
email="legacy_credit_card_customer@test.fixture",
coupon=customer_coupon_id,
metadata=metadata,
**additional_kwargs,
)
source = stripe.Source.create(
type=StripePaymentMethodType.CARD,
currency="usd",
owner={"email": "card_source@test.fixture"},
token="tok_visa",
)
stripe.Customer.create_source(stripe_customer["id"], source=source["id"])
sources for non-card payment method is deprecated and it's no longer possible to create these
Yeah, I don't know if it's possible to create anything except what tok_visa does.
Interestingly, the customer fixture was previously written this way
stripe_customer = stripe.Customer.create(
email="legacy_credit_card_customer@test.fixture",
source="tok_visa",
coupon=customer_coupon_id,
metadata=metadata,
**additional_kwargs,
)
which was creating a Card object as the default source