#zetsuman
1 messages · Page 1 of 1 (latest)
Step by step guide here for SetupIntents
https://stripe.com/docs/payments/save-and-reuse?platform=web
Or use this guide to save payment method when creating a sub
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
I saw this article.
I can't use subscriptions, because of my application requirements. Also, I need to make recurring charges for connected accounts.
Gotcha. Then you want the first doc I linked
As I see from the docs, I should create setup Intent, then attach payment method from setup Intent to customer. Later when I need to charge money, I can use this payment method and customer ids for payment intent.
But, as I understand, when I create payment Intent for connected account, I shoud provide
on_behalf_of: stripeAccountId,
transfer_data: {
destination: stripeAccountId,
},
But when I try to make recurring payment with card 4000002500003155 I have a payment intent which has a status required_action.
Is setup intent do the same thing as payment intent with setup_future_usage except of charging money?
You also need to pass in off_session: true when you create the recurring payment, can you share an example request ID for this recurring charge you're creating?
const paymentIntentParams: Stripe.PaymentIntentCreateParams = {
amount: totalAmount,
currency: 'usd',
payment_method_types: ['card_present', 'card'],
capture_method: 'manual',
application_fee_amount: feeAmount,
customer: stripeCustomerId,
on_behalf_of: stripeAccountId,
transfer_data: {
destination: stripeAccountId,
},
metadata: {
notificationChannel,
requestType,
customerName,
customerEmail,
customerPhone,
stockNumber,
user: userId,
env: process.env.NODE_ENVIRONMENT,
department: departmentId,
isCustomerPaysFee: String(isCustomerPaysFee),
},
description: stockNumber,
expand: ['latest_charge'],
};
if (requestType === RequestType.RECURRING) {
paymentIntentParams.confirm = true;
paymentIntentParams.setup_future_usage = 'off_session';
}
if (paymentMethodId) {
paymentIntentParams.payment_method = paymentMethodId;
}
return await this.stripe.paymentIntents.create(paymentIntentParams);
Am I understand correct that if I have a status require_action, I should use paymentIntent.confirm method with off_session: true?
You need to set off_session: true when you create the PaymentIntent. Its covered in the docs I linked above
https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#charge-saved-payment-method