【发布时间】: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