#Sangeeta

1 messages · Page 1 of 1 (latest)

limpid oceanBOT
tacit kindle
#

You will need setup_future_usage and customer

naive garnet
#

Sorry but when we added then i have got this error

tacit kindle
#

Let's take a step back and find the request id of the error

#

Do you have the request id? req_xxx

naive garnet
#

Basically i do , first customer create and second intent then subscription on that one or monthly......etc but when we create the subscription then i need card details but stripe having inbuilt screen of card so how we store the card as deafault

#

{
id: 'pi_3LhpHhSJtcEjZR970upd71MH',
object: 'payment_intent',
amount: 1,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
charges: {
object: 'list',
data: [],
has_more: false,
total_count: 0,
url: '/v1/charges?payment_intent=pi_3LhpHhSJtcEjZR970upd71MH'
},
client_secret: 'pi_3LhpHhSJtcEjZR970upd71MH_secret_1AcGHwOHlrpusPIc0wD4i4kau',
confirmation_method: 'automatic',
created: 1663137681,
currency: 'usd',
customer: 'cus_MQgeyehVnnCDrm',
description: 'fvegrtgtrhyrhvfcbcvytjytju',
invoice: null,
last_payment_error: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: 'automatic'
}
},
payment_method_types: [ 'card' ],
processing: null,
receipt_email: 'joti.koundal123@gmail.com',
review: null,
setup_future_usage: 'on_session',
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'requires_payment_method',
transfer_data: null,
transfer_group: null
} paymentIntent
(node:15354) UnhandledPromiseRejectionWarning: Error: This customer has no attached payment source or default payment method.

tacit kindle
#

You need to find the errored request id first

#

Basically i do , first customer create and second intent then subscription
This doesn't sound right to me. Normally you create a Subscription, then grab the PaymentIntent inside it, or you create a SetupIntent then use it to create the Subscription

#

It sounds like you are creating both PaymentIntent and Subscription, which is unusual

naive garnet
tacit kindle
#

copy me that req_xxxx Id

naive garnet
#

req_jDuMKpg4HKZmSD

tacit kindle
#

Okie I see it now, thanks

#

So it's an expected error when you create this Subscription, with the customer id cus_MQgeyehVnnCDrm which doesn't have any default PaymentMethod

naive garnet
#

yes

tacit kindle
#

What's your plan to collect the PaymentMethod?

naive garnet
#

Through card

tacit kindle
#

after creating Subscription?

naive garnet
#

No i need before

tacit kindle
#

And what's your plan to collect via card? By creating a PaymentIntent?

naive garnet
#

I need card details to create the paymentMethod.id, then its id i have use in my subcription code

tacit kindle
#

And how do you collect card detail? I mean which client integration? Payment Elements?

#

To be summarized: There are 2 ways to create a Subscription

  1. You collect the Payment Method beforehand, normally via a SetupIntent, then using the PaymentMethod Id to supply to Create Subscription API
  2. You create the Subscription first by passing in payment_behavior = default_incomplete. The Subscription will be created with status = past_due, then you collect the Payment Method by confirming its generated latest_invoice.payment_intent
#

It's up to you to choose either of above approaches