#atul
1 messages · Page 1 of 1 (latest)
hi there! do you have a bit more context on that?
pi_3Lh8Q4SApUbhYhpH10ha6olz
any other context?
I am writting a test case to simulate the successfull payment
stripe.customers.createSource(
customer.id,
{ source: 'tok_visa' },
);
i added above card as default payment source
After this i tried to create subscription for the customer but, payment status shows incomplete
that's expected really, you have to tell us to charge that specific card.
also you shouldn't use createSource, that's deprecated
instead of create source what can be used??
Hi! I'm taking over this thread.
I have requirement
Can you clarify what are you trying to do?
I need to write the test case foe successfully payment and payment failure
For this i creteadted a customer, a product
No i wanto creted customer to subcscribe to created product
I am stuck over how to make payment
Are you using subscriptions?
yes
Are your following this guide to create your subscriptions and collect payment information? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
yes
i need to write test case
where payment can be processed successfully without humn intervention
why all my payment remains in incomplete state
Anyone there ???
Got it! Then I recommend setting a default payment method on the customer here: https://stripe.com/docs/api/customers/create#create_customer-invoice_settings-default_payment_method
And you can find all our test PaymentMethod here: https://stripe.com/docs/testing
You could create a customer like this (in Node.js):
await stripe.customers.create({
payment_method: "pm_card_us",
invoice_settings: {
default_payment_method: "pm_card_us"
}
});
Payment is not getting completed ??
What should be done
I tried with all aspect
Hello
Payment is not getting completed ??
What does that mean? Can you share a subscription ID or PaymentIntent ID?
A few things:
- Why are you creating a PaymentIntent if you are using subscription?
- You forgot to
confirmthe PaymentIntent. You can do that by passingconfirm:truewhen creating the PI
Things are got meshed up
I created a customer
I created a product
Now i have requirement, i need to create subscription, how can be this achieved(only human intervention is allowed as writting test script)
This is how I create customer
tripe.customers.create({
description: 'Test customer for mocha testing',
payment_method: "pm_card_us",
invoice_settings: {
default_payment_method: "pm_card_us"
}
});
This is how i create product
stripe.products.create({
name: 'Mochas test product',
default_price_data: {
currency: 'usd',
unit_amount: 1000,
recurring: {
interval: 'month',
interval_count: 1
}
}
});
Now tell me how to create subscription ??
It's all in the API reference: https://stripe.com/docs/api/subscriptions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes, i follwed it, payment is not geting completed?
What's the sub_xxx?
Have you worked through this guide? https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Can you share this
I can't really help without seeing what state the Subscription you've created is in
incomplete
sub_1LhA6YSApUbhYhpHFFIwYK13
pi_3LhA6ZSApUbhYhpH1w0yWGFR
Above is the subscription id and payment intent_id
That's not the PI for that Subscription
This is the PI for the initial invoice on that Subscription: https://dashboard.stripe.com/test/payments/pi_3LhA6YSApUbhYhpH1aueZIWy
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It requires 3DS/auth as you're an Indian merchant: https://stripe.com/docs/india-recurring-payments
You'll need to handle that 3DS/auth request with Stripe.js: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#complete-payment