コード例 #1
0
 private void SendStkPushNotifaction()
 {
     ShoppingCartApiAccessToken shoppingCartApiAccessToken = GetAuthToken();
     var result = "https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest"
                  .WithOAuthBearerToken(shoppingCartApiAccessToken.AccessToken)
                  .PostJsonAsync(this._stkSettings.Value)
                  .ReceiveString().Result;
 }
コード例 #2
0
        private ShoppingCartApiAccessToken GetAuthToken()
        {
            var result = _shoppingCartStkPushKey.Value.Url
                         .WithBasicAuth(_shoppingCartStkPushKey.Value.ConsumerKey, _shoppingCartStkPushKey.Value.ConsumerSecret)
                         .GetStringAsync().Result;
            ShoppingCartApiAccessToken shoppingCartApiAccessToken = JsonConvert.DeserializeObject <ShoppingCartApiAccessToken>(result);

            Debug.Write(JsonConvert.SerializeObject(this._stkSettings.Value));
            return(shoppingCartApiAccessToken);
        }