A note on Stripe Elements JS methods¶
TLDR: If you haven’t yet migrated to PaymentIntents,
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).
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.
The Card Elements Quickstart JS example can be used, except use
stripe.createSource instead of
result.source instead of
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()¶
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
or ideally to Payment Intents .