当用户订阅重复计费计划时,我想将唯一变量传递给PayPal。当我对返回成功网址的帖子执行协议时,我需要它们可用。
我可以使用Transaction.custom和Transaction.invoice_number进行单笔付款交易,但在“协议”类中找不到任何内容。
在将用户发送到PayPal之前,我会填充一个名称字段,但是当我从PayPal取回成功令牌时,该字段没有任何价值。他们基本上是杀死了它。
公共ActionResult购买(字符串planName) { var plan = activeBillingPlans.plans.FirstOrDefault(x => x.name == planName);
var startDate = DateTime.UtcNow.AddMonths(1);
var apiContext = Configuration.GetAPIContext();
var agreement = new Agreement()
{
//127 chars below
name = "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567",
description = plan.description,
start_date = startDate.ToString("yyyy-MM-ddTHH:mm:ssZ"),
plan = new Plan()
{
id = plan.id,
//name = "12345|12345678901234567890|12345678901234567890|12345678901234567890|12345678901234567890|12345678901234567890|12345678901234567890|12|12345678901234567890|12345|1234567890|12345678901234567890|1|1|12345678901234567890|12345678901234567890|0|0|0|1"
},
payer = new Payer()
{
payment_method = "paypal"
}
};
//send agreement to PayPal
var createdAgreement = agreement.Create(apiContext);
var approvalUrl = createdAgreement.links.FirstOrDefault(
x => x.rel.Equals("approval_url", StringComparison.OrdinalIgnoreCase));
return Redirect(approvalUrl.href);
}
public ActionResult Success(string token)
{
var apiContext = Configuration.GetAPIContext();
var agreement = new Agreement()
{
token = token
};
var executedAgreement = agreement.Execute(apiContext);
return View();
}
我需要一个变量来保存我最初提供的数据以恢复发布。