I have configured Authorize.net, accept hosted payment method for my client requirement, where everything is happening fine, except Transaction reponse. As per Authorize.net, response comes only either of these ways, webhooks or CommunicatorUrl. CommunicatorUrl not working for my code. so, opted for webhooks. Below is my code. please, suggest me something.
My doubts are:
My Code displaying this error when calling list of available webhooks
{
"status": 405,
"reason": "Method Not Allowed",
"message": "The requested resource does not support http method 'POST' for given parameters.",
"correlationId": "ff90ee25-0ba7-4006-bb1e-225ea64897e3"
}
Should i configure webhook anywhere in my Merchant Panel
How would i get my transaction response using webhook
<?php
$login_transKey = 'xxx:xxx'; //Login and Transaction Key of Authorize.net
$jsonObj = '{
"name": "Get WebHooks",
"request": {
"url": "http://localhost:81/hosted_payment_form/webhookstwo.php",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "'.$login_transKey.'",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
}';
$jsonObj = json_encode($jsonObj);
$url = "https://apitest.authorize.net/rest/v1/eventtypes";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonObj);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
$content = curl_exec($ch);
echo '<pre>'; print_r($content); die();
curl_close($ch);
?>
Please, Let me know for more information.
You need to specify the webhook URL in authorize.net account.
Also you need to select the events in the settings page.
Please make sure that the Web-hook URL always return HTTP 200 response.
Otherwise it will be automatically changed to Inactive status.
Related
I want to update a specific post on google my business. I already got the account_id, location_id, and the post_id. I am using the url https://mybusiness.googleapis.com/v4/{name=accounts/*/locations/*/localPosts/*} and doing PATCH method in my backend. But when I do an update it gets me an
"code": 2,
"field": "update_mask",
"message": "update_mask is required"
I cant understand the update_mask thing in google. Can someone tell me what I should do about this? I am using laravel btw and curl library for http request. Here is my code
public function updatePost(Request $request ){
$url = 'https://mybusiness.googleapis.com/v4/accounts/'.$request->account_id.'/locations/'.$request->location_id.'/localPosts/'.$request->post_id;
$body['languageCode'] = "en-US";
$body['summary'] = $request->summary;
$body['callToAction'] = ['actionType'=> 'Call'];
$body['media'][] = ['mediaFormat'=> 'PHOTO', "sourceUrl" => $request->imageURL];
//Static Token only since for testing
$headers = array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer '.'ya29.a0AfH6SMB_1iUG11qj72p-pn_gCkOjUEf-ctvTGnJZ6FNTUy0Q3dYP54TMvI0cr8o0ditLp7CaWOUX5CTWn4v2kyQ-hZKSyuEJu_rBYX7uxvX373I9iVRxoypIZ6xhWDYTr-A_DHcaxGPVs1yz5u-fkYvU-xDppkASNbg'
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($body));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
dd($response);
}
The full message
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 2,
"field": "update_mask",
"message": "update_mask is required"
}
]
}
]
}
}
The docs for patch method
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.localPosts/patch
You need to set query parameters for the upateMask like following.
https://mybusiness.googleapis.com/v4/accounts/2323232334343/locations/232323232/localPosts/23232323232?updateMask=summary
However, I can not edit the other field, for example, title.
Did you find the way of editting the others?
Its clear state that you need to set query parameter 'updatemask' to a field that you want to update. Check this doc for details.
I would like to create new customer if it does not exist and create new issue setting this customer as reporter in PHP with Jira API.
I create new customer using API ‘servicedeskapi/customer’ with POST fields ‘fullName’ and ‘email’ and then I create new issue using API ‘api/2/issue’ with parameters ‘fullName’ and ‘email’ of parameter ‘reporter’.
I am trying do this in this way:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');
$postvars = array('fields' => array('project' => array('key' => 'AP'), 'summary' => $body, 'description' => $body, 'reporter' => null));
$postvars['fields']['issuetype'] = array("id" => '10108');
$postvars['fields']['reporter']['fullName'] = $name; //POST field of customer's name to set customer as the reporter of new issue
$postvars['fields']['reporter']['email'] = $email; //POST field of customer's email address to set customer as the reporter of new issue
curl_setopt($ch, CURLOPT_URL, 'https://jira-address/rest/servicedeskapi/customer');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'X-ExperimentalApi: opt-in'));
curl_setopt($ch, CURLOPT_POSTFIELDS,
json_encode(array('fullName' => $reporterName, 'email' => $email))); //POST fields for creating new customer
$r = curl_exec($ch); //sending request for creating new customer
echo json_encode(json_decode($r), JSON_PRETTY_PRINT); //printing response of request for creating new customer
curl_setopt($ch, CURLOPT_URL, 'https://jira-address/rest/api/2/issue/');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postvars));
$r = curl_exec($ch); //sending request for creating new issue
echo json_encode($postvars, JSON_PRETTY_PRINT); //printing POST fields of the request of creating new issue
echo json_encode(json_decode($r), JSON_PRETTY_PRINT); //printing the response of the request for creating new issue
If the customer does not exist, the response is:
{
"name": "kamilszmit2#live.com",
"key": "kamilszmit2#live.com",
"emailAddress": "kamilszmit2#live.com",
"displayName": "kamilszmit2",
"active": true,
"timeZone": "Europe\/Warsaw",
"_links": {
"jiraRest": "https:\/\/jira-address\/rest\/api\/2\/user?username=kamilszmit2%40live.com",
"avatarUrls": {
"48x48": "https:\/\/jira-address\/secure\/useravatar?avatarId=10122",
"24x24": "https:\/\/jira-address\/secure\/useravatar?size=small&avatarId=10122",
"16x16": "https:\/\/jira-address\/secure\/useravatar?size=xsmall&avatarId=10122",
"32x32": "https:\/\/jira-address\/secure\/useravatar?size=medium&avatarId=10122"
},
"self": "https:\/\/jira-address\/rest\/api\/2\/user?username=kamilszmit2%40live.com"
}
}{
"fields": {
"project": {
"key": "AP"
},
"summary": "test",
"description": "test",
"reporter": {
"fullName": "kamilszmit2",
"email": "kamilszmit2#live.com"
},
"issuetype": {
"id": "10108"
}
}
}{
"id": "11187",
"key": "AP-351",
"self": "https:\/\/jira-address\/rest\/api\/2\/issue\/11187"
}
The customer and the issue are created but the customer is not set as reporter of the issue. The same problem occurs if customer already exists and when only the parameter ‘fullName’ or ‘email’ of the parameter ‘reporter’ is used.
What am I doing wrong? How to create Jira issue with the customer as the reporter? Could you help me?
via REST, I have managed to set the reporter by using the name parameter, instead of fullname.
"fields": {
"project": {
"key": "AP"
},
"summary": "test",
"description": "test",
"reporter": {
"name": "kamilszmit2"
},
"issuetype": {
"id": "10108"
}
Other things I would check:
The Reporter field is added to the Create Issue screen
The credentials these calls are run with, have Modify reporter
project permission (You will run into 405 error if they do not have
this permission)
What is issue in my code:Using Vault api in paypal credit card information saved but when i using saved card then get error
function paypalPaymentViaStoredCreditCard_post()
{
$access_token = "XXXXXXXX";
$ch = curl_init();
$data = '{
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments":[
{
"credit_card_token": {
"credit_card_id": "CARD-6F0009583J819301DK5DO5JA",
"payer_id": "BAAAA"
}
}
]
},
"transactions":[
{
"amount":{
"total":"100.00",
"currency":"USD"
},
"description": "This is the payment transaction description."
}
]
}';
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type:application/json",
"Authorization: Bearer " . $access_token,
"Content-length: " . strlen($data))
);
curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Some-Agent/1.0");
$result = curl_exec($ch);
print_r($result);die;
if (empty($result)) die("Error: No response.");
else {
$json = json_decode($result);
print_r($json);
die;
return $json;
}
curl_close($ch);
}
OUTPUT Here
{"name":"INTERNAL_SERVICE_ERROR","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"b33db4a496dfc"}
As I didn't get any solution from anybody so I dug into my code step by step and found solution.there is no bug in my code only credit card no and negative testing issue.i follow following post on stackoverflow and get get success
PayPal Sandbox API endpoint returning 503 "Internal Service Error" error
PayPal Sandbox returning Internal Service Error
I keep on getting the below error when fired from the code even though I have signed up and attach key to the url :-
Freebase Error Code: 403 - User Rate Limit Exceeded. Please sign up
When I try to fire the same url from the browser then the result set is displayed which shouldnt be the case as the error says I have crossed some limit or something.
My Query :-
[{
"id": null,
"mid": "/m/07kw5b",
"name": null,
"/sports/sports_league/teams": [{
"mid": null,
"team": null,
"/sports/sports_league_participation/team": [{
"mid": null,
"id": null,
"name": null
}]
}]
}]
Below is the url:-
https://www.googleapis.com/freebase/v1/mqlread?query=%5B%7B%0A%09%09%09%09%09%09%09%09%09%09++%22id%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09++%22mid%22%3A+%22%2Fm%2F07kw5b%22%2C%0A%09%09%09%09%09%09%09%09%09%09++%22name%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09++%22%2Fsports%2Fsports_league%2Fteams%22%3A+%5B%7B%0A%09%09%09%09%09%09%09%09%09%09%09%22mid%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09%22team%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09%22%2Fsports%2Fsports_league_participation%2Fteam%22%3A+%5B%7B%0A%09%09%09%09%09%09%09%09%09%09%09++%22mid%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09++%22id%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09++%22name%22%3A+null%0A%09%09%09%09%09%09%09%09%09%09%09%7D%5D%0A%09%09%09%09%09%09%09%09%09%09++%7D%5D%0A%09%09%09%09%09%09%09%09%09%09%7D%5D&key=[API-Key]&cursor
PHP Code:-
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, $url); //the above url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$json_data = json_decode(curl_exec($ch), true);
curl_close($ch);
I have not fired the query more than 10 times and in my console too under freebase api it says "0 out of 100,000 requests".
My dashboard graph:-
Can anyone please give me some insights on why this error is coming?Is this something to do with configuration as I am firing the url from localhost.
I'm trying to do a GET request to the XBMC api in PHP, but i cant get it to work. I already have a valid url, thats working when i simulate a GET request with a REST client.
http://localhost:8085/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "Input.ExecuteAction", "params": {"action":"left"}}
I get a parse error from xbmc when i simulate a POST:
{
"error": {
"code": -32700,
"message": "Parse error."
},
"id": null,
"jsonrpc": "2.0"
}
This is the code i currently have:
<?php
$jsonString = "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"Input.ExecuteAction\", \"params\": {\"action\":\"left\"}}";
$url = "http://localhost:8085/jsonrpc?request=".$jsonString;
get($url);
function get($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 7);
$result = curl_exec($ch);
print $result;
curl_close($ch);
}
But this wont do the job, just like when i simulate a POST request a parse error is returned.
So my thoughts are that i'm doing a POST request, am i?
If no, what would be the problem then?
I just ran into the same problem.
You need to encode the url you are using for XBMC (Kodi nowadays). So in your case:
$jsonString
should be replaced by
urlencode($jsonString)