#impactfx(REAL)

1 messages · Page 1 of 1 (latest)

modern flareBOT
surreal wren
#

the code we are using looks like this

        customer=customer.id,
        items=[
            {
                "price": subscription.stripe_price_id,
                "quantity": 2 if is_couple == True else 1,
                "metadata":{
                    "omegawave-subscription-type":subscription.slug,
                    "is_couple":is_couple
                },
            }
        ],
        coupon = couponId,
        metadata = subscriptionMetaData,
        payment_behavior='default_incomplete',
        payment_settings={
            'save_default_payment_method': 'on_subscription',
        },
        automatic_tax={
            'enabled':True
        },
        expand=['latest_invoice.payment_intent'],
    )```
#

we then pass this data back to the frontend

            'customer_id':customer.id,
            'subscription_id': customer_subscription.id,
            'payment_intent':customer_subscription.latest_invoice.payment_intent,
            'client_secret': customer_subscription.latest_invoice.payment_intent.client_secret,
        },```
but the payment_intent is none and it dies
inland kettle
#

hello! that's expected behaviour, since the amount is $0, no payment is necessary. You should probably be referring to the Invoice object instead e.g. refer to the invoice.paid event

surreal wren
#

but you need a payment intent client_secrete to use the frontend payment

#

there is no way to finalize the frontend transaction

#

So i dont see how "its intended" to not allow for a stripe element to work if you have a 100% coupon that is for one month.

inland kettle
#

if you have a 100% discount coupon, then no payment is required, because the amount is $0

surreal wren
#

but its only for one month

#

so yes.. we need to collect there card details still for the next month

inland kettle
#

can you share an example subscription id?

surreal wren
#

sub_1MnWZKLXvJT74HZxqMvA7ekg

inland kettle
#

Stripe automatically creates SetupIntents for subscriptions that don’t require an initial payment. So what you do in such a scenario would be to expand the pending_setup_intent and use the client_secret for that to collect the payment method details instead : https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent

surreal wren
#

ah

#

thank you

#

ill look into that, appreciate it

#

didnt see that option

#

i'm running into another issue now that I am using that new method,
can i post it here?

inland kettle
#

sure

surreal wren
#

it seems to there is no way to update a pending_intent?
we store a bunch of meta data in our payment intents for later use in our application.

However using our tested code, we are getting
Request req_mnqIxaKP0ljtJK: No such payment_intent: 'seti_1MnWrgLXvJT74HZxuCzLgXp7'

#

Is there a way to predefine meta data on a "pending_intent"

inland kettle
#

seti_1MnWrgLXvJT74HZxuCzLgXp7 is a SetupIntent

surreal wren
#

So i can manipulate that model and it will convert to a intent when ready?

#

hmm seems setup intents dont have a shipping property..
were gunna have to try and figure out i guess how to use this new model with our current flow

inland kettle
#

it's different from PaymentIntents

surreal wren
#

Well becase we store at time of transaction meta data that is important for us

#

i was hoping the meta data of the "setup intent" would be migrated over when that intent needs to be paid

#

I have never used this SetupIntent before so i'm a little unclear on the way its used

inland kettle
surreal wren
#

ya we do that as well.

All good, we wil have to figure out this new flow

#

Thanks for your time