简体   繁体   English

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

[英]Paypal pass custom variable to subscription button

I am trying to figure out how to pass custom variable when applies for a subscription for the webservice I have created;我想弄清楚在申请订阅我创建的网络服务时如何传递自定义变量; So far my code on front end looks like this:到目前为止,我在前端的代码如下所示:

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"
    });
};

But when my client is approved, IPN sends notification to my back end server, there is no field of custom_id or custom at all:但是当我的客户端被批准时,IPN 向我的后端服务器发送通知,根本没有custom_idcustom字段:

{
  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: 'sb-w7647v5112246@business.example.com',
  address_country: 'United States',
  address_city: 'San Jose',
  verify_sign: 'AwvhmU0vP2FlU28Jc6pBhDPQLGvKAuK1SbOO3rAWZruMDt8v8SJ',
  payer_email: 'sb-oettb5109886@personal.example.com',
  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: 'sb-w7647v5112246@business.example.com',
  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'
}

Is there any way to pass some extra information so that I could update record on my backend?有没有办法传递一些额外的信息,以便我可以在后端更新记录?

PS.附言。 Please pay attention, this is createSubscription not createOrder or something like that.请注意,这是createSubscription而不是createOrder或类似的东西。

  1. custom_id is the correct value custom_id正确的值

  2. It's possible you will only receive it in webhook event notifications , rather than IPN (which is a very old service and not intended to be used with current APIs)您可能只会在webhook event notifications中收到它,而不是 IPN(这是一项非常古老的服务,不打算与当前的 API 一起使用)

  3. The best solution would be to create and activate the subscription from your server.最好的解决方案是从您的服务器创建并激活订阅。 The answer here and other answers it links to have some information. 这里的答案和它链接的其他答案有一些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM