Creating a payment intent for a connected account for a new customer? - stripe-payments

I create a payment intent using stripe.paymentIntents.create for a connected account, the customer may not exist yet.
The customer then signs up for the platform to pay for the payment intent, at which point I'd also like the customer to be on the platform account as well.
If the customer is not yet created I can't create a platform customer and clone them as I get an error about not being able to clone customers with no payment method attached.
The end goal is to allow a connected account to create a payment intent then haev a customer sign up for the platform and pay for that payment intent. But I'm not seeing how I coudl do this with the stripe api - unless I create the payment intent for the platform account but then it somehow has to move across to the connected account.
Is there a way to accomplish this?

It's not possible to clone a card on the connected account back to the platform account.
You should create a customer and collect the payment method details on the Platform account first. Then clone the PaymentMethod to the connected account. Subsequently, create and confirm the PaymentIntent off-session on the connected account with the cloned PaymentMethod.
See https://stripe.com/docs/payments/save-and-reuse for how to save the payment method for future use.

Related

Stripe Connect - share customers without payment method

I am currently hitting a roadblock implementing Stripe Connect into our platform. We want to allow multiple connected accounts to use our platform to sell some sort of tickets. For this we wanted to use Standard accounts with Direct Charges (since we want to take a cut and also not have to deal with refunds/disputes etc.).
On our end the end-user has to either select or create a customer on our platform (created in our Stripe account) and then provide their payment method details through Stripe Elements. The documentation states that you need to create a PaymentIntent for the connected account, but this is not possible while also supplying the previously saved customer (because the customer only exists on our platform).
Now another documentation outlines that it is possible to share customers between connected accounts. The issue with this is that for this step you already seem to need a payment method attached to the customer:
If your platform uses the Payment Methods API, you must create a PaymentMethod from that customer.
The linked documentation outlines how to clone payment methods of customers between linked accounts, but this once again assumes that we already have a confirmed/attached payment method.
So my question is: How can we allow customers to be shared between all connected accounts without having to supply a payment method first? After the first payment (and if the customer chooses to do so) we want to save (and later clone if necessary) this payment method for future payments on all connected accounts.
For normal payments you can create a PaymentIntent with a customer but without a payment method and only supply the latter on the client (in our case stripe.js)
Since you're using Standard accounts, you have to use Direct Charges when accepting payments on behalf of that connected account. This means that the PaymentIntent has to live on the connected account, alongside the Customer and the PaymentMethod if any.
If you want to re-use the payment method details for other accounts in the future though, the PaymentMethod itself and its associated Customer has to live on the platform account.
Unfortunately, there's no way to "clone" a PaymentMethod from the connected account back to the platform today. This means that you have to change your integration logic slightly and approach the overall flow differently.
The idea is that you first need to collect payment method details in the platform. Since you're not taking an immediate payment during that step, you want to use the SetupIntent API. This is the flow documented here that will let you create the SetupIntent on the platform and collect card details securely client-side.
Once you have this information, you will now have a Customer cus_A in the platform, with the PaymentMethod pm_123 attached to it. That is the first step of the flow.
Now, you want to accept a payment on the connected account. So you first need to clone the PaymentMethod on that account as documented here. That will give you a brand new PaymentMethod pm_xyz that lives on that connected account. You can then use that PaymentMethod to confirm a new PaymentIntent on that connected account and passing payment_method: 'pm_xyz' to attempt to charge that saved card.
Note that it is possible this requires a "next action" such as doing 3D Secure as it's on a different account which could come with different restrictions.
In the future, if that customer comes back and wants to pay another connected account, you'd do a new clone of the PaymentMethod on that account and a new PaymentIntent for that cloned card and you can repeat it each time they pay a new business.
It can seem a bit convoluted at first, but once you grasp the flow of all the objects it does make sense overall!

Charging customer with saved card in main account with connected account in Stripe

I know I can save a card with a customer in Stripe and use it for later. My question is can I save the customer with the card on the main Stripe onboarding account and use that customer for all sub accounts (connected accounts). Or does the customer have to be created and saved on each connected account to work.
Stripe Payment: Save token and customer and make payment later from token
Stripe connected accounts would need to have copies of those customers and cards associated with their accounts to be able to process charges for those cards/customers.
There are ways to copy payment methods from the Platform to the Connected account that are detailed here which you might find useful.

Stripe Connect: Can Connected accounts become Customer?

I'm considering adopting Stripe connect.
What I want to do is One user will be able to both that receive and pay.
What I now understand is to create a custom account user and create a payment from the platform to the custom account with Destination charge.
Can a Custom account user pay the platform as a consumer?
Thanks.
As per your scenario you can make a stripe Customer and his Connect account both having same bank account linked. So when you initialise to pay the platform it will be charged from same bank account as well as when receiving payout the same bank account will be credited.

Migrating stripe subscription to be SCA compliant

I have a subscription, I collect card details on signup with a 7 day trial, after which the subscription bills monthly.
From what I understand the subscription API is not SCA compliant. Instead
An off_session payment Intent must first be setup when collecting card details.
At the end of each month a scheduler must be triggered to attempt to charge the registered card.
Is this the case? Am I now responsible for scheduling payments?
Update
For those who want some starter code, I created a working playground here with subscriptions, frontend (react) and backend (express) on glitch.
It's not true that Stripe's Subscription API is not SCA-ready, it is, and you don't have to set up your own scheduling like that. The docs you linked to are generally aimed at processing one-off payments(like saving a customer's details and then allowing them to use them again when they re-visit your site to purchase something new, for example) as opposed to recurring ones.
https://stripe.com/docs/billing/subscriptions/payment describes how to set up a subscription in a way that is SCA-ready. While the customer is on-session on your payment page, you collect card details and create a subscription for the customer, which will generally attempt a payment for the first billing period. You then check the status of the subscription after it's created, and handle the outcomes:
the subscription is active and the payment was successful, so you can proceed with provisioning your service to the customer.
the subscription is incomplete — for SCA purposes, let's say this is because 3D Secure authentication was required for that first payment. In this case, the latest_invoice of the subscription exposes a PaymentIntent property, and you use that PaymentIntent in conjunction with your frontend code using stripe.js to walk the customer through authenticating the payment, and that activates the subscription.
the subscription is trialing — if the subscription doesn't involve an initial payment, like when using a trial period for example, you can also check if the subscription has a pending_setup_intent. You can use this on your frontend to have the customer complete a 3D Secure authentication, so that future payments(like the first one after the trial) are more likely to successfully claim an exemption and not require having the user authenticate at that point.
You can also instead use Stripe Checkout to easily collect payment details and set up a customer and subscription for you, while also handling any initial authentication that's needed : https://stripe.com/docs/payments/checkout/server#create-subscriptions
As for the recurring payments, Billing can handle that for you. You can configure you settings to automatically email the customer to complete 3D Secure if it's encountered on a recurring payment. So you can absolutely build an SCA-ready solution with the subscriptions API on Stripe.

Does Stripe Connect allows to top-up customer (buyer) account?

I want to create a marketplace, where buyers can buy credits (top up their platform accounts) and use them later to buy products from other customers. I want to use Stripe as payment processor. I did some research and I've noticed that Stripe Connect is appropriate for that kind of business. However I don't know how to do this. Seller can have Connected accounts created. Buyer can have Customer object created, where I can store payment methods for user. How then I could be able to topup Buyer account, when he hasn't any ? Maybe I could create Connected account for buyer too but then I can't make transfers between connected accounts ? Is it possible to have such a business model in Stripe ??

Resources