duanqiao2006
2019-05-07 02:02
浏览 93
已采纳

在金额对象paypal 2019中添加值变量

I'm creating an order using paypal API. I need to put the value of an item inside the "amount" object, as is provided by the example code in the paypal page. The code is as follows:

paypal.Buttons({
    createOrder: function(data, actions) {
      // Set up the transaction
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '0.01'
          }
        }]
      });
    }
  }).render('#paypal-button-container');

I need to pass the value (currently shown as 0.01) from a select field that is inside a form above. I'm also concerned the security issues related with the front end ¿taking a variable from a form, storing into a variable and then pass it to an object could let the value exposed to being altered? I'm trying to find a flow where I jump from my form to a handler in php, but this step that paypal does in the front end calling paypal website and passing variables from the form doesn't suit me at all...

Maybe the flow "fill form- pass values to variables - pass variables to paypal object that does the call to paypal web" is not the adequate..

图片转代码服务由CSDN问答提供 功能建议

我正在使用paypal API创建订单。 我需要将项目的值放在“amount”对象中,如paypal页面中的示例代码所提供的那样。 代码如下:</ p>

  paypal.Buttons({
 createOrder:function(data,actions){
 //设置事务
返回actions.order  .create({
 purchase_units:[{
 amount:{
 value:'0.01'
} 
}] 
}); 
} 
})。render('#paypal-button-  container'); 
 </ code> </ pre> 
 
 

我需要从上面一个表单中的select字段传递值(当前显示为0.01)。 我还关注与前端相关的安全问题 - 从表单中获取变量,存储到变量中然后将其传递给对象可以让值暴露出来? 我正在尝试找到一个流程,我从我的表单跳转到php中的处理程序,但这一步,paypal在前端调用paypal网站并从表单中传递变量并不适合我... < / p>

也许流程“填写表格 - 将值传递给变量 - 将变量传递给PayPal对象,调用paypal web”并不足够.. </ p> </ div >

2条回答 默认 最新

相关推荐 更多相似问题