#binod - iDeal

1 messages ยท Page 1 of 1 (latest)

placid birch
#

Hello, can you tell me more about what issue you are running in to with iDeal?

fast remnant
#

Im using this code const subscription = await stripe.subscriptions.create({ customer: body.stripe_cus_id, items: [ { body: body.plan_id } ], payment_settings: { payment_method_types: ['card', 'ideal'] }, collection_method: 'send_invoice', payment_behavior: 'default_incomplete', expand: ['latest_invoice.payment_intent'] }); console.log("SUB==>", subscription); return { subscription_id: subscription.id, payment_intent_id: subscription.latest_invoice.payment_intent.id, expiry_date: subscription.current_period_end, clientSecret: subscription.latest_invoice.payment_intent.client_secret };

#

and get this error Received unknown parameter: items[0][body]

#

??

#

hello?

placid birch
#

Hello, looking at this again. The server is very busy so responses can get delayed

#

Instead of

                {
                    body: body.plan_id
                }
            ],```
Try
```items: [
                {
                    price: body.plan_id
                }
            ],```
That call does not take a `body` parameter there
https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price
fast remnant
#

oh okay, that was a silly mistake

#

Im pulling response in subscription as you can see.

#

but payment intent is null here i.e. subscription.latest_invoice.payment_intent

stark vector
#

๐Ÿ‘‹ hopping in since @placid birch has to head out soon

#

Do you mind sharing the Invoice ID so I can take a look?

fast remnant
#

sure

#

in_1LD9N0HsW9ET26Jgkg5MKZSL

#

did you look at it?

stark vector
#

You don't get back a Payment Intent yet because it's still a draft - we don't create a Payment Intent for an Invoice until it's been finalized

fast remnant
#

I don't understand. Im trying to create subscription payment using iDeal payment

#

and this is my code const subscription = await stripe.subscriptions.create({ customer: body.stripe_cus_id, items: [ { price: body.plan_id } ], payment_settings: { payment_method_types: ['card', 'ideal'] }, collection_method: 'send_invoice', payment_behavior: 'default_incomplete', expand: ['latest_invoice.payment_intent'], days_until_due: 7 }); console.log("SUB==>", subscription); return { subscription_id: subscription.id, payment_intent_id: subscription.latest_invoice.payment_intent.id, expiry_date: subscription.current_period_end, clientSecret: subscription.latest_invoice.payment_intent.client_secret };

#

what am I missing?

stark vector
#

Backing up for a second here - why do you need the Payment Intent right after you create the Subscription?

fast remnant
#

Im using PaymentElement in frontend, which needs client_secret

#

which is inside latest_invoice.payment_intent

#

It works fine with card payment, having issue with iDeal payment

stark vector
#

Is that why you're using 'send_invoice' to create this Subscription (because you're using ideal)? With send_invoice subscription the first invoice isn't automatically finalized like with charge_automatically subscriptions

fast remnant
#

yes, im just going hit and trial. It's confusing for me.

#

what do you suggest?

stark vector
#

With ideal you wouldn't use the pattern of using the Payment Element - because you use send_invoice, we'd email your customer and collect payment details from there

fast remnant
#

it's not possible to use Payment Element with iDeal payment?

stark vector
#

You can, but the disconnect here is the type of Subscription that you're working with - you're trying to get around the ideal + charge_automatically restriction by using send_invoice

#

But send_invoice Subscriptions are meant to work by email the customer a link to a hosted page and won't finalize the invoice immediately

fast remnant
#

If I use iDeal payment, I need to specify collection_method as send_invoice

#

What I want is, I should be able to buy subscription using Card and iDeal payment. what is the best approach to follow?

stark vector
#

Yes, and what I'm saying is that using send_invoice + payment element is usually not the approach you want - send_invoice will email the customer EVERY billing cycle. So you won't be able to just collect payment once - your customer will need to provide payment every cycle

fast remnant
#

you mean send invoice to customer => Customer pays using iDeal => Listen webhoowk => Update aplication data

#

is this the flow for iDeal payment?

#

??

stark vector
#

Yes, that's the general flow

fast remnant
#

in that case, I should email right? but I didnt get one

#

should recieve*

stark vector
#

In test mode we don't sent the email - you have to trigger it manually through the dashboard

fast remnant
#

how?

#

Also, subscription is created with status active. isn't it supposed to be incomplete? because customer hasnt paid yet

stark vector
#

send_invoice and charge_automatically subscriptions behave VERY differently - because send_invoice subscriptions don't start off with a finalized invoice, there is no payment due immediately so it can transition to active right after being created. In comparison charge_automatically subscriptions will typically have payment due because they are finalized

fast remnant
#

okay, how come invoice is in draft ?

stark vector
#

How did you get to this UI? Did you finalize the invoice before coming here?

fast remnant
#

I downloaded invoice from dashboard and there was a link which landed me into this UI

stark vector
#

Yeah, so you need to be finalized that Invoice BEFORE you go to that link

fast remnant
#

how do I finalize it?

stark vector
fast remnant
#

It says, stripe automatically finalizes invoice. Only need to call API to do it manually

#

does it finalize automatically in live mode?

stark vector
#

It automatically finalizes, after an hour - just like with charge_automatically invoices that are not the first one

fast remnant
#

okay, API also works.

#

one last question

#

can I customize invoice?

#

I need dynamic title i.e. Nova Automotive B.V

wary quarry
stark vector
#

What do you mean by a dynamic title - what would you like to change it to? Is it because connect is involved?

fast remnant
#

yes, Im working on wordpress like SAAS product

#

my client needs business name of connected account(express)

stark vector
#

Gotcha! So connect is involved here - if you use on_behalf_of when you generate the Invoice, it should use the details from the connect account instead of the platform

fast remnant
#

It does not accept on_behalf_of parameter

wary quarry
#

Are you using Subscriptions or Invoices?

fast remnant
#

subscriptions

wary quarry
#

Okay so on_behalf_of exists but it's in beta. You will have to contact our support team and they will be able to give you access to the beta for you to use it. You can contact them here: https://support.stripe.com/contact

fast remnant
#

okay, thanks a lot for the help!