m-Pesa STKPush Request throws an error "update failed9" - php

Folks, hope you all doing good.
I'm working on a project in PHP in which we have to integrate m-Pesa as payment gateway. I don't know how and why but "Lipa Na M-Pesa Online Payment"
this API when called it gives an error
update failed9
in Sim Tool Kit push dialog box. Even though we are getting a positive response from the m-Pesa server that "Your Request is accepted for processing" and then after a while(10 mins or so) our callback URL gets called by the m-Pesa server with a response of request timed out.
Here is my Request Body:
{
"BusinessShortCode": "242599",
"Password": "MjQyNTk5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMTkwNzEzMTI1NTMw",
"Timestamp": "20190713125530",
"TransactionType": "CustomerBuyGoodsOnline",
"Amount": "1000",
"PartyA": "254708374149",
"PartyB": "242599",
"PhoneNumber": "254721705529",
"CallBackURL": "http://961bb2f4.ngrok.io/hooks/mpesa",
"AccountReference": "account",
"TransactionDesc": "test" }
Here is the error screenshot

Are you able to get the screen to enter your PIN? you can use that to tell if safaricom is able to initiate the API on your end.

Related

Watson Assistant CURL API: How to send follow up message?

I'm trying out IBM Watson Assistant. Ultimate goal is to integrate it with my custom PHP backend, via it's Watson Assistant's cURL API Endpoints (because there's no complete PHP SDK yet).
Let me tell what I did so far:
Imported a sample Workspace from a Training Data Set.
Then I tried this, and it works fine.
Then I tried that exact same thing via cURL API, I got a response like this: (The json output format beautified)
.
{
"intents": [
{
"intent": "locate_amenity",
"confidence": 0.999901008605957
}
],
"entities": [
{
"entity": "amenity",
"location": [
7,
10
],
"value": "gas",
"confidence": 1
}
],
"input": {
"text": "i need some gas"
},
"output": {
"text": [
"Hi. It looks like a nice drive today. What would you like me to do? "
],
"nodes_visited": [
"Start And Initialize Context"
],
"log_messages": []
},
"context": {
"conversation_id": "153c18ee-1015-4b6a-ae04-789e29bf4a05",
"system": {
"dialog_stack": [
{
"dialog_node": "root"
}
],
"dialog_turn_counter": 1,
"dialog_request_counter": 1,
"_node_output_map": {
"Start And Initialize Context": [
0,
0
]
},
"branch_exited": true,
"branch_exited_reason": "completed"
},
"AConoff": "off",
"lightonoff": "off",
"musiconoff": "off",
"appl_action": "",
"heateronoff": "off",
"volumeonoff": "off",
"wipersonoff": "off",
"default_counter": 0,
"previous_cuisine": "",
"previous_restaurant_date": "",
"previous_restaurant_time": ""
}
}
Now please let me understand 2 things here.
Question (1)
At this point, I was expecting the API to return with a message:
"There are gas stations nearby. Which one would you like to drive to?"
But why it doesn't. If then, how do I achieve it?
Question (2)
How do I properly reply back with "Go to number 5." so that the API understands I'm referring to the previous Call? (aka) How to I continue the dialog flow? (Note: I tried sending back with the previous "contexts", "entities", "intents", but it is somehow still recognised as a new message.)
Please share me an example of cURL call to follow up the previous message.
Since there's no complete PHP SDK yet, it is very hard for me to understand just by the cURL API calls. API Documentation does not explain to that details too. Please help.
Thank you all.
The message API for Watson Assistant is stateless. Everything that is needed to process a request is submitted as parameters. This includes the message itself, but also the context. The context holds the state about where in the dialog tree the conversation is. It could also hold information that is transferred from WA to the app, e.g., to process a client-side action. Or from the app to WA, e.g., with a record from a database.
Coming to your request:
Your dialog probably sends out that reponse when a new conversation is started. I see it is the same as in the "Try it out".
You would need to send a "Hi" or empty message first, wait for the reponse from WA, then send your "I need gas" together with the context data you received from WA. WHen you look into the details, you see the dialog stack, turn counter and more. The conversation ID is the identifier for that current chat.
With the above, WA's next response should be exactly like in the "Try it out" because you went down in the dialog tree.

Facebook Messenger Send returns "No matching user found"

I want to send a message to a user from my server once they've finished successfully updating their payment details in a Facebook Messenger Webview, just before I close the webview window and return to the chat.
I'm sending a POST message, as defined, to https://graph.facebook.com/v2.6/me/messages?access_token=ABC In the format of:
{
"recipient": {
"id": 123456789
},
"message": {
"text": "hello, world!"
}
}
...where 123456789 is the valid Page Scoped User Id of the person I'm messaging (currently, that person is an admin of the app while we're in development).
The response I get is:
{
"error": {
"message": "(#100) No matching user found",
"type": "OAuthException",
"code": 100,
"error_subcode": 2018001,
"fbtrace_id": "CTdzskm/2rM"
}
}
Nothing I do seems to change this. I simply cannot get my application to send a message to the Facebook Messenger chat via cURL.
Make sure you are using the same page-scoped access token to send the new message that was used when you received the person's PSID.

Riot API server callback

I am making website to organize tournaments in League of Legends game. I have problem with receiving data about completed games from automatic callback.
The steps which we take:
We register provider with tournament-v3:
http://example.pl/riotcallbackinfo
on server EUNE
and recive id=10xx
We register tournament, and create tournament code successfully.
tournamentId=256xxx
code: EUNE043bb-xxx4d390-xxxx-4f2c-xxxx-4dc266xxxxxx
3. We play game with generated tournament code and completed it successfully.
After the match we should receive some data to our url:
example.pl/riotcallbackinfo
but nothing is sending. We have log system to check every time someone call this url and there is no information about calling it by riot api.
We can get data about this completed game using match-api-v3 and it is looked, like game is finished successfully.
We tried to register also http://example.pl:80/riotcallbackinfo url, but with no success.
To backed we use Laravel PHP 5.4. The documentation says:
"The following ports are forwarded to your Homestead environment:
HTTP: 8000 → Forwards To 80"
Lobby events for this game are:
{
"eventList": [
{
"timestamp": "1498128797694",
"summonerId": "23509512",
"eventType": "PracticeGameCreatedEvent"
},
{
"timestamp": "1498128833935",
"eventType": "GameAllocationStartedEvent"
},
{
"timestamp": "1498128803131",
"eventType": "ChampSelectStartedEvent"
},
{
"timestamp": "1498128798414",
"summonerId": "34477543",
"eventType": "PlayerJoinedGameEvent"
},
{
"timestamp": "1498128834399",
"eventType": "GameAllocatedToLsmEvent"
}
]
}
We have tested our url method with Postman and sending your sample JSON response and everything worked fine. Even if our method is broke we should see something in log. Our log is set at the beginning of the method.
Could you suggest us, were could have problem? Why couldn’t we get data from automatic callback? There is problem with our URL or is something what we understand wrong?
Thank you in advance for your help

How to get payer id from paypal via IOS MSDK2.x?

I have a question when using the Paypal IOS MSDK2.x in conjunction with Kount fraud checking.
Currently the MSDK2.x will return a payment confirmation in the delegate
"- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment"
in this format of PayPalPayment class
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.0.0",
"platform": "iOS",
"product_name": "PayPal iOS SDK;"
},
"response": {
"create_time": "2014-02-12T22:29:49Z",
"id": "PAY-564191241M8701234KL57LXI",
"intent": "sale",
"state": "approved"
},
"response_type": "payment"
}
where the info "Payer Id" is not included.
To work with Konut, the Kount server needs the "Payer Id" to be provided/updated in the inquiry. This "Payer Id" can be obtained if the payment request is made via web form where the paypal server will return a URL of this format
"http://<return_url>?paymentId=PAY-6RV70583SB702805EKEYSZ6Y&token=EC-60U79048BN7719609&PayerID=7E7MGXCWTTKK2"
My question is anyone know how to get the "Payer Id" if the payment request is sent from mobile device that runs IOS MSDK2.x?
Thanks very much.
Actually I have solved this problem. Just had not got time to update it here.
The steps to do this are:
Use the payment id to get the security token from here
"https://api.paypal.com/v1/oauth2/token"
Use "POST" with your paypal private token.
Use the security token to to get the payer id.
https://api.paypal.com/v1/payments/payment/$your_payment_id"
You can use curl_setopt to do both steps on PHP. Hope this helps if anyone else has the same issue.
Thanks.

Google Wallet 500 Server Error

I got my subscriptions all working in the sandbox about 5 days ago, but a day after I finished testing it I started getting 500 server errors every time I try to test my subscriptions in sandbox and in production. I have not changed the code what so ever and my JWTs still decode perfectly.
Any ideas why this is happening? I've contacted Google many times but most of the people I get a hold of clearly have no idea what they are talking about...
Has anyone ever run into this issue before? Any input is appreciated!
The failing red line is the google sandbox code:
<script src="https://sandbox.google.com/checkout/inapp/lib/buy.js"></script>
POST:
[,"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIxMTQ4MTc0NTgxNTIzNzcxMTY5OSIsImF1ZCI6Ikdvb2dsZSIsInR5cCI6Imdvb2dsZVwvcGF5bWVudHNcL2luYXBwXC9zdWJzY3JpcHRpb25cL3YxIiwiZXhwIjoxNDAyMjQ3NTMyLCJpYXQiOjE0MDIyNDM5MzIsInJlcXVlc3QiOnsibmFtZSI6IkF1dG9tYXRvbiBTY2hlZHVsZXIgU3Vic2NyaXB0aW9uIChQUk8pIiwiZGVzY3JpcHRpb24iOiJNb250aGx5IHN1YnNjcmlwdGlvbiB3aXRoIHVwIHRvIDUwIHVzZXJzLiIsImN1cnJlbmN5Q29kZSI6IlVTRCIsInNlbGxlckRhdGEiOiJ1c2VyX2lkOixzdWJzY3JpcHRpb25faWQ6MiIsImluaXRpYWxQYXltZW50Ijp7InBheW1lbnRUeXBlIjoiZnJlZV90cmlhbCJ9LCJyZWN1cnJlbmNlIjp7InByaWNlIjoiNjAuMDAiLCJjdXJyZW5jeUNvZGUiOiJVU0QiLCJmcmVxdWVuY3kiOiJtb250aGx5In19fQ.sju0xaOf9u3ufxow0XxWF4j-QUY0XgtF0A0d8g1rRiQ",,,1]
Response:
[,,4,"VTTMKJ"]
Based on above, this is the request object in your JWT payload:
"request": {
"name": "Automaton Scheduler Subscription (PRO)",
"description": "Monthly subscription with up to 50 users.",
"currencyCode": "USD",
"sellerData": "user_id:,subscription_id:2",
"initialPayment": {
"paymentType": "free_trial"
},
"recurrence": {
"price": "60.00",
"currencyCode": "USD",
"frequency": "monthly"
}
}
Note the docs regarding the structure and required fields in a subscription request. So:
There is no currencyCode in a subscription request
The above initialPayment object is missing required fields:
price
currencyCode
Hth....

Categories