2012-06-21 36 views
0

我已成功集成CreateRecurringPaymentsProfile方法,該方法將向客戶端遞交付款。現在我需要做的是:定期付款paypal在數據庫中插入數據

在每月付款後,我需要在我的數據庫表中插入數據。付款完成後,我有沒有收到PayPal的回覆? 或者如何在每個時間段之後在我的數據庫中插入數據?

謝謝大家閱讀我的文章。我期待着您的發佈 - 任何建議都非常受歡迎。

問候, anstrangelover

回答

1

你需要尋找到的API,並且使得貝寶提供:

https://www.x.com/developers/paypal/products/instant-payment-notification

https://www.paypal.com/ipn

IPN可以發送通知這些交易:

Instant payments, including Express Checkout and direct credit card payments 
eCheck payments and pending, completed, or denied status payments 
Pending payments 
Recurring payments and subscriptions 
Authorizations 
Disputes, chargebacks, reversals, and refunds 
+0

感謝您UR後其真正的幫助:)。嗯,它會變得糟糕 – anstrangel0ver

0

我使用這個庫:http://codeigniter.com/wiki/PayPal_Lib/

它工作得很好了我。我創建了映射到表匹配我從IPN所需的字段的order_model,然後我就做,像這樣的方法的控制器:

function ipn(){ 
    $this->load->library("paypal_lib"); 
    $res = $this->paypal_lib->ipn(); 

    $response = print_r($res, TRUE); 
    log_message('error', $response); 

    if(isset($res["error"])) { 
     log_message('error', 'fail'); 
     return; 
    } 
    if($res["verified"]) { 
     log_message('error', 'verified'); 
     $res["payment"] = "paypal"; 
     $new_order = $this->order_model->create($res["data"]); 
     log_message('error', 'created order: '.$new_order['id']);   
    } else { 
     log_message('error', 'no error, but not verified?'); 
    } 
}