Import usage from CSV
Use the importUsageFromCsv method via SOAP APIv6 to upload usage from a CSV file.
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.
Set the DATE parameter to GMT+2 time zone, when making the API call to the Usage Upload endpoint.
Method and URL
POST: https://api.2checkout.com/subscription/payperusage/receiver/index.php
Request parameters
file_MD5
String
Required
The md5 hash of the CSV file used to upload usage.
YES
hash
String
Required
The MD5 hmac key for the request.
N/A
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
Error handling
1
The upload operation completed successfully.
N/A
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.
Last updated
Was this helpful?