Custom Payment

If you wish to roll your own UI/UX for payment data collection you can use V2 of Stripe.js. The following snippet is an example of how you could tokenize a payment method and collect the token using Stripe.js V2.

<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<script>
    Stripe.setPublishableKey('violet-stripe-public-key');

    function stripeResponseHandler(status, response) {
        let paymentToken = response.id;
    }

    Stripe.card.createToken({
    number: "4242424242424242",
    cvc: "123",
    exp_month: "04",
    exp_year: "2021",
    address_zip: "98104"
  }, stripeResponseHandler);
</script>

If you prefer to use Stripes payment UI/UX we recommend using Stripe.js Elements.

🚧

You must use Violet's public Stripe token when tokenizing the payment method. Using any other token will result in an error when attempting to apply the payment method to the cart.