繁体   English   中英

ASP.Net核心:PayPal结账端点

[英]ASP.Net Core: PayPal checkout endpoint

我一直在互联网上搜索如何在ASP.Net Core网站上添加PayPal支付终端,但不幸的是,所有可用的资源都建议使用.Net核心不支持的PayPal SDK库,或提供极长,无用的还有不完整的故事,其中包含许多缺失的部分,例如我发布付款请求的API的实际网址(或可能的示例)。

我在这个问题中要求的只是基本信息,例如我必须与之通信的API的实际URL以及我必须传递给该API的参数以及我可能获得的响应示例(不是寻找实施)。 我一直无法找到这些信息。

您需要以以下格式传递变量:

private void PayPal()
{
    string _MerchantEmail = "youremailwithpaypal@domain.com";
    string _ReturnURL = "https://www.yourwebsite.com/paymentsuccess";
    string _CancelURL = "https://www.yourwebsite.com/paymentfailed";
    string _CurrencyCode = "USD";
    int _Amount = 100;
    string _ItemName = "itme1"; //We are using this field to pass the order number
    int _Discount = 10;
    double _Tax = 1.5;
    string _PayPalURL = $"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business={_MerchantEmail}&return={_ReturnURL}&cancel_return={_CancelURL}&currency_code={_CurrencyCode}&amount={_Amount}&item_name={_ItemName}&discount_amount={_Discount}&tax={_Tax}";

    Response.Redirect(_PayPalURL);
}

您可能还需要PayPal IPN的回调网址来验证付款状态。 但是对于上面的问题,这应该可行,因为我们已经在我们的网站上使用此代码。

暂无
暂无

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

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