当前位置: 首页>>代码示例>>C#>>正文


C# Payment.createNewSubscriptionRedirectUrl方法代码示例

本文整理汇总了C#中Payment.createNewSubscriptionRedirectUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Payment.createNewSubscriptionRedirectUrl方法的具体用法?C# Payment.createNewSubscriptionRedirectUrl怎么用?C# Payment.createNewSubscriptionRedirectUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Payment的用法示例。


在下文中一共展示了Payment.createNewSubscriptionRedirectUrl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        // Enter the value from the 'App Key' field obtained at developer.att.com in your
        // app account.
        string clientId = "";

        // Enter the value from the 'App Secret' field obtained at developer.att.com
        // in your app account.
        string secretKey = "";

        // Set the fully-qualified domain name to: https://api.att.com
        string fqdn = "https://api.att.com";

        //Set the scope to Payment
        string scope = "Payment";

        // Create the service for requesting an OAuth access token.
        var oauth = new OAuth(fqdn, clientId, secretKey, scope);

        // Get the OAuth access token using Client Credential method.
        if (oauth.GetAccessToken(OAuth.AccessTokenType.ClientCredentials))
        {
            // Get access token
            OAuthToken at = new OAuthToken();
            string accessToken = at.getAccessToken(oauth.accessTokenJson);

            // Create the service for making the method request.
            var payment = new Payment(fqdn, accessToken);
            if (string.IsNullOrEmpty((string)Session["NewSubscription"]))
            {
                /// <summary>
                /// Create new subscription
                /// </summary>
                /// <param name="apiKey">apiKey</param>
                /// <param name="secretKey">secretKey</param>
                /// <param name="amount">amount</param>
                /// <param name="category">category</param>
                /// <param name="channel">channel</param>
                /// <param name="description">description</param>
                /// <param name="merchantTransactionId">merchantTransactionId</param>
                /// <param name="merchantProductId">merchantProductId</param>
                /// <param name="merchantRedirectURI">merchantRedirectURI</param>
                /// <param name="merchantSubscriptionId">merchantSubscriptionId</param>
                /// <param name="isPurchaseOnNoActiveSubscription">isPurchaseOnNoActiveSubscription</param>
                /// <param name="subscriptionRecurringNumber">subscriptionRecurringNumber</param>
                /// <param name="subscriptionRecurringPeriod">subscriptionRecurringPeriod</param>
                /// <param name="subscriptionRecurringPeriodAmount">subscriptionRecurringPeriodAmount</param>
                string redirectUrl = payment.createNewSubscriptionRedirectUrl(
                    clientId,
                    secretKey,
                    0.01,
                    3,
                    "MOBILE_WEB",
                    "description",
                    merchantTransactionId,
                    "merchantProductId000111",
                    "http://localhost/PaymentNewSubscription.aspx",
                    merchantSubscriptionId,
                    false,
                    99999,
                    "MONTHLY",
                    1);
                Session["NewSubscription"] = "created";
                //Response.Redirect(redirectUrl);
            }

            if ((Request["success"] != null) && Request.QueryString["success"].ToString() == "false")
            {
                errorCreateNew = new Dictionary<string, string>();

                foreach (String key in Request.QueryString.AllKeys)
                {
                    errorCreateNew.Add(key, Request.QueryString[key]);
                }
                throw new Exception(Request.QueryString["faultDescription"]);
            }

            if ((Request["SubscriptionAuthCode"] != null))
            {
                SubscriptionAuthCode = Request.QueryString["SubscriptionAuthCode"].ToString();
            }

            /// <summary>
            /// Call getSubscriptionStatus operation return getSubscriptionStatus object
            /// </summary>
            /// <param name="idType">idType</param>
            /// <param name="id">id</param>

            SubscriptionStatusResponseObj.RootObject getSubscriptionStatus =
                payment.getSubscriptionStatus("SubscriptionAuthCode", SubscriptionAuthCode);

            /// <summary>
            /// Call SubscriptionDetail operation return SubscriptionDetailResponse object
            /// </summary>
            /// <param name="MerchantSubscriptionId">MerchantSubscriptionId</param>
            /// <param name="ConsumerId">ConsumerId</param>

            SubscriptionDetailResponseObj.RootObject getSubscriptionDetail =
                payment.getSubscriptionDetail(getSubscriptionStatus.MerchantSubscriptionId,
                                                getSubscriptionStatus.ConsumerId);
//.........这里部分代码省略.........
开发者ID:venugec,项目名称:codekit-csharp,代码行数:101,代码来源:PaymentNewSubscription.aspx.cs


注:本文中的Payment.createNewSubscriptionRedirectUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。