#Sangeeta
1 messages · Page 1 of 1 (latest)
You will need setup_future_usage and customer
Sorry but when we added then i have got this error
Let's take a step back and find the request id of the error
Do you have the request id? req_xxx
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.
You need to find the errored request id first
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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
copy me that req_xxxx Id
req_jDuMKpg4HKZmSD
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
yes
What's your plan to collect the PaymentMethod?
Through card
after creating Subscription?
No i need before
And what's your plan to collect via card? By creating a PaymentIntent?
I need card details to create the paymentMethod.id, then its id i have use in my subcription code
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
- You collect the Payment Method beforehand, normally via a SetupIntent, then using the PaymentMethod Id to supply to Create Subscription API
- 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 generatedlatest_invoice.payment_intent
It's up to you to choose either of above approaches