Billing1.3

Cancel Plan


GET SSL Required https://www.mediafire.com/api/1.3/billing/cancel_plan.php
POST SSL Required https://www.mediafire.com/api/1.3/billing/cancel_plan.php

Note: This Requires SSL.

Description: Cancels the active invoice for a plan and returns the cancellation date and confirmation ID.

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')
  • comments : Any comments the user would like to add.
  • x_uploading : Problems uploading files. 'no' (default) or 'yes'.
  • x_downloading : Problems downloading files. 'no' (default) or 'yes'.
  • x_switching : Switching to another file hosting service. 'no' (default) or 'yes'.
  • x_speed : Download speeds were not fast enough. 'no' (default) or 'yes'.
  • x_money_problems : Can't afford the monthly fee. 'no' (default) or 'yes'.
  • x_too_expensive : The service was too expensive. 'no' (default) or 'yes'.
  • x_technophobe : No longer need the service. 'no' (default) or 'yes'.
  • x_lacking_features : The service is missing a feature I need. 'no' (default) or 'yes'.
  • x_lacking_service: The service is not what I was expecting. 'no' (default) or 'yes'.
  • x_other : The service is not what I was expecting. 'no' (default) or 'yes'.

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Response Properties

Name Description Type Values
cancel_date The date the plan was cancelled string timestamp
confirmation The confirmation code of the cancellation string
last_invoice The invoice number of the last invoice on record string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 100, 224
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Example 1 (Success with JSON):

Request

HTTPS://dev.mediafire.com/api/billing/cancel_plan.php?session_token=&x_technophobe=yes&response_format=json&signature=
                    
Response
{
   action: billing/cancel_plan,
   cancel_date: 02/15/2015,
   confirmation: TPEX7,
   last_invoice: 82875,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 2 (Failure - Error 224 - with JSON):

Request
HTTPS://dev.mediafire.com/api/billing/cancel_plan.php?session_token=&response_format=json&signature=
                    
Response
<response>
  <action>billing/cancel_plan</action>
  <message>There is no active invoice to cancel</message>
  <error>224</error>
  <result>Error</result>
  <current_api_version>#CURRENT_API_VERSION#</current_api_version>
</response>HTTPS://dev.mediafire.com/api/billing/cancel_plan.php?session_token=&response_format=json&signature=

Change Plan


GET SSL Required https://www.mediafire.com/api/1.3/billing/change_plan.php
POST SSL Required https://www.mediafire.com/api/1.3/billing/change_plan.php

Note: This call requires SSL

Description: Returns a new billing date for a changed plan. If desired, creates a new invoice and updates parameters for a new plan.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • product_id : The ID of the product being changed.
  • info_only : When set to 'yes', pertinent plan information will be returned (such as the billing date and amount) without actually changing the plan. If set to "no" the change plan process will be completed.

Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.
  • subdomain : A string to be used for the business sub-domain. Only for upgrades to business. The subdomain should have no characters and cannot begin with a number. Example is 'subdomain=companyacmebrick1'.
  • company : A string to be used for the business company name. Only for upgrades to business. Example would be 'company=Acme Brick Company'.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Response Properties

Name Description Type Values
nextbilling The next billing date for the account string timestamp
info_only Indicates if the call returns info only without processing the plan change [yes]. A [no] value indicates that plan actually changed, instead of just returning information. flag no/yes
plan1 The original product ID for the account integer
plan2 The new product ID for the account as resulted from the plan change integer
freedays The amount of free days added to the current billing cycle due to the plan change integer
bandwidth_adjust The amount of bandwidth added/removed from the account due to the plan change integer
lastpremium1 The original next billing date(minus 30 days) for the account string timestamp
lastpremium2 The new next billing date(minus 30 days) for the account string
premium1 The original premium flag for the account integer
premium2 The new premium flag for the account integer
next_bw The next bandwidth disbursal date for the account string timestamp
invoice1 The original invoice for the account string
invoice2 The new invoice for the account integer
invoice_created The date and time the new invoice was created for the account string timestamp
bandwidth1 The original bandwidth disbursal amount integer
bandwidth2 The new bandwidth disbursal amount integer
subdomain The sub-domain for a business account (doesn't apply to non-business accounts) string
company The company name for the business account (doesn't apply to non-business accounts) string
newpid The new product ID for the account integer
amount The new product price string
interval The new product billing cycle, in months string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 100, 168, 170, 172, 173, 176, 178, 179, 180, 181, 182, 183
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Example 1 (Success with JSON; info_only = "yes"):

Request
HTTPS://dev.mediafire.com/api/billing/change_plan.php?session_token=&product_id=121&info_only=yes&response_format=json&signature=
Response:
{
   action: billing/change_plan,
   nextbilling: February 18, 2015,
   info_only: yes,
   newpid: 121,
   amount: 49.99,
   interval: 12,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 2 (Success with JSON; info_only=no and change to pro or business to business):

Request
HTTPS://dev.mediafire.com/api/billing/change_plan.php?session_token=&product_id=121&info_only=no&response_format=json&signature=
Response:
{
   action: billing/change_plan,
   nextbilling: February 18, 2015,
   info_only: no,
   plan1: 123,
   plan2: 121,
   freedays: 20.845153530706,
   bandwidth_adjust: 0,
   lastpremium1: 2015-01-15 14:14:41,
   lastpremium2: 2015-01-19 00:52:24,
   premium1: 4,
   premium2: 4,
   next_bw: 2015-02-15 00:14:43,
   invoice1: 82875,
   invoice2: 82883,
   invoice_created: 2015-01-15 14:14:40,
   bandwidth1: 1073741824000,
   bandwidth2: 1073741824000,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 3 (Success with JSON; info_only=no and change from free or pro to business):

Request
HTTPS://dev.mediafire.com/api/billing/change_plan.php?session_token=&product_id=125&info_only=no&subdomain=t06&company=t06&response_format=json&signature=
Response:
{
   action: billing/change_plan,
   nextbilling: February 12, 2015,
   info_only: no,
   plan1: 121,
   plan2: 125,
   freedays: 15.242791280864,
   bandwidth_adjust: 1710768578672,
   lastpremium1: 2015-06-30 04:00:00,
   lastpremium2: 2015-01-13 10:54:13,
   premium1: 4,
   premium2: 2,
   next_bw: 2014-09-03 23:17:06,
   invoice1: 82827,
   invoice2: 82885,
   invoice_created: 2014-08-04 13:18:33,
   bandwidth1: 1073741824000,
   bandwidth2: 2784510402672,
   subdomain: t06,
   company: t06,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 4 (Failure with JSON; Error 173):

Request
HTTPS://dev.mediafire.com/api/billing/change_plan.php?session_token=&product_id=121&info_only=yes&response_format=json&signature=
Response:
{
   action: billing/change_plan,
   message: Must be a premium user to use this function,
   error: 173,
   result: Error,
   new_key: yes,
   current_api_version: 1.3,
}

Get Invoice


GET SSL Required https://www.mediafire.com/api/1.3/billing/get_invoice.php
POST SSL Required https://www.mediafire.com/api/1.3/billing/get_invoice.php

Note: This Requires SSL.

Description Returns the contents of the most recent/active invoice.

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Response Properties

Name Description Type Values
invoice_num This invoice's ID integer
payment_method Specifies the payment method used for this invoice string authnet, coupon
recurring_status Specifies whether the product services are active or cancelled string active, cancelled
recurring_profile_id The subscription ID for this invoice integer
date_created The date and time the invoice was created for this purchase string timestamp
company_id integer
product_id The ID of the product purchased in this invoice integer
product_description The description of the product purchased in this voice string
country The country this product was purchased string
initial_amount The initial purchase price of the product in this invoice
initial_tax The tax applied to the initial purchase of the product in this invoice
initial_total The total price of the initial purchase of the product in this invoice
recurring_amount The re-bill price of the product in this invoice
recurring_tax The tax applied to re-bills of the product in this invoice
recurring_total The total re-bill price of the product in this invoice
recurring_startdate The date and time re-billing will begin for this subscription string timestamp
recurring_enddate The date and time re-billing will end for this subscription string timestamp
next_bandwidth The next bandwidth disbursal date for this subscription string timestamp
previous_invoice The invoice ID of the invoice previous to this one on record for this account integer
promo_code The promotion code, if any, used when purchasing the product in this invoice
product_id The ID of the product integer
description The description of the product string
short_description The shortened version of description string
initial_amount The initial purchase price of the product
initial_unit The initial bandwidth, in bytes, included with the product integer
free_months The number of months included with this product integer
trial
active Specifies whether this product is active or not flag 0/1
frequency_text The human friendly interval string
uses_credits
reseller_entitlement
payment_methods Accepted payment methods for this product bitmask 0 (credit card)
yearly_only
interval The product billing cycle, in months integer
legacy Specifies whether this product is legacy or not flag 0/1
product_class The product's type flag 1 (base), 2 (bandwidth), 3 (storage)
product_family The product's family flag 0, 1, 2, 3, 4
base_storage The amount of storage space, in bytes, the product comes with integer
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Example 1: (Success with JSON)

Request
HTTPS://dev.mediafire.com/api/billing/get_invoice.php?session_token=&response_format=json&signature=
Response
{
   action: billing/get_invoice,
   invoice:{
      invoice_num: 826PZI4,
      payment_method: authnet,
      recurring_status: Active,
      recurring_profile_id: 3097,
      date_created: 2015-01-28 18:11:42,
      company_id: 0,
      product_id: 125,
      product_description: MediaFire Business account with 1TB of space. 50% off recurring amount!,
      country: ,
      initial_amount: 49.99,
      initial_tax: 0.00,
      initial_total: 49.99,
      recurring_amount: 24.99,
      recurring_tax: 0.00,
      recurring_total: 24.99,
      recurring_startdate: 2015-02-28 00:00:00,
      recurring_enddate: 0000-00-00 00:00:00,
      next_bandwidth: 2014-09-03 23:17:06,
      previous_invoice: 82827,
      promo_code: ,
      product:{
         product_id: 125,
         description: MediaFire Business account with 1TB of space. 50% off recurring amount!,
         short_description: Business Monthly 1TB,
         initial_amount: 49.99,
         initial_units: 10737418240000,
         is_recurring: 1,
         recurring_amount: 24.99,
         recurring_units: 10737418240000,
         free_months: 1,
         trial: 0,
         active: 1,
         frequency_text: Monthly,
         uses_credits: 0,
         reseller_entitlement: -1,
         payment_methods: 0,
         yearly_only: ,
         interval: 1,
         legacy: 0,
         product_class: 1,
         product_family: 2,
         base_storage: 1073741824000,
      }
   }
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Get Plans


GET https://www.mediafire.com/api/1.3/billing/get_plans.php
POST https://www.mediafire.com/api/1.3/billing/get_plans.php

Description : Returns a list of the current active plans together with their important attributes.

Required Parameters:

  • none

Relative Parameters:

  • none

Optional Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature). NOT IN USE
  • family : If given, returns only products within this product family. Otherwise all product families are returned. Values are: 0, 1, 2, 3, 4
  • product_id : ID of the Product (plan) for which the user wants to retrieve information. If there is no product_id, API will return information about all the active products (plans).
  • response_format : 'xml' or 'json' (default 'xml')

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Response Properties

Name Description Type Values
product_id The ID of the product integer
description The description of the product string
short_description The shortened version of description string
initial_amount The initial purchase price of the product
initial_units The initial bandwidth, in bytes, included with the product integer
is_recurring Specifies whether the product re-bills. 0=no, 1=yes flag 0, 1
recurring_amount The re-bill price of the product in this invoice
recurring_units The amount of bandwidth disbursed to the account each month
frequency_text The human friendly interval string
product_class The product's type flag 1 (base), 2 (bandwidth), 3 (storage)
free_months The number of months included with this product integer
interval The product billing cycle, in months integer
legacy Specifies whether this product is legacy or not flag 0/1
family The product's family flag 0, 1, 2, 3, 4
base_storage The amount of storage space, in bytes, the product comes with integer
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 168
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Example 1: (Success with product_id=123)

Request
HTTPS://www.mediafire.com/api/billing/get_plans.php?product_id=123&response_format=json
Response:
{
   action: billing/get_plans,
   products:[
      {
         product_id: 123,
         description: MediaFire Pro account with 1000GB of space. 50% off recurring amount!,
         short_description: Pro 1000GB Monthly,
         initial_amount: 4.99,
         initial_units: 1073741824000,
         is_recurring: 1,
         recurring_amount: 2.49,
         recurring_units: 1073741824000,
         frequency_text: 1 Month,
         product_class: 1,
         free_months: 1,
         interval: 1,
         legacy: 0,
         family: 4,
         base_storage: 1073741824000,
      }
   ]
   result: Success,
   current_api_version: 1.3,
}

Example 2: (Success with XML - family=0)

Request
HTTPS://www.mediafire.com/api/billing/get_plans.php?family=0&response_format=xml
Response:
<action>billing/get_plans</action>
<products>
   <product>
      <product_id>66</product_id>
      <description>Free MediaFire Plan with up to 50GB of free space (starts at 10GB).</description>
      <short_description>Free</short_description>
      <initial_amount>0.00</initial_amount>
      <initial_units>0</initial_units>
      <is_recurring>0</is_recurring>
      <recurring_amount>0.00</recurring_amount>
      <recurring_units>0</recurring_units>
      <frequency_text>Monthly</frequency_text>
      <product_class>1</product_class>
      <free_months>0</free_months>
      <interval>0</interval>
      <legacy>0</legacy>
      <family>0</family>
      <base_storage>10740000000</base_storage>
   </product>
</products>
<result>Success</result>
<current_api_version>1.3</current_api_version>

Example 3: (Failure with JSON - Error 168)

Request
HTTPS://www.mediafire.com/api/billing/get_plans.php?product_id=59&response_format=json
Response:
{
   action: billing/get_plans,
   message: Invalid Product Id,
   error: 168,
   result: Error,
   current_api_version: 1.3,
}

Get Products


GET https://www.mediafire.com/api/1.3/billing/get_products.php
POST https://www.mediafire.com/api/1.3/billing/get_products.php

Description: Returns a resource of plan information that meets the input parameters.

Required Parameters:

  • none

Relative Parameters:


Optional Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.
  • response_format : 'xml' or 'json' (default 'xml')
  • active : 0 or 1
  • legacy : 0 or 1 (always 0 when accessed externally)
  • interval : 0 through 12
  • is_recurring : 0 or 1
  • product_class : 1 through 10
  • product_family : 0 through 10
  • product_id : less than 1000

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Example:

Request
http://www.mediafire.com/api/1.3/billing/get_products.php?session_token=eb69c17146&active=1&product_family=4&product_class=1
Response
<response>
  <action>billing/get_products</action>
  <products>
    <product>
      <product_id>60</product_id>
      <description>MediaFire Personal $18 yearly with 50 GB of cloud storage.</description>
      <short_description>MediaFire Personal Base (1 Year)</short_description>
      <initial_amount>18.00</initial_amount>
      <initial_units>536870912000</initial_units>
      <is_recurring>1</is_recurring>
      <recurring_amount>18.00</recurring_amount>
      <recurring_units>536870912000</recurring_units>
      <free_months>12</free_months>
      <trial>0</trial>
      <active>1</active>
      <frequency_text>Yearly</frequency_text>
      <uses_credits>0</uses_credits>
      <reseller_entitlement>0</reseller_entitlement>
      <payment_methods>0</payment_methods>
      <yearly_only>1</yearly_only>
      <interval>12</interval>
      <legacy>0</legacy>
      <product_class>1</product_class>
      <product_family>4</product_family>
      <base_storage>53687091200</base_storage>
    </product>
  </products>
  <result>Success</result>
  <current_api_version>#CURRENT_API_VERSION#</current_api_version>
</response>

Purchase Plan


GET SSL Required https://www.mediafire.com/api/1.3/billing/purchase_plan.php
POST SSL Required https://www.mediafire.com/api/1.3/billing/purchase_plan.php

Note: This Requires SSL.

Description: Purchases a plan for the user with given payment information.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • pid : The ID of the product being purchased.
  • payment_method : The type of payment (new credit card, or previous credit card). Allowed values: newcredit, prevcredit.

Required Parameters for New Credit Cards:

  • first_name_info : First name of purchaser.
  • last_name_info : Last name of purchaser.
  • address1_info :
  • Address of purchaser.
  • city_info :
  • City of purchaser (US only).
  • state_info : State of purchaser (US only.)
  • zip_info : Zip of purchaser (US only).
  • country_info : Country of purchaser.
  • region_info : Billing region of purchaser (foreign only).
  • postal_code_info :
  • Billing postal code of purchaser (foreign only.)
  • card_number : Credit card number of purchaser.
  • card_code : Card CCV code of purchaser.
  • exp_month : Expiration month of credit card (with leading zero, e.g. '01').
  • exp_year : Expiration year of credit card.

Required Parameters for Previous Credit Cards:

  • prev_card_code : Card CCV code of purchaser.

Required Parameters for Business Account Purchases:

  • subdomain : Subdomain for business account.
  • company : Company name for business account.

Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.


Response Properties

Name Description Type Values
invoice The ID of the invoice created for this transaction integer
created The date and time the invoice was created for this purchase string timestamp
total The total price of the product for this transaction
product The ID of the product purchased in this transaction
premium The premium flag for the account associated with this transaction integer
lastpremium The new next billing date(minus 30 days) for the account string
code The numerical error code for each invalid parameter integer
base_storage The amount of storage space, in bytes, the product comes with integer
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Example 1: (Success with JSON -- payment_method=newcredit)

Request
HTTPS://www.mediafire.com/api/billing/purchase_plan.php?session_token=&pid=123&payment_method=newcredit&first_name_info=MediaFire&last_name_info=Test&address1_info=123 Fake St&city_info=Somewhere&zip_info=12345&state_info=TX&country_info=US&card_number=&card_code=&exp_month=06&exp_year=2016&response_format=json&signature=
                    
Response (Success):
{
   action: billing/purchase_plan,
   invoice: 1095223,
   created: 2015-01-28 18:27:45,
   total: 5.32,
   product: 123,
   premium: 4,
   lastpremium: 2015-01-28 18:27:45,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 2: (Failure with JSON -- Error #196)

Request
HTTPS://www.mediafire.com/api/1.1/billing/purchase_plan.php?session_token=&pid=123&payment_method=newcredit&last_name_info=Test&address1_info=123%20Fake%20St&city_info=Somewhere&zip_info=12345&state_info=TX&country_info=US&postal_code_info=12345&card_number=&card_code=804&exp_month=01&exp_year=2015&response_format=json&signature=
                    
Response (Success):
<action>billing/purchase_plan</action>
<message>The credit card you have entered is invalid</message>
<error>196</error>
<result>Error</result>
<new_key>yes</new_key>
<current_api_version>1.3</current_api_version>