Stripe: Is there an element that creates a customer without a charge? - stripe-payments

Does Stripe have an element that would capture a customers card details but not process any payment?
In my case, I have a form that a client fills out but payment is not processed at that time as the final charges will always change based on what the client needs are. Payment would be processed at a later date.
I did see that WordPress / gravity forms have a module that does this but I would rather not have to create a WordPress site.

You can use Stripe.js with Elements (https://stripe.com/docs/stripe-js) or Stripe Checkout (https://stripe.com/docs/checkout) to collect your customer's card details securely.
Both Stripe.js and Checkout allow you to tokenize a user's credit card details. You can then use those that token/source on your backend to create a new Customer with that token [0] or update an existing Customer.
The Stripe recipe's page actually has an example of using Stripe Checkout to update a user's card details (https://stripe.com/docs/recipes/updating-customer-cards#using-the-token-to-update-the-customers-card).
[0] https://stripe.com/docs/api/customers/create?lang=node#create_customer-source
Hope that helps!
UPDATE: adding that the new version of Stripe Checkout is a hosted page that allows collecting card details for future use via its Setup Mode: https://stripe.com/docs/payments/checkout/setup#retrieve-setupintent

Related

Can I generate a payment link to the stripe for an existing client?

Am I able to generate a payment link for a user who is already saved in the stripe. From what I understand when generating a new payment link, stripe will create a new customer for me. And I would like to assign a payment to an existing account
Stripe Payment Links[1] are used in order to accept payment multiple times for multiple customers and you can’t assign it to a single Customer. In other words, when creating a PaymentLinks you copy, share, and reuse that single link with your customers multiple times. You can share it as many times as you want on social media, in emails, or on your website.
However, you can use Stripe Checkout Sessions[2] and create a dedicated Checkout Session for your existing Customer[3]. You can set your existing customer Id when creating the Checkout Session[4] so that your Checkout Session will be attached to that existing Stripe Customer.
[1] https://stripe.com/docs/payments/payment-links
[2] https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout
[3] https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#handling-existing-customers
[4] https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer

Stripe Payment Links with Customer Id

I am currently building an application where we want to user Stripe Payment links rather then building our own version of UI to support the same functionality. However I notice that Stripe Payment Links create a new customer every single time. Is there a way to attach my customer id to the payment link so that a new customer is not created when they attempt to buy more then one product? I would prefer not to have to have a single user have multiple customer ids inside of my database.
Thanks!
Payment Links are not specific to a Customer record. The documentation does include examples of how you might append data to them to aid in reconciling payments to a specific individual.
If you want to make use of the Stripe hosted UI while still assigning specific Customer records then I would recommend making use of Stripe Checkout.

Stripe APi paymentIntent and sessions object

I am having trouble finding out the difference between payment Intent and a session.
Assuming I a customer logs into a page and goes to domain.com/register how can I create session and check if customer has already visited page by using customer email address to get the customer object?
What are the difference between paymentIntent and session and how do they help? I see that session is created on Checkout but not when accepting one time payments.
Current I create a payment intent and it works find but my 'url' has no session
PaymentIntents
A PaymentIntent is an API object in Stripe's API that create encapsulates a lifecycle of a one-time payment.
You typically create your own form on your webpage when using PaymentIntents, create a PaymentIntent using the Stripe API, then confirm it using the cardElement from Stripe Elements (the frontend UI elements for collecting card details).
Checkout
Checkout is a full page "hosted UI" that creates its own PaymentIntent and provides all the UI that a customer needs to enter their card details and takes a payment. It also supports many other payment methods automatically without you having to manually add support for each one.
So a CheckoutSession under the hood uses a Subscription or a PaymentIntent object, depending on whether it was used in subscription or payment mode.

Stripe Updating a customer's card info

I am trying to implement Stripe in php and I try to avoid using html forms , I instead call the Stripe Hosted Checkout page for the first subscription payment. However, if for later invoices, the payment failed due to an expired card for example , I want my customer to be able to update his card info (or I can create a new customer object in Stripe belonging to this same person) but the important part is that I want him to enter his NEW credit card info in a stripe hosted form that will validate his new card number , CVV...
Is there any way to do that?
Currently I am doing this :
document.getElementById("subscribe-now").addEventListener("click", function(evt) {
createCheckoutSession('<?php echo Config::SUBSCRIPTION_PLAN_ID; ?>').then(function(data) {
stripe.redirectToCheckout({
sessionId: data.id
}).then(handleResult);
});
Yes, that's supported by the Customer Portal. Similar to Checkout, this is a Stripe-hosted service that allows your customers to manage subscriptions and saved payment methods according to the configuration you provide, and you redirect your customers to it.
Preview here.

3D secure authentication and Stripe

I am creating subscriptions upon completing the Stripe Checkout session and from what I have read, stripe supports 3d secure authentication payment on its checkout session. However, if this is true for the first time the client pays for the subscription (stripe will ask him to enter a code on the checkout session page), how will that be applicable for the remaining payments in the following months? Where will the user enter the code?
Assuming you are using Stripe Billing, your user will be automatically charged on recurring months. So they usually only have to complete 3DS for the initial payment. But if the card issuer requires 3DS to be fulfilled every invoice, you can configure your Stripe settings to automatically email your user to complete 3DS on a Stripe hosted page. However, if you want to write custom failure handling, you will need to add a webhook for customer.subscription.updated and check if the status is past_due.
https://stripe.com/docs/billing/subscriptions/overview#recurring-charges
In my case, Just added off_session when you create charge about user.
$user->charge($price, $paymentMethod, ['off_session' => true]);
Hopefully, it would be worked for you.

Resources