php - Paypal 定期付款 lionite

标签 php paypal recurring-billing

我正在使用 Lionite PayPal处理 PayPal 定期付款的类,但是我似乎没有通过 IPN 获得我设置的自定义变量。

我是这样进行快速结账的:

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

如果他们完成购买,他们将被重定向到我创建订阅配置文件的订阅页面: $date = date('c', strtotime('+1 months'));//下个月开始

$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);

之后,我收到了 txn_type 为 recurring_payment_profile_created 的 IPN,但缺少自定义变量。有什么想法吗?我应该如何跟踪我的哪些用户注册了订阅?

编辑: 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
)

谢谢

最佳答案

您的代码似乎是正确的。我也在我的系统上使用定期付款测试了这一点,自定义变量似乎没有在 IPN 中发回。我建议在 www.paypal.com/mts 上使用 PayPal MTS 打开一张票,以解决可能存在的错误。这样一来,通过提交工单,您也会在问题得到解决后收到通知。

关于php - Paypal 定期付款 lionite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15143342/

相关文章:

php - apache 停止响应然后崩溃

php - 如何收到paypal付款确认?

wordpress - 以编程方式创建交易成员(member)

clojure - 使用 Clojure Web 堆栈进行定期计费的轻量级库?

php - fputcsv 在字段末尾添加奇怪的字符

php - 使用 Laravel 插入延迟

php - 注意 : Undefined variable: table in C:\XAMPP\htdocs\progscores. php 第 27 行

php - Paypal IPN - 如何在监听器中获取 option_selection 的值?

c# - 我在调用 SetExpressCheckout 方法时得到对象引用未设置为对象的实例

paypal - 通过 PayPal 和信用卡付款并定期付款