条纹中强大的客户身份验证

时间:2019-05-31 05:38:36

标签: ajax stripe-payments

我已在条带中实施了强客户身份验证。 它可以在测试模式下工作,但不能在实时模式下工作我想知道实时模式的付款方式吗?

function createPaymentIntent(plan_id,customer_id) {
              $.ajax({
                type: 'POST',
                url: 'https://api.stripe.com/v1/payment_intents',
                headers: {
                   Authorization: 'Bearer sk_live_*******************'
                },
                data: {
                    customer: customer_id,
                    amount: Math.round(amount*100),
                    confirmation_method: 'automatic',
                    payment_method: 'pm_card_threeDSecure2Required',
                    confirm: true,
                    currency: currency,
                },
                success: (response) => {
                  console.log("payment" + response['client_secret']);
                  var stripe = Stripe('pk_live_********************');
                  var elements = stripe.elements();
                  try {
                      stripe.handleCardPayment(
                        response['client_secret']
                      ).then(function(result) {
                        if (result.error) {
                            $('#hvalidation').hide();
                             $('.checkout-title').after('<span id="errmsg">Please complete the authentication process</span>');
                          // Display error.message in your UI.
                        } else {
                            createSubscription(plan_id,customer_id);
                          // The payment has succeeded. Display a success message.
                        }
                      });
                   }
                catch(error) {
                  console.log(error.message);
                }
                },
                error: (response) => {
                  console.log(response);
                }
              })
             }


实际结果-实时模式下不显示身份验证模型。
预期结果-身份验证模型应在实时模式下显示。

0 个答案:

没有答案