Skip to main content

Import usage from CSV

Last updated: 27-Sep-2021
Rate this article:


Upload usage data through the 2Checkout API from a CSV (comma-separated values) file. 2Checkout will capture the parameters sent and import the usage data into the system. Once the upload process is complete, you'll be able to access the uploaded file in the Usage area of the Merchant Control Panel.

Use the importUsageFromCsv method via SOAP APIv6 to upload usage from a CSV file.

Set the DATE parameter to GMT+2 time zone, when making the API call to the Usage Upload endpoint.

Method and URL







Used in HASH validation*




Your unique 2Checkout merchant code. View merchant code.





The secret key associated to your account. View secret key.





The md5 hash of the CSV file used to upload usage.





The MD5 hmac key for the request.


UsageStart Datetime Required The datetime when the usage started; can be the same as UsageEnd. For existing records, this will be updated to time 00:00:00. N/A
UsageEnd Datetime Required The datetime when the usage ended and was recorded.  For existing records this will be updated to time 23:59:59, this will be enforced in the CSV upload as well. N/A
OptionCode String Required Unique codes you provided as identifiers of specific Pricing Options in the Usage Scale Pricing Options Group scheme. Example: metered pricing.   N/A
Description String Optional It can be used to store a short merchant comment of the usage being uploaded. This can be anything, from the source of usage (mobile, web, etc.), to why changes occurred, etc. Example: Subscription usage for September. N/A
SubscriptionRef String Required Unique code that represents a subscription. Example: 83FE4FEF2. N/A

Request Example

$date             = date("Y-m-d");
$fileReceived_md5 = md5_file("[Path to the CSV file used for usage upload]");
$merchantCode     = "";
/* 2Checkout Code */
$merchantKey      = "";
/* Merchant Secret Key */
$hashParams       = "MERCHANT={$merchantCode}&FILE={$fileReceived_md5}&DATE={$date}";
$hmac             = hash_hmac('md5', $hashParams, $merchantKey);

<form method="post" action="" enctype="multipart/form-data">
<input type="text" name="MERCHANT" value="<?php
echo $merchantCode;
?>" /><br />
<input type="text" name="HASH" value="<?php
echo $hmac;
?>" /><br />
<input type="file" name="OPTIONS" /><br />
<input type="hidden" name="FILE_MD5" value="<?php
echo $fileReceived_md5;
?>" />
<input type="hidden" name="DATE" value="<?php
echo $date;
?>" />
<input type="submit" /><br />

Error handling

Message code

Message description



The upload operation completed successfully.


Invalid account!

The merchant code provided does not belong to a vendor in the 2Checkout system.

Please check your merchant code and make sure you're using the correct version. View merchant code.

Bad signature on the received file!

The upload CSV file's md5 signature is different than the one sent as a parameter.

Please make sure that you're using the correct md5 signature for the CSV file, or that you're uploading the CSV file for which the signature was generated.

Invalid signature

The HMAC calculated by the 2Checkout system is different from the one you're sending.

Please make sure that all parameters use correct values.

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo