Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Stripe Checkout https://checkout.stripe.com/checkout.js and Elements https://js.stripe.com/v3/

I am using stripe payment to integrate with my system. But i did not understand a difference between this 2 library.

It's seem use javascript to generate the form and pass the token to our server side.

<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
data-amount="2000"
data-name="Stripe.com"
data-description="2 widgets"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-zip-code="true">
</script>

And this is using with .net core

<script src="//checkout.stripe.com/v2/checkout.js"
class="stripe-button"
      data-key="@Stripe.Value.PublishableKey"
      data-locale="auto"
      data-description="Sample Charge"
      data-amount="500">
</script>

With out checkout.js, we also use

<script src="https://js.stripe.com/v3/"></script>
<div id="payment-request-button">
 <!-- A Stripe Element will be inserted here. -->
</div>

That mean i can also use this 2 to use. And two of this script , i can handle crate token and custom, so what is the difference behavior of this 2 scripts.

Thank you very much

like image 721
Cong HS Avatar asked Oct 19 '17 10:10

Cong HS


People also ask

What does Stripe elements mean?

Stripe Elements is a set of prebuilt UI components for building your web checkout flow. It's available as a feature of Stripe. js, our foundational JavaScript library for building payment flows. Stripe. js tokenizes sensitive payment details within an Element without ever having them touch your server.

What's Stripe checkout?

Checkout is a low-code payment integration that creates a customizable payment page so you can quickly collect payments on desktop and mobile devices. Checkout supports one-time payments and subscriptions for your global customer base with coverage across over twenty local payment methods.

What is payment element in Stripe?

The Payment Element is an embeddable UI component that lets you accept up to 25+ payment methods with a single integration. Whether you're just collecting card payments or dozens of payment methods, the Payment Element is the easiest way to build an embedded and customized payments experience.

Is Stripe elements an iframe?

The element is an iframe, which is another window, which has its own window object and document object. The parent page cannot access these objects, unless the iframe is in the same origin.


2 Answers

There is no difference. You should use the URL listed on Stripe's Checkout documentation page: https://checkout.stripe.com/checkout.js.

EDIT: It's up to you to choose whether to use Checkout or Elements to collect and tokenize customer payment data. Checkout is a pre-built form that is usable immediately. If you want to design your own custom payment form, you should use Elements instead.

like image 84
Ywain Avatar answered Oct 10 '22 00:10

Ywain


From official documentation

The simplest way for you to securely collect and tokenize card information is with Checkout.

Stripe.js and Elements: If you’d prefer to have complete control over the look and feel of your payment form, you can make use of Stripe.js and Elements, our pre-built UI components. Refer to our Elements quickstart to learn more.

like image 30
A. Morel Avatar answered Oct 10 '22 01:10

A. Morel