card code is not validating in authorize.net - authorize.net

I am developing a web application. Here I have implemented the authorize.net payment gateway.
But here the cave code is not validating correctly. If I give wrong card code the payment results in success But i need the result as payment declained
Does anyone know this?
see the code
"x_version" => "3.1",
"x_delim_data" => "TRUE",
"x_delim_char" => "|",
"x_relay_response" => "FALSE",
"x_type" => "AUTH_CAPTURE",
"x_method" => "CC",
"x_card_num" => $card_number,
"x_exp_date" => $exp_date,
"x_amount" => $amount,
"x_description" => "Live Transaction",
"x_card_code" => $ccv,
"x_first_name" => $bill_name,
"x_address" => $bill_address,
"x_city" => $bill_city,
"x_state" => $bill_state,
"x_zip" => $bill_zip,
"x_country" => $bill_country,
"x_phone" => $bill_phone,
"x_email" => $email,
"x_ship_to_first_name" => $ship_name,
"x_ship_to_address" => $ship_address,
"x_ship_to_city" => $ship_city,
"x_ship_to_state" => $ship_state,
"x_ship_to_zip" => $ship_zip,
"x_ship_to_country" => $ship_country,
"x_ship_to_phone" => $ship_phone
// Additional fields can be added here as outlined in the AIM integration
// guide at: http://developer.authorize.net
);
// This section takes the input fields and converts them to the proper format
// for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4"
$post_string = "";
foreach( $post_values as $key => $value )
{ $post_string .= "$key=" . urlencode( $value ) . "&"; }
$post_string = rtrim( $post_string, "& " );
// The following section provides an example of how to add line item details to
// the post string. Because line items may consist of multiple values with the
// same key/name, they cannot be simply added into the above array.
//
// This section is commented out by default.
foreach( $line_items as $value )
{ $post_string .= "&x_line_item=" . urlencode( $value ); }
// This sample code uses the CURL library for php to establish a connection,
// submit the post, and record the response.
// If you receive an error, you may want to ensure that you have the curl
// library enabled in your php configuration
$request = curl_init($post_url); // initiate curl object
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
$post_response = curl_exec($request); // execute curl post and store results in $post_response
// additional options may be required depending upon your server configuration
// you can find documentation on curl options at http://www.php.net/curl_setopt
curl_close ($request); // close curl object
// This line takes the response and breaks it into an array using the specified delimiting character
$response_array = explode($post_values["x_delim_char"],$post_response);

You problem might be related to some incorrect settings in the authorize.net account. Check the following:
Make sure that the transaction version is set to 3.1. You can do that from Settings->Transaction Version->Submit
Set the Card Code Verification rejection settings and select N and U options. To do that, go to Settings->Card Code Verification
Make sure that the x_version field is set to "3.1" and that the x_card_code contains CCV number.
Hope this helps.
More details:
https://support.authorize.net/authkb/index?page=content&id=A546&impressions=false

It's not a code error. If you want the payment to be declined when the CVV number is incorrect you need to set it in your Authorize.Net control panel. It is found under the security settings.

Related

How authenticate listclients request

I try to get from PHP the information about the currently connected clients.
http://10.0.0.2:8000/admin/listclients?mount=/stream.mpeg
but this required an authenfication, which is not possible from a program. So I tried
http://10.0.0.2:8000/admin/listclients?mount=/stream.mpeg&user=xyz&pass=wert
but Icecast does not accept the user and pass. If I do it inside a browser it works?
In which way I have to provide user and pass?
Or is some additional information required?
Google did not help me.
It's not possible to put user and pass directlyin the URL. These information has to be base64 encoded and put into the header. Below you find a php example:
$url = "http://www.domain.eu:80004/admin/listclients?mount=/stream.mpeg";
$user = "source";
$pass= "password";
$opts = array('http' =>
array(
'method' => 'GET',
'header' => array ('Authorization: Basic '.base64_encode("$user:$pass"))
)
);
$context = stream_context_create($opts);
$list1 = file_get_contents($url1, false, $context);
You can use the admin password or the source password. I the example I have used the source password.

Chrome web app using firebase returns mismatchsenderid error

I apologise as this question has been asked many times, but none of the responses have been helpful in resolving my issue.
I am using firebase with my web app and attempting to send notifications via php or terminal curl command. Have tried both with same error:
{"multicast_id":4984414565388562908,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
I am getting the API key and sender id straight from firebase from the same place. Copying and pasting, no typos. Checked about 50 times... 100% sure the sender id matches the API key as i am copying and pasting from the same screen.
I am getting the endpoint from the Chrome console:
Again, copied and pasted with no typos.
My PHP file:
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', '**API_KEY**' );
$registrationIds = array('**SUBSCRIPTION_ID**');
// prep the bundle
$msg = array
(
'message' => $_GET["message"],
'title' => $_GET["title"],
'subtitle' => $_GET["subtitle"],
'tickerText' => $_GET["ticker"],
'vibrate' => 1,
'sound' => 1,
'largeIcon' => 'http://a4.mzstatic.com/au/r30/Purple4/v4/d2/8b/e4/d28be43c-9a6a-4b91-1981-a108ba5cec84/icon175x175.png',
'smallIcon' => 'http://www.uidownload.com/files/303/56/11/small-arrow-left-fast-rewind-icon.png',
'click_action' => 'https://aiatsis.gov.au'
);
$fields = array
(
'registration_ids' => $registrationIds,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;
?>
My Manifest file:
{
"name": "Webpush",
"gcm_sender_id": "**SENDER_ID**"
}
The curl terminal command i am using is:
curl --header "Authorization: key=**API_KEY**" --header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"registration_ids\":[\"**SUBSCRIPTION_ID**\"]}"
I have no idea why this is not working. I have tried:
Checking the Key matches the sender id about 150 times.
Deleting my firebase project and starting again with new API key and Sender ID (yes i generated a new endpoint subscription id after i did this).
As mentioned, tried both php and terminal push requests.
I have run out of options. And as mentioned several times already the API key matches the corresponding sender ID. I am 100% sure of this. As far as my understanding of the "MismatchSenderId" error, they are trying to tell me that the API key and sender ID do not match. They do match.
The sender ID matches the API key
The Subscription ID was generated using the correct sender ID
Does anyone have any idea why this is happening?
In the manifest file, que gmc_sender_id is the same for everyone.
Change that to: "gcm_sender_id": "103953800507".

How to create a user with the Admin Directory api using the google-api-ruby-client?

I've been trying a few combinations but can't seem to come up with something that works. More information about the API I'm asking about can be found here https://developers.google.com/admin-sdk/directory/v1/reference/users/insert . I have a feeling I'm just not setting up the request correctly. The following bit of code is known to work. I use it to set up the client that is able to query all the users.
client = Google::APIClient.new(:application_name => "myapp", :version => "v0.0.0")
client.authorization = Signet::OAuth2::Client.new(
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
:audience => 'https://accounts.google.com/o/oauth2/token',
:scope => "https://www.googleapis.com/auth/admin.directory.user",
:issuer => issuer,
:signing_key => key,
:person => user + "#" + domain)
client.authorization.fetch_access_token!
api = client.discovered_api("admin", "directory_v1")
When I try to use the following code
parameters = Hash.new
parameters["password"] = "ThisIsAPassword"
parameters["primaryEmail"] = "tstacct2#" + domain
parameters["name"] = {"givenName" => "Test", "familyName" => "Account2"}
parameters[:api_method] = api.users.insert
response = client.execute(parameters)
I always get back the same error "code": 400, "message": "Invalid Given/Family Name: FamilyName"
I've observed a few things while looking into this particular API. If I print out the parameters for both the list and the insert functions e.g
puts "--- Users List ---"
puts api.users.list.parameters
puts "--- Users Insert ---"
puts api.users.insert.parameters
Only the List actually displays the parameters
--- Users List ---
customer
domain
maxResults
orderBy
pageToken
query
showDeleted
sortOrder
--- Users Insert ---
This leaves me wondering if the ruby client is unable to retrieve the api and therefore unable to submit the request correctly or if I'm just doing something completely wrong.
I'd appreciate any idea's or direction that might help set me on the right path.
Thank you,
James
You need to supply an Users resource in the request body, which is also the reason why you don't see it in the params.
So the request should look like:
# code dealing with client and auth
api = client.discovered_api("admin", "directory_v1")
new_user = api.users.insert.request_schema.new({
'password' => 'aPassword',
'primaryEmail' => 'testAccount#myDomain.mygbiz.com',
'name' => {
'familyName' => 'John',
'givenName' => 'Doe'
}
})
result = client.execute(
:api_method => api.users.insert,
:body_object => new_user
)

get content from facebook url using php

How to get content from facebook url and extract facebook user id and access token. I have used CURL and it's returning empty content.
$url = 'https://graph.facebook.com/oauth/access_token?client_id='.$fbconfig['appid'].'&redirect_uri='.$returnurl.'&client_secret='.$fbconfig['secret'].'&code='.$_REQUEST['code'];
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_VERBOSE => true
));
$result = curl_exec($ch);
curl_close($ch);
$iResult=AlowUserAccess();
$FBUserId = explode('|', $iResult);
$FBUserId = explode('|', $FBUserId['1']);
$FBUserId = explode('-', $FBUserId['0']);
$iUserId = $FBUserId['1'];
$iUserId = $iResult;
$sAccessToken = explode('access_token=', $iResult);
Try using the options used here:
PHP script to automate login and form submit
Your not setting both SSL opts, it is also possible they may want to set a cookie.

Adding a tab to a fan page does not work... error: (#210) Subject must be a page

I'm trying to add a tab to a fanpage using the graph api/PHP SDK and I'm receiving an error :
(#210) Subject must be a page I've tried using both the user access_token AND the page access_token but neither work. I've tried using the page id of numerous accounts and still no go. Here is my code:
<?php
$path="/PAGE_ID/tabs/";
$access_token="ACCESS_TOKEN";
$params = array(
'app_id' => "APP_ID",
'access_token' => $access_token
);
try{
$install = $facebook->api($path, "POST", $params);
}catch (FacebookApiException $o){
print_r($o);
}
?>
And here is the error I get:
FacebookApiException Object
(
[result:protected] => Array
(
[error] => Array
(
[message] => (#210) Subject must be a page.
[type] => OAuthException
)
)
[message:protected] => (#210) Subject must be a page.
[string:Exception:private] =>
[code:protected] => 0
Thanks for any help you can provide!
If you are not limited to using the API to add your application to your page then you can follow the instructions provided by Facebook at this link :
https://developers.facebook.com/docs/reference/dialogs/add_to_page/
Essentially you can use a dialog ( see the link above ) or this direct URL to add tab apps to your page :
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&display=popup&next=YOUR_URL
Dont forget to substitute APP_ID for your app id and next for a different URL
API Call is atm bugged: https://developers.connect.facebook.com/bugs/149252845187252?browse=search_4f31da351c4870e34879109
But here is a solution for JS: OAuthException "(#210) Subject must be a page." - just do not use the library and do your own call.
I did it with PHP:
<?php
$url = 'https://graph.facebook.com/<PAGE ID>/tabs?app_id=<APP ID>&method=POST&access_token=<PAGE ACCESS TOKEN>&callback=test';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Echo value should be something like "test(true)".