Sending and Using the Dkey value for Order Download

General ShopSite user discussion

Sending and Using the Dkey value for Order Download

Postby Danscan » Wed Mar 15, 2023 6:47 pm

I am in the process of creating an order download function to process orders in an order management system. I am able to download information and see some payment information for an order but most fields only list the value of "locked" (<FullName>Locked</FullName>).
I know that my signature process and grabbing orders is correct.
  • I tried adding the dkey value the one that begins with "-----BEGIN RSA PUBLIC KEY-----"
  • I have this value saved to a Database Column and it includes the formatting (line breaks). I can copy and paste the field to another text file and see it matches the original version in the text file.
  • I added the dkey value to the macdigest in alphabetical order to the other parameters (between the dbname and pay).
  • I added it to the requestbody parameters. (&dkey=)

When I submit the request I get
Code: Select all
{
  "error" : "access_denied",
  "error_description" : "client and server signatures do not match"
}


I am using c#. I am not reading this value from a file but from a database column, but it seems to maintain all the file formatting.
Does this feature still work? Is there any information that will come through that will help with processing a payment in the order management system?
Is the OrderProcessingInfo have enough info to charge an account later.
Danscan
 
Posts: 4
Joined: Wed Mar 15, 2023 6:28 pm

Re: Sending and Using the Dkey value for Order Download

Postby ShopSite David » Mon Apr 03, 2023 11:48 am

The doc has been updated to clarify the dkey value we recommend using is with base64 encoding. Also, the oauth_php.zip file has been updated to use base64 encoding. For future reference here's what our tech wrote in an email to you:

Using PHP. I took the merchant key file (that works to unlock credit card data when I upload it through the backoffice of my test store) and transferred it in binary FTP mode to a test server so I had an exact copy there. Then I got the oauth PHP sample code from here and unzipped it in the same directory on the same server as the merchant key file:

https://shopsite.com/help/oauth_php.zip

I set up my Application connection info (from Utilities > Applications in the ShopSite backoffice) at the top of the oauth_tester.php file, commented out the 'download names, skus, and quantity on hand for all products' example, and uncommented the 'download all orders' example. I then ran oauth_tester.php to make sure that the order download from my test store worked (it did). Of course I got no payment info in the resulting XML because the default parameters don't request that. So I added the 'pay' parameter with a value of 'yes' to the parameter array, and ran it again and got the payment elements in the resulting XML, but with values of 'Locked' as expected. Then I added the following to the top of the file right after the application settings:

$keyfile = file_get_contents("merchant-key.txt");
$dkey = base64_encode($keyfile);

Then I added a 'dkey' parameter to the array with the value of $dkey (my base64 encoded key) and ran it again and got all the payment fields with the payment data visible. The final 'download all orders' example ended up looking like this:

//download all orders
$contents = oauth(
$clientid, $secretkey, $code, $url,
DOWNLOAD,
array('version'=>'14.0', 'clientApp'=>'1', 'dbname'=>'orders', 'dkey'=>$dkey, 'pay'=>'yes')
);

We hope this information is helpful.
-David H.
ShopSite, Inc.
http://www.shopsite.com
ShopSite David
Site Admin
 
Posts: 317
Joined: Fri Aug 04, 2006 1:30 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests