簡體   English   中英

成功交易后如何從PayPal獲取收據號

[英]How to get receipt number from PayPal after the successful transaction

我剛剛引用了此鏈接http://www.geeksblood.com/integrate-paypal-in-asp-net/ 此代碼與成功的交易PayPal顯示收據編號一起正常工作。 我要將收據編號存儲在數據庫中,因此如何從PayPal獲取收據編號。

[HttpPost]
public void Plans(UserRegistreModel model)
{
        string ramount = Convert.ToString(model.Amount);
        TempData["model"] = model;
        string redirecturl = "";
        string firstName = model.FirstName;
        //string amount = Convert.ToString(model.Amount);
        //string productInfo = "HRMS";
        string itemInfo = "test";
        string email = model.Email;
        string phone = model.Contact;
        string middleName = model.MiddleName;
        string lastName = model.LastName;
        string Noofemp = model.NoOfEmployees;
        string FirmName = model.FirmName;
        string price = model.price;
        string package = model.package;
        string amount = Convert.ToString(model.Amount);
        redirecturl += "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" +
        ConfigurationManager.AppSettings["paypalemail"].ToString();
        TempData["message"] = model.Payment;
        //First name i assign static based on login details assign this value
        redirecturl += "&first_name=" + firstName;

        //Product Name
        redirecturl += "&amount=" + amount;

        //Phone No
        redirecturl += "&night_phone_a=" + phone;

        //Product Name
        redirecturl += "&item_name=" + itemInfo;

        //Address
        redirecturl += "&email=" + email;
        //Business contact id
        //redirecturl += "&business=ritesh4714-facilitator@gmail.com";

        //Shipping charges if any
        //redirecturl += "&shipping=0";

        //Handling charges if any
        //redirecturl += "&handling=0";

        //Tax amount if any
        //redirecturl += "&tax=0";

        //Add quatity i added one only statically
        //redirecturl += "&quantity=1";

        //Success return page url
        redirecturl += "&return=" + ConfigurationManager.AppSettings["SuccessURL"].ToString();

        //Failed return page url
        redirecturl += "&cancel_return=" + ConfigurationManager.AppSettings["FailedURL"].ToString();

        Response.Redirect(redirecturl);

}

您應該尋找主題“如何處理即時付款通知(IPN)消息”

作為文檔https://developer.paypal.com/docs/classic/ipn/ht_ipn/

IPN是一種消息服務,當您的帳戶中發生任何類型的交易時,都會向您發送通知。 郵件由您的服務器接收和處理。

和C#示例https://github.com/paypal/ipn-code-samples/blob/master/C%23/paypal_ipn_mvc.cs

private void ProcessVerificationResponse(string verificationResponse)
{
    if (verificationResponse.Equals("VERIFIED"))
    {
        // check that Payment_status=Completed
        // check that Txn_id has not been previously processed
        // check that Receiver_email is your Primary PayPal email
        // check that Payment_amount/Payment_currency are correct
        // process payment
    }
    else if (verificationResponse.Equals("INVALID"))
    {
        //Log for manual investigation
    }
    else
    {
        //Log error
    }
}

IPN消息和響應示例 https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/#a-sample-ipn-message-and-response

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM