paypal - 从 paypal 回调中检索 IPP 访问 token 和访问 secret

标签 paypal oauth intuit-partner-platform

我有一个使用标准 Paypal 购物车的网络应用程序。我们要做的是当 paypal 通知我们的网站支付已经完成时,使用 Intuit QB API 自动在 QB online 中记录支付。

我看到的获取访问 token 和 secret 的示例是用户启动的。我怎样才能在这个 Paypal 回调的上下文中得到这些?我需要它们自动发生,并且没有来自用户的请求上下文。我这里有一些在 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}

最佳答案

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

关于paypal - 从 paypal 回调中检索 IPP 访问 token 和访问 secret ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25467688/

相关文章:

c# - PayPal 400 Bad Request,更具体?

php - 将多个 oauth 帐户链接到单个用户 : what's considered safe practice and what's not?

oauth - 在服务之间传递 OAuth 访问 token 是否可以?

oauth - IPP AppCenter 断开连接不会重定向到 "disconnect landing page"

quickbooks - 将基于 Web 的应用程序与 QuickBooks Online 集成

symfony - 收到IPN后的处理

paypal - 是否可以作为礼物延长 PayPal 订阅?

paypal - 更改 PayPal 订阅金额

c# - Trello API OAuth 找不到我的应用

c# - QBO SDK C# - 异步批处理创建多个客户