贝宝智能按钮集成问题 [英] Issue with paypal smart buttons integration

查看:65
本文介绍了贝宝智能按钮集成问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了 paypal 付款流程.如果用户单击使用 PayPal 付款",则会打开一个弹出窗口,要求用户登录他们的 PayPal 帐户,然后从那里付款.此流程按原样工作.我面临的问题是 PayPal 智能按钮 JavaScript SDK 提供的使用信用卡或借记卡付款"按钮.单击此按钮时,它不会像使用 PayPal 付款"按钮那样打开弹出窗口.相反,它会打开一个内联表单.我见过一些网站,点击用信用卡或借记卡付款"按钮会打开一个弹出窗口,在那里呈现表单.我错过了什么?我已经浏览了他们的 Smart Buttons API 文档,但他们没有提到如何在内联渲染和弹出窗口之间切换.这是我配置 SDK 的方式:

I've already setup a paypal payments flow. In which if a user were to click to 'pay with PayPal', a pop up opens up which asks the user the sign in to their paypal account and then make the payment from there. This flow works as it is. The issue I'm facing is with the 'pay with credit or debit card' button which the PayPal smart button JavaScript SDK provides. When clicking on this button, it does not open a pop up like it does for the 'pay with PayPal' button. Instead it opens an inline form. I've seen sites where clicking on the 'pay with credit or debit card' button opens a pop up where the form is rendered. What am I missing? I've gone through their Smart Buttons API docs and they have not mentioned how to switch between rendering things inline and a pop up. This is the how I've configured the SDK:

paypal.Buttons({
    enableStandardCardFields: true,
    locale: 'en_US',
    commit: true,
    style: {
      label: 'pay',
      layout: 'vertical',
      fundingicons: 'true'
    },
    funding: {
      allowed: [ paypal.FUNDING.CARD ]
    },
    onInit: function(data, actions) {
      actions.enable()
    },
    createOrder: function() {
      $('div.loading-container').append('<h2>Processing your payment...</h2>')
      return fetch('/create_order', {
        method: 'post',
        headers: {
          'content-type': 'application/json'
        }
      }).then(function(res) {
        return res.json();
      }).then(function(data) {
        return data.table.id;
      });
    },
    onCancel: function(data) {
      $('div.loading-container').empty()
      return;
    },
    onApprove: function(data) {
      return fetch('/capture_order', {
        method: 'post',
        headers: {
          'content-type': 'application/json'
        },
        body: JSON.stringify({
          orderID: data.orderID
        })
      }).then(function(res) {
        return res.json();
      }).then(function(details) {
        if (details.status == 400) {
          window.location.reload();
          return;
        }
        window.history.pushState({ urlPath:'/orders/thanks' }, "" , '/orders/thanks' );
        window.location.reload();
      })
    }
  }).render('div.paypal_container');

注意:您可以在此链接

推荐答案

黑色的借记卡"或信用卡"按钮总是内联呈现(例外:少数国家/地区未启用).大多数人都想要这个,并认为它很好.

The black Debit or Credit Card button always renders inline (exception: a few countries it isn't enabled for). Most people want this, and consider it nice.

没有办法让那个黑色按钮打开一个窗口.您可以禁用黑色按钮,只保留具有其他行为的普通 PayPal 按钮.

There's no way to make that black button open a window. You can disable the black button, leaving only the normal PayPal button, which has the other behavior.

这篇关于贝宝智能按钮集成问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆