#ishu22g-future-payments
1 messages · Page 1 of 1 (latest)
I am using this to create gather card (Step 2)
stripe.paymentIntents.create({
customer: customer
.id,
setup_future_usage: 'off_session',
amount: 100,
currency: 'usd',
// In the latest version of the API, specifying the automatic_payment_methods parameter is optional because Stripe enables its functionality by default.
automatic_payment_methods: {
enabled: true,
},
payment_method_types: ['card'],
statement_descriptor: 'Custom descriptor',
});
I am using this to create charges (Step 3)
stripe.paymentIntents.create({
amount: 1099,
currency: 'usd',
// In the latest version of the API, specifying the automatic_payment_methods parameter is optional because Stripe enables its functionality by default.
automatic_payment_methods: { enabled: true },
customer: customerId,
payment_method: paymentMethods.data[0].id,
return_url: 'https://example.com/order/123/complete',
off_session: true,
confirm: true,
});
- It will be stored indefinitely.
- You can
- You're a bit confused. A payment intent represents a charge. You don't charge a payment intent multiple times. You create a new payment intent for each charge
Okay. So just to be clear maybe I am not using the correct terminologies. Let me rephrase. I am doing the following:
- Create Stripe customer for user
- Gather user credit card data using payment intent as a payment method
- Create offline payment intents on the payment method collected by stripe by using the same payment method which I collected earlier
So now me rephrased questions are:
My questions are:
-
Will the card (payment method) be stored till its expiry or will user have to input card details again after sometime?
-
If the user select a different plan later on down the line, would I be able to create new payment intents with varying amounts on the same payment method without any problems?
-
How many times will I be able to create payment intents on the collected payment method?
I hope it makes sense now
- It will be stored indefinitely
- You can
- Infinite amounts
Perfect! Thank you. Just wanted to double check
I guess I am ready to push to prod 🙂
You will need to set up future off_session usage on the initial payment intent where you first collect payment method details though: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage
Yes, I am doing that using this:
stripe.paymentIntents.create({
customer: customer
.id,
setup_future_usage: 'off_session',
amount: 100,
currency: 'usd',
// In the latest version of the API, specifying the automatic_payment_methods parameter is optional because Stripe enables its functionality by default.
automatic_payment_methods: {
enabled: true,
},
payment_method_types: ['card'],
statement_descriptor: 'Custom descriptor',
});
Cool
The only problem is this, that it requires me to enter $1 minimum. I wish there was a way to not charge the customer when we are just intiating a payment intent just to collect their payment method
You can. You need to use setupintent instead
Okay. Wow! I didn't know that. I will try this out.
Also, is there a way of knowing if same card (payment method) is being used by any other customer?
The reason is that I want to determine the uniqueness of users based on their payment card
You should control this in your integration. Have unique stripe customer id's per customer
Yes, I am doing that.
I am trying to address the issue where user creates multiple accounts for discounts
So one way I can determine their uniqueness is by payment method
But I didn't find any solution for it in Stripe documentation so far
You can use fingerprint
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ishu22g-future-payments