#mfujitapirika

1 messages · Page 1 of 1 (latest)

sick hawkBOT
rotund frigate
#

How did you attach and what error did it return?

burnt ether
#

First call was failed. Payment source is going to be inputed after creating invoice.

subscription = stripe.Subscription.create(
    customer=customer_id,
    items=[{
        'price': price_id,
        "tax_rates": tax_rates
    }],
    payment_behavior='allow_incomplete',
    backdate_start_date=int(backdate_start_date.timestamp()),
    billing_cycle_anchor=int(billing_cycle_anchor.timestamp()),
)
invoice = stripe.Invoice.create(
    customer=customer_id,
    auto_advance=False,
    description="testest",
    subscription=subscription.id
)
stripe.error.InvalidRequestError: Request req_nmTjjIee4E4yTo: This customer has no attached payment source or default payment method. Please consider adding a default payment method. For more information, visit https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority.
rotund frigate
#

Yes I think the error is pretty clear that you can't create an Invoice without a payment method to attempt

#

Is your ultimate purpose is to edit the description?

burnt ether
#

I'll show my customers a receipt. Invoiceitem's description is printed out in that. That's why I'd like to rename description as I like.

rotund frigate
#

And your Subscription's collection_method is charge_automatically correct?

#

There are 2 workarounds:

  1. Create subscription with trial_end set a couple of seconds into the future. The subscription will first generate a $0 invoice, and once the trial is over a non-zero invoice will be created with a one hour draft period.
  2. Create the subscription through a subscription schedule (see our docs for how). When the schedule starts, the subscription’s initial status will be active with an initial draft invoice that is scheduled to finalize in an hour.
#

With 1 hour in draft you maybe able to edit the Invoice Item description!

burnt ether
#

Oh, OK. I got it.

#

I'll try your methods, and ask you if needed. Thanks

#

For your second method, can't the receipt be generated unless finalized?