#leedurrant-bring-customer-back

1 messages ยท Page 1 of 1 (latest)

long grail
#

Hello ๐Ÿ‘‹
Can you provide specific examples for the PaymentIntent as well as the code that you're using and walk me through the flow?

balmy bronze
#

pi_3LNdBvL4KF1uRfCk0EkGgFXZ

long grail
#

How are you initializing Stripe exactly?

balmy bronze
#

var stripe = Stripe("pk_test_x_mypk_x");

  $( document ).ready(function() {
    document.querySelector("#authenticate")
    .addEventListener("click", function(evt) {
      var clientSecret = "pi_3LNdBvL4KF1uRfCk0EkGgFXZ_secret_12345";
      var paymentMethodId = "card_12345";
      //showEl(".requires-auth");
      changeLoadingState(true, "#authenticate");
      
      stripe
        .confirmCardPayment(clientSecret, {payment_method: paymentMethodId})
        .then(function(stripeJsResult) {
          changeLoadingState(false, "#authenticate");
          if (stripeJsResult.error && stripeJsResult.error.code === "payment_intent_authentication_failure") {
            // Authentication failed -- prompt for a new payment method since this one is failing to authenticate
            setupElements();
            //hideEl(".requires-auth");
            //showEl(".requires-pm");
          } else if (stripeJsResult.paymentIntent && stripeJsResult.paymentIntent.status === "succeeded") {
            // Payment was authenticated and the card was charged
            paymentIntentSucceeded(clientSecret, ".requires-auth");
          }
        });
      });
    });
long grail
balmy bronze
#

Ah of course. I have some MOTO code that uses stripe.js and it works fine. And now that you responded I know realise how stupid I have been!

#

But....

#

Is it safe to put the CONNECTED_STRIPE_ACCOUNT_ID in to the html?

long grail
#

yup that's fine ๐Ÿ™‚

balmy bronze
#

Cool. The moto stuff doesn't really expose the html, and even if they could grab it, it would be the merchant viewing his own account. Many thanks for such a quick response.