c# - 具有初始金额的定期 paypal 付款的空引用

标签 c# asp.net paypal paypal-sandbox

我正在尝试创建定期付款资料。我能够成功创建订阅。现在我想创建首付款订阅。我添加了以下代码:

    CurrencyCodeType currency = (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), "USD");
    BasicAmountType intialPaymentAmount = new BasicAmountType(currency, "4000");
    scheduleDetails.ActivationDetails.InitialAmount = intialPaymentAmount;

但是上面这段代码抛出空引用对象错误。

这确实给我带来了错误:

scheduleDetails.ActivationDetails.InitialAmount = intialPaymentAmount;

但在 Debug模式下,intialPaymentAmount 中包含所有内容。

我做错了什么?

最佳答案

这样我就解决了问题

        BasicAmountType intialPaymentAmount = new BasicAmountType(currency, "4000");
        ActivationDetailsType acd = new ActivationDetailsType();
        acd.InitialAmount = intialPaymentAmount;
        acd.FailedInitialAmountAction = FailedPaymentActionType.CANCELONFAILURE;
        scheduleDetails.ActivationDetails = acd;

关于c# - 具有初始金额的定期 paypal 付款的空引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27740232/

相关文章:

c# - 使用 RabbitMQ 的 .NET Core 微服务

c# - 事件循环

c# - 写入内存映射文件比非内存映射文件慢

c# - 如何计算 XML 中具有相同 innertext 值的节点数

c# - 身份:为什么 user.roles 是空的?

ruby - 从另一个调用一个 Ruby 脚本

php - Paypal 登录 session 然后将其保存以便更快地结帐

c# - 基于流获取数据

asp.net - 如何在 asp.net 中存储参数以便与 sql 一起使用?

php - 如何在 paypal php rest api 沙盒模式下退还销售金额