I'm having issues attempting to pull up tracking info using Fedex's Web Services. I am using a valid tracking number and I'm able to view the details on Fedex's site. However, I get an error 9040 "No information for the following shipments has been received by our system yet. Please try again or contact Customer Service at 1.800.Go.FedEx(R) 800.463.3339." Am I leaving something out?
My code:
<?php
$path_to_wsdl = "URL_TO_WSDL";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'UserCredential' =>array(
'Key' => 'MY_KEY',
'Password' => 'MY_PASSWORD'
)
);
$request['ClientDetail'] = array(
'AccountNumber' => 'MY_ACCT',
'MeterNumber' => 'MY_METER'
);
$request['TransactionDetail'] = array('CustomerTransactionId' => 'ActiveShipping');
$request['Version'] = array(
'ServiceId' => 'trck',
'Major' => '5',
'Intermediate' => '0',
'Minor' => '0'
);
$request['PackageIdentifier'] = array(
'Value' => 'TRACKING#',
'Type' => 'TRACKING_NUMBER_OR_DOORTAG');
$response = $client->track($request);
var_dump($response);
?>
Got it!
Call the web services departement and they told me to remove 'beta' from the wsdl file. This appears to be a different address than what I found in responses to this problem before. On line 1507 of the wsdl file, make the following change:
From:
<s1:address location="https://wsbeta.fedex.com:443/web-services/track"/>
To
<s1:address location="https://ws.fedex.com:443/web-services/track"/>
I changed the rest of my code slightly, but that shouldn't have made the difference. To be on the safe side, here it is:
<?php
$path_to_wsdl = "PATH_TO_WSDL_FILE";
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$trackRequest = array(
'WebAuthenticationDetail' => array(
'UserCredential' => array(
'Key' => 'MY_KEY',
'Password' => 'MY_PASSWORD'
)
),
'ClientDetail' => array(
'AccountNumber' => 'MY_ACCT_#',
'MeterNumber' => 'MY_METER_#'
),
'Version' => array(
'ServiceId' => 'trck',
'Major' => '5',
'Intermediate' => '0',
'Minor' => '0'
),
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => 'THE_TRACKING_#',
),
'CustomerTrasactionId',
'IncludeDetailedScans' => 1
);
$response = $client->track($trackRequest);
var_dump($response);
?>
I'm also working on this same problem. I'm trying several things and you can see if anything works for you. Try including ShipDateRangeBegin and End elements, your test account/payer numbers or destination info. I've found here that switching to xml and ssl post requests supposedly solve the problem, but it's not an option for me. Maybe it will help you?
I have same problem when use xml-request. I solved the problem this way:
$endpointurl = "https://gatewaybeta.fedex.com:443/xml"; // remove word "beta"
$endpointurl = "https://gateway.fedex.com:443/xml";
...
$request = stream_context_create($form);
$browser = fopen($endpointurl , 'rb' , false , $request);
$response = stream_get_contents($browser);
...
Related
I am running a PHP 7.3, running on apache server. I used composer to get this library:
https://github.com/SecureTrading/PHP-API
For the code provided, I am now using the test site reference. I already managed to use for regular transitions. I now started managing 3D secure transactions, with the test MAESTRO card provided by secure trading here: https://docs.securetrading.com/document/testing/. the one designed not to demand 3D auth - that is 5000000000000421
The code provided next, will sum up the way I think thought this should work: I start by creating AUTH request, get error 30004, using CACHETOKENISE request to get a token, run THREEDQUERY to figure out if I need a full auth sceme on this card, get N as an answer, and run another AUTH request, this time with the transactionreference.
I am providing a version of the code I am testing (obviously, username, password and site reference name was removed to protect my privacy, but the code otherwise is the same)
<?php
$configData = array(
'username' => 'api#gigsberg.com',
'password' => 'xq!Kq$j4',
);
$site_refrance = 'test_gigsberg74319';
?>
<?php
$configData = array(
'username' => '*****',
'password' => '*****',
);
$site_refrance = '*****';
if (!($autoload = realpath(__DIR__ . '/vendor/autoload.php'))) {
throw new \Exception('Composer autoloader file could not be found.');
}
require_once($autoload);
$api = \Securetrading\api($configData);
$requestData = array(
'sitereference' => $site_refrance,
'requesttypedescription' => 'AUTH',
'accounttypedescription' => 'ECOM',
'currencyiso3a' => 'GBP',
'mainamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'securitycode' => '123',
);
echo '<pre>';
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // $response['responses'][0]['errorcode'] == 30004
echo "\n--------------------------------------\n";
$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
'sitereference' => $site_refrance,
'expirymonth' => '12',
'expiryyear' => '2030',
'requesttypedescriptions' => array('CACHETOKENISE'),
'securitycode' => '123',
'orderreference' => $transactionreference,
'pan' => '5000000000000421'
);
print_r($requestData);
$response = $api->process($requestData)->toArray();
echo "\n--------------------------------------\n";
$cachetoken = $response['responses'][0]['cachetoken'];
$requestData = array(
'termurl' => 'https://termurl.com',
'accept' => 'text/html,*/*',
'currencyiso3a' => 'GBP',
'requesttypedescription' => 'THREEDQUERY',
'accounttypedescription' => 'ECOM',
'sitereference' => $site_refrance,
'baseamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'cachetoken' => $cachetoken,
);
print_r($requestData);
$response = $api->process($requestData)->toArray(); // $response['responses'][0]['enrolled'] == 'N'
/* Copying from the docs here: https://docs.securetrading.com/document/api/security/3-d-secure/
* If the enrolled value returned in the response is “Y”, the customer’s card is enrolled in 3-D secure. Please refer to the following table for enrolled values:
* .
* .
* N - The card is not enrolled in the card issuer’s 3-D Secure scheme. - Perform an AUTH Request, including the transactionreference returned in the THREEDQUERY response.
* .
* .
*/
print_r( $response['responses'] );
echo "\n--------------------------------------\n";
$transactionreference = $response['responses'][0]['transactionreference'];
$requestData = array(
'sitereference' => $site_refrance,
'requesttypedescription' => 'AUTH',
'accounttypedescription' => 'ECOM',
'currencyiso3a' => 'GBP',
'mainamount' => '1000',
'pan' => '5000000000000421',
'expirymonth' => '12',
'expiryyear' => '2030',
'securitycode' => '123',
'transactionreference' => $transactionreference
);
print_r($requestData);
$response = $api->process($requestData)->toArray();
print_r( $response['responses'] ); // Still get $response['responses'][0]['errorcode'] == 30004
I expected it to give me a note that all works well, but I still got error 30004, as if the transactionreference wasn't provided. Any idea what I can do, to fix this code, and prevent this error?
Thanks in advance
Yair
Well, I read the Api tests, and I found my error. On the last request data, instead of
$requestData = array(
.
.
'transactionreference' => $transactionreference
.
.
);
I should use
$requestData = array(
.
.
'parenttransactionreference' => $transactionreference
.
.
);
Anyway, home this helps somone
I got some example scripts from Facebook App Management to use the Marketing API. When I run the script, I just get this error by curl:
'Unsupported post request. Object with ID \'105101623679981\' does not exist, cannot be loaded due to missing permissions, or does not support this operation.
I already tried to deactivate the Sandbox Mode and go public, tried many different scripts in different languages and also other keys.
Any Ideas?
This is the Script:
<?php
//Add all those Uses and the autoloader
$access_token = '<my_very_long_accessToken';
$ad_account_id = '<my_account_id>'; //<-- This is the Object in the Error Code
$app_secret = '<my_app_secret>';
$page_id = '<my_page_id>';
$app_id = '<my_app_is>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
);
$params = array(
'objective' => 'PAGE_LIKES',
'status' => 'PAUSED',
'buying_type' => 'AUCTION',
'name' => 'My Campaign',
);
$campaign = (new AdAccount($ad_account_id))->createCampaign(
$fields,
$params
);
$campaign_id = $campaign->id;
echo 'campaign_id: ' . $campaign_id . "\n\n";
$fields = array(
);
$params = array(
'status' => 'PAUSED',
'targeting' => array('geo_locations' => array('countries' => array('US'))),
'daily_budget' => '1000',
'billing_event' => 'IMPRESSIONS',
'bid_amount' => '20',
'campaign_id' => $campaign_id,
'optimization_goal' => 'PAGE_LIKES',
'promoted_object' => array('page_id' => $page_id),
'name' => 'My AdSet',
);
//...
Yeah. I got it. It has to be "act_"
So bad. The Script is really crappy. So many Errors. And it's created by facebook!
I'm using Quickbooks' Hosted Paypage and I have, up to this point, managed to get everything to work except for the order information. I don't receive any errors. The paypage continues to work with or without the order-related code.
I'm unsure exactly how to go about this and I can't find any relevant examples. I assume that I'm formatting something incorrectly, but I have no idea what if I am.
Below is the relevant code. I took out the applogin and authticket, but those are correct.
<?php
$order = '{"Items":[
{"ItemSku":"NA","ItemDesc":"Party Hats","ItemPrice":"1.00","ItemQty":"1","ItemIsShippable":"0","ItemIsTaxable":"0"},
{"ItemSku":"NA","ItemDesc":"Extra Guests","ItemPrice":"1.08","ItemQty":"1","ItemIsShippable":"0","ItemIsTaxable":"0"}],
"EstDeliveryDate": "01/01/2080"}';
// I've tried with and without this line
$order = json_decode($order, true);
/*---------------------------------------
Paypage
---------------------------------------*/
if ($NoErrors = true) {
// Intuit Base URL
$base_url = 'https://paymentservices.intuit.com/';
// Construct URL for Intuit ticket
$ticket = array(
'AuthModel' => 'desktop',
'AppLogin' => 'xxx.xxx.com',
'AuthTicket' => 'xxx-xxx-xxxx',
'TxnType' => 'Sale',
'Amount' => $Amount,
'CustomerName' => $CustomerFullName,
'CustomerStreet'=> $CustomerStreet,
'CustomerCity' => $CustomerCity,
'CustomerState' => $CustomerState,
'CustomerPostalCode'=> $CustomerPostalCode,
'IsCustomerFacing' => '1'
);
array_push($ticket, $order);
// Go to Intuit ticket URL
$ticket_url = $base_url . "paypage/ticket/create?" . http_build_query($ticket);
$print_ticket = file_get_contents($ticket_url);
Thank you for your time!
After rereading the documentation, I found I missed 'Order=' from the URL. I removed the json_decode line and then added "'Order' => $order" to the end of my $ticket array. That got it working.
$ticket = array(
'AuthModel' => 'desktop',
'AppLogin' => 'xxxx',
'AuthTicket' => 'xxxx',
'TxnType' => 'Sale',
'Amount' => $Amount,
'CustomerName' => $CustomerFullName,
'CustomerStreet'=> $CustomerStreet,
'CustomerCity' => $CustomerCity,
'CustomerState' => $CustomerState,
'CustomerPostalCode'=> $CustomerPostalCode,
'IsCustomerFacing' => '1',
'Order' => $order
);
I haveing trouble figuring out how to use Fedex's example file on tracking. I've got it communicateing with their test server, but I'm trying to get 'INCLUDE_DETAILED_SCANS' information from it. I can't figure out what syntax, of what to put to include it. I've found...
<xs:simpleType name="TrackRequestProcessingOptionType">
<xs:restriction base="xs:string">
<xs:enumeration value="INCLUDE_DETAILED_SCANS"/>
</xs:restriction>
</xs:simpleType>
So I've tried all sorts of variations of stuff like
$request['TrackRequestProcessingOptionType']=array('INCLUDE_DETAILED_SCANS' => true );
but I'm not getting anything extra. Has anybody used this... what am I missing? I'm just not understanding how it's using the TrackService_v8 file very well. I'm about to just change tactics and try writing it similar to an Ebay project I did which involved using curl and transmitting XML... although this might be slower...
Full code of request:
$request['WebAuthenticationDetail'] = array(
'UserCredential' =>array(
'Key' => 'asdfasdf',
'Password' => 'asdfasasdf'
)
);
$request['ClientDetail'] = array(
'AccountNumber' => 'asdfasdf',
'MeterNumber' => 'asdfas'
);
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request v8 using PHP ***');
$request['Version'] = array(
'ServiceId' => 'trck',
'Major' => '8',
'Intermediate' => '0',
'Minor' => '0'
);
$request['TrackRequestProcessingOptionType']=array('INCLUDE_DETAILED_SCANS' => true );
$request['SelectionDetails'] = array(
'CarrierCode' => 'FDXE',
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => 'asdfasdf' // Replace 'XXX' with a valid tracking identifier
)
);
Thank you in advance.
I never worked with SOAP XML api before.
I read a couple of similar questions on SO but I can't get it to work.
Here's a simple request:
<soap12:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap12=”http://www.w3.org/2003/05/
soap-envelope”>
<soap12:Body>
<CheckDomainAvailability xmlns=”https://live.domainbox.net/”>
<AuthenticationParameters>
<Reseller>myreseller</Reseller>
<Username>myuser</Username>
<Password>mypassword</Password>
</AuthenticationParameters>
<CommandParameters>
<DomainName>checkadomain.co</DomainName>
<LaunchPhase>GA</LaunchPhase>
</CommandParameters>
</CheckDomainAvailability>
</soap12:Body>
</soap12:Envelope>
I've contacted them but they do not offer a PHP API.
I would like to use the SoapClient class built in PHP.
The question is:
How do I send the request and print the answer?
Looks like your WSDL is located at https://live.domainbox.net/?WSDL.
Here's an example using the native PHP SoapClient.
$client = new SoapClient('https://live.domainbox.net/?WSDL');
// populate the inputs....
$params = array(
'AuthenticationParameters' => array(
'Reseller' => '',
'Username' => '',
'Password' => ''
),
'CommandParameters' => array(
'DomainName' => '',
'LaunchPhase' => ''
)
);
$result = $client->CheckDomainAvailability($params);
print_r($result);
To get this working I needed to change the first line to get the right version of soap to 1.2.
Also a previous comment
$client = new SoapClient('https://live.domainbox.net/?WSDL', array('soap_version' => SOAP_1_2));
// populate the inputs....
$params = array(
'AuthenticationParameters' => array(
'Reseller' => '',
'Username' => '',
'Password' => ''
),
'CommandParameters' => array(
'DomainName' => '',
'LaunchPhase' => ''
)
);
$result = $client->CheckDomainAvailability($params);
print_r($result);