Paypal 将自定义变量传递给订阅按钮

问题描述 投票:0回答:1

我试图弄清楚在申请订阅我创建的网络服务时如何传递自定义变量; 到目前为止,我的前端代码如下所示:

const createSubscription = (data, actions) => {
    return actions.subscription.create({
        'plan_id': 'P-XXXXXXXXXXX',
        "custom": "This is data from custom field",
        "custom_id": "This is data from custom_id field"
    });
};

但是当我的客户获得批准后,IPN 向我的后端服务器发送通知,根本没有

custom_id
custom
字段:

{
  mc_gross: '100.00',
  outstanding_balance: '0.00',
  period_type: ' Regular',
  next_payment_date: '03:00:00 Mar 17, 2021 PDT',
  protection_eligibility: 'Eligible',
  payment_cycle: 'Monthly',
  address_status: 'confirmed',
  tax: '0.00',
  payer_id: 'HXRWYDXHYFZN8',
  address_street: '1 Main St',
  payment_date: '10:45:14 Feb 17, 2021 PST',
  payment_status: 'Completed',
  product_name: 'Monthly Plan',
  charset: 'UTF-8',
  recurring_payment_id: 'I-F2C2YTJU2E1U',
  address_zip: '95131',
  first_name: 'John',
  mc_fee: '3.20',
  address_country_code: 'US',
  address_name: 'John Doe',
  notify_version: '3.9',
  amount_per_cycle: '100.00',
  payer_status: 'verified',
  currency_code: 'USD',
  business: '[email protected]',
  address_country: 'United States',
  address_city: 'San Jose',
  verify_sign: 'AwvhmU0vP2FlU28Jc6pBhDPQLGvKAuK1SbOO3rAWZruMDt8v8SJ',
  payer_email: '[email protected]',
  initial_payment_amount: '0.00',
  profile_status: 'Active',
  amount: '100.00',
  txn_id: '7M8958705N109551P',
  payment_type: 'instant',
  last_name: 'Doe',
  address_state: 'CA',
  receiver_email: '[email protected]',
  payment_fee: '3.20',
  receiver_id: '5CCP2BYDNEBQE',
  txn_type: 'recurring_payment',
  mc_currency: 'USD',
  residence_country: 'US',
  test_ipn: '1',
  transaction_subject: 'Monthly Plan',
  payment_gross: '100.00',
  shipping: '0.00',
  product_type: '1',
  time_created: '10:44:22 Feb 17, 2021 PST',
  ipn_track_id: 'bee6f9133b8f'
}

有什么方法可以传递一些额外的信息,以便我可以更新后端的记录?

PS。请注意,这是

createSubscription
不是
createOrder
或类似的东西。

javascript paypal paypal-ipn
1个回答
1
投票
  1. custom_id
    正确的参数名称

  2. 您可能只会在 webhook 事件通知中收到它,而不是 IPN(这是一项非常古老的服务,不适合与当前的 API 一起使用)

  3. 最好的解决方案是从您的服务器创建订阅。 这里的答案以及它链接的其他答案以获取一些信息。

© www.soinside.com 2019 - 2024. All rights reserved.