#Eman - connect subscriptions

1 messages ยท Page 1 of 1 (latest)

spare knot
#

Hello. One moment while I catch up with some threads

spark kraken
#

No problem ๐Ÿ™‚

spare knot
#

This is possible

#

However for subscriptions you don't pass paymentintent data

#

What are you trying to pass exactly there?

spark kraken
#

I am trying to pass the application_fee_amount

#

subscription = await stripe.checkout.sessions.create({
customer: customerID,
line_items: [{
price: priceID,
quantity: qty,
tax_rates: taxRates
}],
payment_intent_data:{
application_fee_amount: 10,
},
mode: 'subscription',
success_url: succ_url,
cancel_url: cancel_url
}, {
stripeAccount: connectedAccountId
});

#

this is the code snippet

spare knot
#

Ah ok

spark kraken
#

this would go instead of line_items I suppose right?

spare knot
#

No you would use both

spark kraken
#

does the customer need to be in my account or in the connected account?

#

now im getting no such customer error

#

I know the id is valid in the connected account but not in mine

spare knot
#

What type of connected account are you using?

spark kraken
#

standard

spare knot
#

Gotcha

#

You have to specify the connected account

spark kraken
#

I updated the call like this

spark kraken
opaque plinth
#

Hi there! I'm stepping in here for @spare knot. The customer does need to be on the Connected Account if you are passing a customer ID here.

spark kraken
#

Sorry but I didnt understand the last part.

opaque plinth
#

Also you don't need to duplicate items if you are already passing line_items

spark kraken
#

I have just tried to initialise it using the following

const stripe = Stripe(stripeKey, {stripeAccount: connected_account_id});

#

Uncaught Error: Config object may only contain the following: apiVersion, typescript, maxNetworkRetries, httpAgent, timeout, host, port, protocol, telemetry, appInfo

#

but getting this

opaque plinth
#

Yeah you want to pass the Stripe Account header with your API Request, not upon your initialization of Stripe.

#

You are already passing it in your code snippet above to create the Checkout Session, which looks good. You can remove it from your stripe initialization.

#

You stated that prior you were hitting an error about the customer correct?

#

I assume that is because you are creating the customer without passing the Stripe Account header for your Connected Account in that request.

#

The customer must live on the Connected Account where the Checkout Session is taking place

spark kraken
#

I created the customer in the connected account using the web

#

I tried passing a one time payment and it worked

#

i'm just stuck on subscriptions

opaque plinth
#

Currently you are trying to both pass transfer_data.destination and create the Session on the Connected Account. This isn't possible as these are conflicting.

#

transfer_data.destination is used to create the Sub on your Platform and transfer funds to the Connected Account.

spark kraken
#

ah ok

opaque plinth
#

Since you are using Standard Accounts you want the Subscription to live on the Connected Account.

#

So you remove the transfer_data.destination and just create the Session/Subscription on the Connected Account

spark kraken
#

exactly

#

I still get the following error though
You can not pass `payment_intent_data` in `subscription` mode.

opaque plinth
spark kraken
#

oh so it needs to be a percent

opaque plinth
#

And you can remove subscription_data.items since you are already passing line_items

spark kraken
#

cant have it as a flat fee

opaque plinth
#

Yeah flat application fee isn't supported for Subscriptions

spark kraken
#

ok let me try with a percent

#

Thanks alot! I have managed to get it to work!

#

10/10 support!