forked from dj-stripe/dj-stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document the different ways of using stripe.js Elements (dj-stripe#1038)
- Loading branch information
1 parent
025f4df
commit cd4daee
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ Contents | |
|
||
installation | ||
api_versions | ||
stripe_elements_js | ||
|
||
.. toctree:: | ||
:caption: Usage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
A note on Stripe Elements JS methods | ||
==================================== | ||
|
||
.. note:: | ||
TLDR: If you haven't yet migrated to PaymentIntents, | ||
prefer ``stripe.createSource()`` over ``stripe.createToken()`` for better compatibility with PaymentMethods. | ||
|
||
|
||
A point that can cause confusion when integrating Stripe on the web is that there | ||
are multiple generations of frontend JS APIs that use Stripe Elements with stripe js v3. | ||
|
||
In descending order of preference these are: | ||
|
||
Payment Intents (SCA compliant) | ||
------------------------------- | ||
|
||
The newest and preferred way of handling payments, which supports SCA compliance (3D secure etc). | ||
|
||
See https://stripe.com/docs/payments/payment-intents/web | ||
|
||
|
||
Charges using stripe.createSource() | ||
----------------------------------- | ||
|
||
This creates Source objects within Stripe, and can be used for various different | ||
methods of payment (including, but not limited to cards), but isn't SCA compliant. | ||
|
||
See https://stripe.com/docs/stripe-js/reference#stripe-create-source | ||
|
||
The `Card Elements Quickstart JS`_ example can be used, except use ``stripe.createSource`` instead of ``stripe.createToken`` | ||
and the ``result.source`` instead of ``result.token``. | ||
|
||
See https://github.com/dj-stripe/dj-stripe/blob/master/tests/apps/example/templates/purchase_subscription.html | ||
in for a working example of this. | ||
|
||
|
||
Charges using stripe.createToken() | ||
---------------------------------- | ||
|
||
This predates ``stripe.createSource``, and creates legacy Card objects within Stripe, | ||
which have some compatibility issues with Payment Methods. | ||
|
||
If you're using ``stripe.createToken``, see if you can upgrade to ``stripe.createSource`` | ||
or ideally to Payment Intents . | ||
|
||
See `Card Elements Quickstart JS`_ | ||
|
||
.. _Card Elements Quickstart JS: https://stripe.com/docs/payments/cards/collecting/web |