【问题标题】:Retrieving IPP access token and access secret from paypal callback从贝宝回调中检索 IPP 访问令牌和访问密码
【发布时间】:2014-08-24 01:05:41
【问题描述】:

我有一个使用标准贝宝购物车的网络应用。我们想要做的是,当 paypal 通知我们的网站付款已完成时,使用 Intuit QB API 自动在 QB 中在线记录付款。

我看到的获取访问令牌和秘密的示例是用户启动的。我怎样才能在这个贝宝回调的上下文中得到这些?我需要它们自动发生,并且没有来自用户的请求上下文。我在这里有一些基本的测试代码,它们在 paypal 回调中运行。

//start a transaction
//start try block            
//set our transaction record as paid
Token = ConfigurationManager.AppSettings["appToken"];
        string consumerKey = ConfigurationManager.AppSettings["consumerKey"];
        string consumerSecret = ConfigurationManager.AppSettings["consumerSecret"];
        string companyID = ConfigurationManager.AppSettings["companyID"];
        string accessToken = "??????";
        string accessSecret = "?????";

        OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessSecret, consumerKey, consumerSecret);
        ServiceContext context = new ServiceContext(appToken, companyID, IntuitServicesType.QBO, oauthValidator);
        DataService service = new DataService(context);
        Customer customer = new Customer();
        //just a test example. without missing tokens, i don't get here.
        customer.GivenName = "Mary";
        customer.Title = "Ms.";
        customer.MiddleName = "Jayne";
        customer.FamilyName = "Cooper";
        Customer resultCustomer = service.Add(customer) as Customer;
//complete transaction
//catch {rollback transaction}

【问题讨论】:

    标签: paypal oauth intuit-partner-platform


    【解决方案1】:

    没有自动方式从您的应用程序中获取访问令牌和密钥。 您需要第一次使用用户交互(C2QB-连接到 Quickbooks)生成它们,然后保存它们以供将来使用。这些令牌的有效期为 6 个月,之后您必须调用 Reconnect api 来更新令牌或再次进行 C2QB 交互以获取新令牌。 https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0030_integrate_your_app/disconnecting_from_quickbooks/0050_how_to_reconnect

    【讨论】:

      猜你喜欢
      • 2013-12-01
      • 2016-06-10
      • 2021-11-10
      • 2021-05-11
      • 2011-12-31
      • 1970-01-01
      • 2012-04-28
      • 1970-01-01
      • 2018-02-01
      相关资源
      最近更新 更多