#ironbeard_error

1 messages ยท Page 1 of 1 (latest)

shut quartzBOT
#

๐Ÿ‘‹ 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.

lyric locust
#
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)
flat comet
lyric locust
#

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?

flat comet
#

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

lyric locust
#

Can payment_settings args to Subscription.create() be removed if I've set defaults on the Stripe Dashboard?

shut quartzBOT
storm bone
#

๐Ÿ‘‹ 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.

lyric locust
#

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?

storm bone
#

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)

lyric locust
#

oh, good to know. So it'll still save the PM as the default for the subscription even if I remove that

storm bone
lyric locust
#

It does seem to match

#

Great, thanks so much!