将自定义参数添加到PayPal的智能按钮

问题描述

我正在与Paypal进行订阅,但是我尝试创建的自定义值并未从PayPal的IPN接收。

因此,我必须做错了什么。据我所知,我是在正确传递值吗?

这是我的代码,我正在尝试使用自己的值传递custom

  paypal.Buttons({
      style: {
          shape: 'rect',color: 'gold',layout: 'vertical',label: 'subscribe'
      },createSubscription: function(data,actions) {
        return actions.subscription.create({
            'plan_id': 'P-000','custom': 'custom value'  // the custom parameter attempt
        });
      },onApprove: function(data,actions) {
        alert(data.subscriptionID);
      }
  }).render('#paypal-button-container');

解决方法

该参数在此处记录为custom_idhttps://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions-create-request-body

诸如custom之类的未知参数名称将被忽略

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...