- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
注意:这篇文章中提到的所有代码都在沙箱中,而不是在实时环境中。
我将 CreateRecurringPaymentsProfile API 与 .Net SDK 结合使用,为订阅创建定期付款配置文件。虽然我可以使用下面的代码片段在买家使用信用卡时创建定期配置文件,但是当买家使用 PayPal 帐户时我不能这样做。我在 Merchant Net SDK 中找不到任何属性来指定买家拥有 PayPal 帐户。
问题:如何使用 Merchant SDK 使用 CreateRecurringPaymentsProfile API 为 PayPal 买家帐户而不是信用卡创建订阅配置文件?
CreateRecurringPaymentsProfile API 与使用 Merchant Net SDK 的信用卡
CreateRecurringPaymentsProfileReq createRecurringPaymentsProfile = new CreateRecurringPaymentsProfileReq();
CreateRecurringPaymentsProfileRequestType createRecurringPaymentsProfileRequest = new CreateRecurringPaymentsProfileRequestType();
RecurringPaymentsProfileDetailsType recurringPaymentsProfileDetails
= new RecurringPaymentsProfileDetailsType("2016-06-02T16:55:19+00:00");
BasicAmountType billingAmount = new BasicAmountType(CurrencyCodeType.USD, "3.00");
BillingPeriodDetailsType paymentPeriod = new BillingPeriodDetailsType(BillingPeriodType.DAY, Convert.ToInt32("5"), billingAmount);
ScheduleDetailsType scheduleDetails = new ScheduleDetailsType("description", paymentPeriod);
CreateRecurringPaymentsProfileRequestDetailsType createRecurringPaymentsProfileRequestDetails
= new CreateRecurringPaymentsProfileRequestDetailsType(recurringPaymentsProfileDetails, scheduleDetails);
CreditCardDetailsType creditCard = new CreditCardDetailsType();
creditCard.CreditCardType = CreditCardTypeType.VISA;
creditCard.CreditCardNumber = "5261193281604310";
creditCard.CVV2 = "235";
creditCard.ExpMonth = Convert.ToInt32("12");
creditCard.ExpYear = Convert.ToInt32("2016");
createRecurringPaymentsProfileRequestDetails.CreditCard = creditCard;
createRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = createRecurringPaymentsProfileRequestDetails;
createRecurringPaymentsProfile.CreateRecurringPaymentsProfileRequest = createRecurringPaymentsProfileRequest;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
responseCreateRecurringPaymentsProfileResponseType
= service.CreateRecurringPaymentsProfile(createRecurringPaymentsProfile);
最佳答案
答案是不能在 CreateRecurringPaymentsProfile API 中将付款人指定为 PayPal 账户持有人。但是,此 API 仍可用于为 PayPal 帐户持有人创建订阅,如下所述。
要使用 CreateRecurringPaymentsProfile
API 通过现有的 PayPal 帐户而不是信用卡创建订阅,需要遵循一个多步骤过程。 第一步是调用 SetExpressCheckout 将 BillingAgreementDetailsType 指定为 RecurringPayments,然后重定向到此 URL (https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express -checkout
) 传递 token 以响应 SetExpressCheckout API。
ReturnURL
中指定的页面CancelURL
。第二步是在 SetExpressCheckout API 调用中指定的 ReturnURL 页面中调用 CreateRecurringPaymentsProfile
并将在步骤 1 之后收到的 token 传递给它(从传递给 ReturnUrl 的查询字符串参数中获取)在第 1 步)。当您将 token 传递给此 API 时,您不应指定任何信用卡详细信息。此步骤将导致从在第 1 步中接受订阅的用户的 PayPal 帐户支付订阅费用。
调用 SetExpressCheckout 并将用户重定向到 PayPal 的代码
protected void btnSubmit_Click(object sender, EventArgs e) {
string token = null;
SetExpressCheckoutResponseType response = SetExpressCheckoutAPIOperation();
if (response.Token == null) {
txtLog.Text = "There was some issue with calling SetExpressCheckout API. Please review the failure message that should also be printed in this textbox.";
} else {
token = response.Token;
Response.Redirect("https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + Server.UrlEncode(token));
}
}
public SetExpressCheckoutResponseType SetExpressCheckoutAPIOperation() {
// Create the SetExpressCheckoutResponseType object
SetExpressCheckoutResponseType responseSetExpressCheckoutResponseType = new SetExpressCheckoutResponseType();
try {
SetExpressCheckoutRequestDetailsType setExpressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType();
BillingAgreementDetailsType baType = new BillingAgreementDetailsType(BillingCodeType.RECURRINGPAYMENTS);
baType.BillingAgreementDescription = "Gold Carrier";
billingAgreementDescription = baType.BillingAgreementDescription;
setExpressCheckoutRequestDetails.BillingAgreementDetails.Add(baType);
// URL to which the buyer's browser is returned after choosing to pay
// with PayPal.
setExpressCheckoutRequestDetails.ReturnURL = "http://www.myexample.com/completed.aspx";
// URL to which the buyer is returned if the buyer does not approve the
// use of PayPal to pay you.
setExpressCheckoutRequestDetails.CancelURL = "http://www.myexample.com/canceled.aspx";
SetExpressCheckoutReq setExpressCheckout = new SetExpressCheckoutReq();
SetExpressCheckoutRequestType setExpressCheckoutRequest = new SetExpressCheckoutRequestType(setExpressCheckoutRequestDetails);
setExpressCheckout.SetExpressCheckoutRequest = setExpressCheckoutRequest;
Dictionary < string, string > configurationMap = new Dictionary < string, string > ();
configurationMap.Add("mode", "sandbox");
// Signature Credential
configurationMap.Add("account1.apiUsername", "******");
configurationMap.Add("account1.apiPassword", "*******");
configurationMap.Add("account1.apiSignature", "********");
configurationMap.Add("account1.applicationId", "******");
// Create the service wrapper object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
// # API call
responseSetExpressCheckoutResponseType = service.SetExpressCheckout(setExpressCheckout);
}
// # Exception log
catch (System.Exception ex) {
// Log the exception message
}
return responseSetExpressCheckoutResponseType;
}
ReturnURL 中用于调用 CreateRecurringPaymentProfile API 的代码
protected void Page_Load(object sender, EventArgs e) {
if (!string.IsNullOrWhiteSpace(Request.QueryString["token"])) {
token = Server.UrlDecode(Request.QueryString["token"]);
CreateRecurringPaymentProfile();
}
}
private void CreateRecurringPaymentProfile() {
CreateRecurringPaymentsProfileResponseType responseCreateRecurringPaymentsProfileResponseType = new CreateRecurringPaymentsProfileResponseType();
try {
CreateRecurringPaymentsProfileReq createRecurringPaymentsProfile = new CreateRecurringPaymentsProfileReq();
CreateRecurringPaymentsProfileRequestType createRecurringPaymentsProfileRequest = new CreateRecurringPaymentsProfileRequestType();
RecurringPaymentsProfileDetailsType recurringPaymentsProfileDetails
= new RecurringPaymentsProfileDetailsType(string.Format("{0}{1}", DateTime.UtcNow.ToString("s"), "Z"));
// Billing amount for each billing cycle during this payment period.
BasicAmountType billingAmount = new BasicAmountType(CurrencyCodeType.USD, "3.00");
BillingPeriodDetailsType paymentPeriod = new BillingPeriodDetailsType(BillingPeriodType.DAY, Convert.ToInt32("5"), billingAmount);
ScheduleDetailsType scheduleDetails = new ScheduleDetailsType(this.billingAgreementDescription, paymentPeriod);
CreateRecurringPaymentsProfileRequestDetailsType createRecurringPaymentsProfileRequestDetails
= new CreateRecurringPaymentsProfileRequestDetailsType(recurringPaymentsProfileDetails, scheduleDetails);
// Either EC token or a credit card number is required.If you include
CreditCardDetailsType creditCard = new CreditCardDetailsType();
if (string.IsNullOrEmpty(token)) {
creditCard.CreditCardType = CreditCardTypeType.VISA;
creditCard.CreditCardNumber = "5261193281604310";
creditCard.CVV2 = "235";
creditCard.ExpMonth = Convert.ToInt32("12");
creditCard.ExpYear = Convert.ToInt32("2016");
createRecurringPaymentsProfileRequestDetails.CreditCard = creditCard;
} else //we are using a PayPal email account i.e. not a credit card but a PayPal account to set up the subscription
{
createRecurringPaymentsProfileRequestDetails.Token = token;
}
createRecurringPaymentsProfileRequest.CreateRecurringPaymentsProfileRequestDetails = createRecurringPaymentsProfileRequestDetails;
createRecurringPaymentsProfile.CreateRecurringPaymentsProfileRequest = createRecurringPaymentsProfileRequest;
Dictionary < string, string > configurationMap = new Dictionary < string, string > ();
configurationMap.Add("mode", "sandbox");
// Signature Credential
configurationMap.Add("account1.apiUsername", "*****");
configurationMap.Add("account1.apiPassword", "*****");
configurationMap.Add("account1.apiSignature", "*****");
configurationMap.Add("account1.applicationId", "*****");
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
responseCreateRecurringPaymentsProfileResponseType
= service.CreateRecurringPaymentsProfile(createRecurringPaymentsProfile);
}
// # Exception log
catch (System.Exception ex) {
// Log the exception message
}
}
关于c# - 使用 CreateRecurringPaymentsProfile API 时如何指定 PayPal 买家帐户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37603355/
如果我的交易中的次要收款人没有 Paypal 帐户,会发生什么情况。他会收到要求他创建 Paypal 帐户的通知,还是 API 调用不会成功? 我几乎无法知道销售服务的用户在注册我的平台时是否有Pay
我们知道有这么多的支付网关服务提供商,即 Paypal ,moneybrookers,authorize.net以及许多国内和国际的支付网关提供商。现在,我的问题是,开发我们自己的支付网关服务以处理世
我们正在寻求替代我们对 Authorize.net 的使用。我花了很多时间查看 PayPal 文档,但找不到我的问题的明确答案: 使用 thousand 数十种不同的 PayPal API 可以在我们
我实际上是在为客户工作。我已经在网站上成功实现了 paypal pro,并且一切正常,我相信我遵循了他们的流程和指南,使它按照他们的意思工作。 因此,我一直在阅读 this webpage将网站投入生
我有2件商品要出售。我的运输底价为7.50美元,每增加一个项目,则为2.00美元 我已经设置了高级代码 运费= $ 7.50 运费2 = $ 2.00 一切正常,除非在购物车中添加了其他商品后,购物车
我想在不使用购物车的情况下实现一个不太复杂的解决方案。 我在自己对这个问题的回答中详细说明了解决方案,但如果有人能提出更好的方法,我会很高兴。 谢谢 最佳答案 实际上我最近不得不这样做。毫无疑问,我的
我创建了一个带有默认支付网关的shopify 小商店,即paypal express checkout。 当客户点击 Paypal 结帐按钮时,他们被要求输入他们的信用卡号并输入电子邮件并选择密码以注
一段时间以来,我一直在运行一个网站,该网站通过向 Paypal 网站发送一个 notify_url 来记录 Paypal 交易,并监听该 notify_url。我的监听页面解析从 paypal 发送的
我在网络应用程序中使用 PayPal Subscribe 按钮。我想将订阅开始日期传递给 PayPal,这不会总是今天的日期。 通常情况下,如果没有有效订阅,PayPal 会创建一个从今天开始的订阅。
大家好,我遇到了“立即购买”paypal 按钮这个令人沮丧的问题。 我希望我的客户能够通过 paypal 使用借记卡/信用卡付款,而无需创建 paypal 帐户,同时我希望能够根据产品类型将不同的定价
我想实现 paypal 授权并自动获取付款。我用过 Paypal 标准账户。我已发送带有授权参数的付款请求。
我想在我的 Paypal 沙盒账户中测试批量支付。根据 paypal 文档,它描述了将资金转移到 paypal 帐户的步骤。但我想转账到我客户的银行账户。我该怎么做? 仅供引用:PayPal 文档内容
我正在尝试登录我的沙盒帐户(使用 chrome),但由于 paypal 的新变化我不能。 Paypal 现在要求我登录开发者网站。我愿意。 然后我转到应用程序->沙盒帐户,然后按“sanbox 站点”
我有一个支持 Paypal 付款的 opencart 系统。是否有允许用户(信用卡)付款而无需强制注册 Paypal 帐户的选项。到目前为止,我使用的是 paypal 标准模块。 最佳答案 使用 Pa
我可以使用 Paypal ID 和密码使用 Paypal 详细信息进行付款而无需重定向到 Paypal 网站吗?我想在不离开我的网站的情况下完成所有付款流程。谢谢 最佳答案 您可以使用 PayFlow
当我尝试 https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamicimage 时,图像损坏了. 这是返回的错误信息: “尝试为应用程序构建 prote
我想向我的客户付款,为此我收到了他们的电子邮件,我想验证电子邮件地址是否存在于 paypal 中! 我搜索并找到了我尝试过的支付身份 API,但它只提供了我的我的数据!这是 LINK那个 API。 我
当从用户的 PayPal 账户中扣款时,PayPal 服务器在一定时间内没有响应(超时)。我们决定假设钱确实已经被拿走了,所以我们会退款。但是,如果钱没有从用户账户中扣除会怎样? PayPal返回什么
我有一个网站可以定期(比如每周一次)从客户那里收到钱。我将我的客户详细信息存储在我的数据库中,我想从我的客户帐户中提取资金,而不是每次都提示他们进行身份验证。金额会因客户而异。我怎样才能用 pay p
我有一个表格,其中一个团队签下他们的球员,然后被运送到 Paypal 进行注册付款,然后当一切都完成后我会收到一个 IPN。我正在做一个类似的表格,发现自从我创建该表格以来,Paypal 发生了很大变
我是一名优秀的程序员,十分优秀!