#smartbettormicah-developer_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/1364429050529054741
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
I can quickly review some decline. Please provide an example PaymentIntent Id pi_xxx
pi_3RFK5dG1sU52JuJt1v6rA0dA
It said incomplete and failed until I manually pressed the charge customer btuton
It was failed before but succeeded today, correct?
Yes
Previously it was "The customer has insufficient funds with the payment provider. Retry attempts might succeed after the customer takes action to resolve the issue with their account"
So this is the customer issue, not your integration issue
pi_3RGNqtG1sU52JuJt1zBSryOf
What about this one. It seemed like it wasn't able to charge because it said that "The customer has not attempted to pay this yet"
I am wondering if it is because we dont request to save default payment method
I see it succeeded now because I manually pressed charge customer
I guess that is the same issue, but this is a team member of ours and they did not change anything in their link. It got to the end of the trial and it just didn't charge the card
Do you think this is because we dont request to save the payment method as default payment method
I see. So either the Subscription needs to have the payment method in its default_payment_method, or the Customer needs to have it in their invoice_settings.default_payment_method
to be able to auto-charge
Quickly checking how you created the Subscription, one sec
Alright, when you create the Sub, can you specify this save_default_payment_method?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or, you can directly set the PM to the customer instead
subscription = stripe.Subscription.create(
customer=customer.id,
items=[{"price": price_id}],
trial_period_days=7,
discounts=(
[{"promotion_code": promotion_code["id"]}]
if promotion_code
else []
),
)
So how would I change this
Let's set the Customer's invoice_settings.default_payment_method instead, to the PM you collected
more explicit
What do you mean
pi_3RDN08G1sU52JuJt1FVwYLAZ
I see what you are saying where it needs to be the default method to auto charge. But that does not explain why this one is still failing
And Also What do you suggest I do in the code for your previous suggestion
I would suggest calling the Update Customer API
If you don’t have the PM on either places, it won’t automatically charge
either places = customer’s default payment method or subscription’s default payment method
Define your customer ID and payment method ID
customer_id = "cus_ABC123"
payment_method_id = "pm_1234567890"
Step 1: Attach the payment method to the customer
stripe.PaymentMethod.attach(
payment_method_id,
customer=customer_id,
)
Step 2: Set the default payment method for invoices
stripe.Customer.modify(
customer_id,
invoice_settings={
"default_payment_method": payment_method_id,
},
)
Something like this?
I think I would prefer to do it simpler
Yep, but you can omit Step 1 if it is already attached
Which is usually the case if you collected the PM with a customer Id
I am pretty sure I did. So just make the payment_method_id the default
yep
pi_3RDN08G1sU52JuJt1FVwYLAZ
That does not explain why this one is still failing. Super strange, seems the same but still cannot succeed
This is the decline: https://dashboard.stripe.com/logs/req_tyf2TgwVGDEcDw
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
code: "payment_intent_payment_attempt_failed",
decline_code: "generic_decline",
This is a generic decline, which is the customer issue again, not yours
Okay thank you for all of your help. Is there anywhere I can find documentation on adding the paymentn method to the customer. I want to make sure my syntax is right. Or can I quickly send it to you
This should help: https://docs.stripe.com/payments/checkout/subscriptions/update-payment-details#customer-default (not exactly talking about your usecase, but the syntax is there)
Thanks so much!