简体   繁体   English

Paypal经常性支付的狮子座

[英]Paypal recurring payments lionite

I'm using the Lionite PayPal class to handle PayPal recurring payments, however I don't seem to be getting the custom variable I set, through the IPN. 我正在使用Lionite PayPal类处理PayPal定期付款,但我似乎没有通过IPN获取我设置的自定义变量。

This is how I go through the express checkout: 这就是我通过快速结账的方式:

$item = array(
    'subscription_description' => 'Monthly ' . $plan['title'] . ' subscription',
    'cost' => $plan['price'],
);
$options = array(
    'return' => $this->base . 'action/subscription/', // Confirmation URL
    'cancel' => $this->base . 'action/cancel/', // Cancellation URL
    'cost' => $plan['price'],
    'item_cost' => $plan['price'],
    'custom' => 999 //config('user:id')
);

$result = $this->paypal->getCheckoutUrl($options, $item);

if (is_string($result)) {
    //Redirection URL generated successfully! redirecting to Paypal
    header('Location: ' . $result);
}

if they complete the purchase they get redirected to my subscription page where I create the subscription profile: $date = date('c', strtotime('+1 months')); 如果他们完成购买,他们会被重定向到我的订阅页面,我在其中创建订阅配置文件:$ date = date('c',strtotime('+ 1 months')); //start next month //从下个月开始

$profile = array(
    'period' => 'Month', // Subscription Period
    'frequency' => 1, // Frequency x period equals 1 billing cycle (up to 1 year)
    'total_cycles' => 12, // End profile after 1 year (12 cycles)
    // Regular subscription amount
    'start_date' => $date, // Profile start date
    'currency' => 'USD' // Payment currency
);

//select user info
$user = $this->Db->selectOne(array('id' => config('user:id')), 'users');

//get user's plan
$plan = $this->Db->selectOne(array('id' => $user['plan']), 'plans');

$profile['cost'] = $profile['init_amount'] = $plan['price'];
$profile['desc'] = 'Monthly ' . $plan['title'] . ' subscription';

$profileId = $this->paypal->createRecurringProfile($profile);

After that I receive the IPN with the txn_type of recurring_payment_profile_created but the custom variable is missing.. Any ideas? 之后我收到了带有recurring_payment_profile_created的txn_type的IPN,但缺少自定义变量..有什么想法吗? How am I supposed to track which of my users signed up for the subscription? 我该如何跟踪我的哪些用户注册订阅?

Edit: The IPN message 编辑: IPN消息

Array
(
    [payment_cycle] => Monthly
    [txn_type] => recurring_payment_profile_created
    [last_name] => Bernotas
    [initial_payment_status] => Completed
    [next_payment_date] => 03:00:00 Mar 28, 2013 PDT
    [residence_country] => GB
    [initial_payment_amount] => 0.01
    [currency_code] => USD
    [time_created] => 08:52:45 Feb 28, 2013 PST
    [verify_sign] => xxxx
    [period_type] =>  Regular
    [payer_status] => verified
    [tax] => 0.00
    [payer_email] => xxxx
    [first_name] => Ignas
    [receiver_email] => xxxx
    [payer_id] => xxxx
    [product_type] => 1
    [initial_payment_txn_id] => xxxx
    [shipping] => 0.00
    [amount_per_cycle] => 0.01
    [profile_status] => Active
    [charset] => windows-1252
    [notify_version] => 3.7
    [amount] => 0.01
    [outstanding_balance] => 0.00
    [recurring_payment_id] => xxxxx
    [product_name] => Monthly Basic subscription
    [ipn_track_id] => xxx
)

Thanks 谢谢

The code you have appears to be correct. 您拥有的代码似乎是正确的。 I tested this as well with recurring payments on my system, and the custom variable does not appear to be getting sent back in the IPN. 我在我的系统上对经常性付款进行了测试,并且自定义变量似乎没有被发送回IPN。 I would suggest opening up a ticket with PayPal MTS at www.paypal.com/mts for a possible bug with this. 我建议您在www.paypal.com/mts上打开PayPal MTS的机票,以了解可能的错误。 This way, by opening up a ticket you will also be notified once the issue is resolved. 这样,通过打开票证,您将在问题解决后收到通知。

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

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