#ironbeard_error
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/1464291456431948020
๐ 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.
- ironbeard_subscription-update-pmt, 18 hours ago, 79 messages
- ironbeard_confirmation-token-flow, 2 days ago, 53 messages
def checkout(self) -> None:
if self.token:
# Set up to charge card automatically
data = {
'collection_method': 'charge_automatically',
'payment_behavior': 'default_incomplete',
# off_session=? # TODO
'payment_settings': {
'save_default_payment_method': 'on_subscription',
#'payment_method_types': ['card'],
},
'expand': ['latest_invoice.payment_intent'],
}
else:
# Set up for bank transfer, allow card too
data = {
'collection_method': 'send_invoice',
'days_until_due': 30,
'payment_settings': {
'payment_method_types': ['card', 'customer_balance'],
'payment_method_options': {
'customer_balance': {
'funding_type': 'bank_transfer',
'bank_transfer': {'type': 'us_bank_transfer'}
},
},
},
}
subscription = stripe.Subscription.create(
customer=self.customer.id,
items=[{
'price': price.id,
'quantity': 1,
} for price in self.prices.all()],
discounts=[{
'promotion_code': self.promotion_code.id
}] if self.promotion_code else [],
)
if pi := subscription.latest_invoice.payment_intent:
pi = stripe.PaymentIntent.confirm(
pi.id,
confirmation_token=self.token.id,
)
if pi.next_action:
raise NotImplementedError
else:
stripe.Invoice.send_invoice(subscription.latest_invoice.id)
That error is happening because by default the subscription will try to charge the customer's default PM. To avoid that error, you can pass payment_behavior='default_incomplete' which tells us to not attempt the payment right away and just default the subscription's status to incomplete
https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_behavior
but.. I think I am passing that?
trying to find req_5VB52ZZK9Ba2km in the dashboard
oh ๐ I didn't unpack the data dict the .create() call
If I'm confirming the payment intent on the server, should I specify off_session=True?
off_session is to indicate whether the customer directly initiated the payment or not. So if they clicked the buy button and you are confirming this intent from that click, it would still be considered on session
Off session is for times when the user is off your site and some automatic action triggers a payment. I think it is mainly for networks to know whether the customer could respond to 3DS and such if prompted
Can payment_settings args to Subscription.create() be removed if I've set defaults on the Stripe Dashboard?
๐ Taking over for Pompey as they need to head out ๐ Just getting caught up on the thread.
payment_settings.payment_method_types would be used if you want to override/replace your dashboard defaults. When used only those payment methods explictly passed here will be used.
payment_settings.payment_method_options will let you further customize behavior for specific payment method types if they get used. Some of these options aren't always available in the Dashboard.
In the branch where the customer doesn't have a ConfirmationToken (bc they opted to pay with bank transfer and skipped the PaymentElement), after I call stripe.Invoice.send_invoice(), can I call
fi = stripe.Customer.create_funding_instructions(
self.customer.id,
funding_type='bank_transfer',
bank_transfer={'type': 'us_bank_transfer'},
currency='usd',
)
If I want to be able to show the customer the virtual bank details for their transfer on my "Confirmation" page? I noticed that when I see the bank details on a stripe hosted invoice they include a "Reference Number", which I don't see in my fi object created above. Is this tied to a payment intent?
payment_settings.save_default_payment_method will replace the customers level default payment method if the payment succeeds. (otherwise the used PM will be applied as the default at the subscription level but not the customer level)
oh, good to know. So it'll still save the PM as the default for the subscription even if I remove that
Are you referring to https://docs.stripe.com/api/invoices/object#invoice_object-number ?