简体   繁体   English

成功交易后如何从PayPal获取收据号

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

I have just referred this link http://www.geeksblood.com/integrate-paypal-in-asp-net/ . 我刚刚引用了此链接http://www.geeksblood.com/integrate-paypal-in-asp-net/ This code works fine with successful transaction PayPal shows receipt number. 此代码与成功的交易PayPal显示收据编号一起正常工作。 I want to store the receipt number in the database, so how do I get receipt number from 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);

}

You should look for this topic "How to process Instant Payment Notification (IPN) messages" 您应该寻找主题“如何处理即时付款通知(IPN)消息”

As document https://developer.paypal.com/docs/classic/ipn/ht_ipn/ 作为文档https://developer.paypal.com/docs/classic/ipn/ht_ipn/

IPN is a message service that sends you a notification when any type of transaction occurs in your account. IPN是一种消息服务,当您的帐户中发生任何类型的交易时,都会向您发送通知。 The messages are received and processed by your server(s). 邮件由您的服务器接收和处理。

and C# example https://github.com/paypal/ipn-code-samples/blob/master/C%23/paypal_ipn_mvc.cs 和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
    }
}

A Sample IPN Message and Response https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/#a-sample-ipn-message-and-response 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.

相关问题 如何从贝宝账户获取交易信息 - how to get transaction information from paypal account 支付成功后如何等待paypal回复? - how to wait for the response from paypal after the payment is successful? 成功交易后如何从Payment Gateway API中读取发布参数 - How to read Post Parameters from Payment Gateway API After Successful Transaction 成功付款后,从Paypal网站获取交易ID到我的网站 - Get the Transaction ID from Paypal website to my web site after succesful payment 如何在asp.net mvc C#中使用paypal交易的交易ID获取交易详情? - How to get transaction details using transaction ID of a paypal transaction in asp.net mvc C#? 如何知道交易范围是否成功 - How to know if transaction scope was successful or not 如果它是销售收据的一部分,您如何从Quickbooks交易中找到付款行的TxnLineID? - How do you find the TxnLineID of a payment line from a Quickbooks transaction if it is part of a Sales Receipt? 如何使用 ASP.Net 和 C# 从 Paypal 支付网关的返回 URL 中获取交易详细信息 - How to Get Transaction Details from return URL from Paypal Payment Gateway using ASP.Net and C# "成功创建费用后按 ID 获取余额的 Stripe Connect “没有此类余额交易:txn_”" - Stripe Connect "No such balance transaction: txn_" on Get Balance by Id after Successful Charge Creation 在Xamarin.Z6450242531912981C668A3应用程序支付成功后,如何从WebView获得退货URL? - How to get return URL from WebView after successful payment in Xamarin.Forms app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM