Skip to main content

Add a subscription plan/product

 

Use the addProduct method to create subscription plans/products for your Avangate account. 

Parameters

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

Product

Required (object)

 

Use this object to configure your subscription plans/products.

 

You can set all Product parameters except AvangateID. The Avangate system sets the unique product ID. The AvangateID is not editable.

Mandatory parameters

 

ProductName
ProductCode
PricingConfigurations

Response

bool(true)

Request

<?php

$host   = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));


function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}

$merchantCode = "YOURCODE123"; //your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key          = "SECRET_KEY"; //your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')

$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);

try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}

catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}

$Product                 = new stdClass();
$Product->AvangateId     = null;
$Product->ProductCode    = 'API_Imported_1234567899';
$Product->ProductType    = 'REGULAR';
$Product->ProductName    = 'API_Subscription Imported New';
$Product->ProductVersion = '1.0';
$Product->GroupName      = 'General';

//Shipping classes

/* $Product->ShippingClass = new stdClass();
$Product->ShippingClass->Name = '2o9rlujkvg';
$Product->ShippingClass->Amount = 89.40;
$Product->ShippingClass->Currency = 'GBP';
$Product->ShippingClass->ApplyTo = 'ct29dr3fj4';
$Product->ShippingClass->Type = 'bii521vp6k'; */

$Product->GiftOption                 = false;
$Product->ShortDescription           = 'Placeat cumque necessitatibus est minus praesentium ut non quibusdam. Molestias provident tempore eligendi mollitia quia.';
$Product->LongDescription            = 'Corrupti inventore vitae nesciunt ab. Nemo cum non maiores. Non repudiandae est iste voluptatibus.';
$Product->SystemRequirements         = null;
$Product->ProductCategory            = null;
$Product->Platforms                  = array();
$Product->Platforms[0]               = new stdClass();
$Product->Platforms[0]->PlatformName = null;
$Product->Platforms[0]->Category     = null;
$Product->Platforms[1]               = new stdClass();
$Product->Platforms[1]->PlatformName = null;
$Product->Platforms[1]->Category     = null;
$Product->ProductImages              = array();
$Product->ProductImages[0]           = new stdClass();
$Product->ProductImages[0]->URL      = null;
$Product->ProductImages[0]->Default  = false;
$Product->ProductImages[1]           = new stdClass();
$Product->ProductImages[1]->URL      = null;
$Product->ProductImages[1]->Default  = true;
$Product->TrialUrl                   = null;
$Product->TrialDescription           = null;
$Product->Enabled                    = True;

//Product additional fields

/* $Product->AdditionalFields = array();
$Product->AdditionalFields[0] = new stdClass();
$Product->AdditionalFields[0]->Label = 'i44wak1dzp';
$Product->AdditionalFields[0]->Code = 'ITYAK0OEWJ';
$Product->AdditionalFields[0]->Enabled = false;
$Product->AdditionalFields[0]->Required = false;
$Product->AdditionalFields[0]->URLParameter = 'id1ktigl6d';
$Product->AdditionalFields[1] = new stdClass();
$Product->AdditionalFields[1]->Label = 'aig699lmo1';
$Product->AdditionalFields[1]->Code = 'V28TP07PQN';
$Product->AdditionalFields[1]->Enabled = false;
$Product->AdditionalFields[1]->Required = true;
$Product->AdditionalFields[1]->URLParameter = '8to9p6y54j'; */

//Product localization

/* $Product->Translations = array();
$Product->Translations[0] = new stdClass();
$Product->Translations[0]->Name = 'zsg7wtg4e5';
$Product->Translations[0]->Description = 'Voluptate iure ut quam omnis impedit. Deserunt facere id dolores doloribus quis. Minima nostrum ut possimus incidunt vel est sint. Odit tempora omnis iste nesciunt commodi accusantium placeat.';
$Product->Translations[0]->Language = 'pt';
$Product->Translations[0]->LongDescription = 'Pariatur molestiae sit dignissimos modi. Aut modi libero numquam repudiandae. Doloribus explicabo delectus fugiat amet. Excepturi quo consequatur sint adipisci.';
$Product->Translations[0]->SystemRequirements = 'c16tvyg88c';
$Product->Translations[0]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[0]->TrialDescription = 'Voluptas rem sit ut voluptas molestias quidem ut. Maiores facilis tempora voluptates. Consequuntur illum recusandae hic magni iste.';
$Product->Translations[1] = new stdClass();
$Product->Translations[1]->Name = 'cv2sx15aby';
$Product->Translations[1]->Description = 'Ut distinctio asperiores et a placeat voluptatem et. Et eveniet temporibus aut vel. Nemo occaecati praesentium dolor fugiat rerum assumenda expedita.';
$Product->Translations[1]->Language = 'fr';
$Product->Translations[1]->LongDescription = 'Et ut nostrum molestiae voluptates soluta. Molestiae cum in ut qui. Voluptatem voluptates vero odit quia corporis. In impedit eligendi sed expedita nihil temporibus nobis.';
$Product->Translations[1]->SystemRequirements = 'cfv2amk25j';
$Product->Translations[1]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[1]->TrialDescription = 'Voluptatem ut possimus consequatur iste. Recusandae id quia sed quibusdam aut debitis. Cupiditate harum architecto quod quia.'; */


$Product->PricingConfigurations                                     = array();
$Product->PricingConfigurations[0]                                  = new stdClass();
$Product->PricingConfigurations[0]->Default                         = false;
$Product->PricingConfigurations[0]->Code                            = null;
$Product->PricingConfigurations[0]->Name                            = 'API Pricing Configuration Test';
$Product->PricingConfigurations[0]->BillingCountries                = array();
$Product->PricingConfigurations[0]->PricingSchema                   = 'DYNAMIC';
$Product->PricingConfigurations[0]->PriceType                       = 'NET';
$Product->PricingConfigurations[0]->DefaultCurrency                 = 'USD';
$Product->PricingConfigurations[0]->Prices                          = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular                 = array();
$Product->PricingConfigurations[0]->Prices->Regular[0]              = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[0]->Amount      = 100;
$Product->PricingConfigurations[0]->Prices->Regular[0]->Currency    = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Regular[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Regular[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Regular[1]              = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[1]->Amount      = 200;
$Product->PricingConfigurations[0]->Prices->Regular[1]->Currency    = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Regular[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Regular[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal                 = array();
$Product->PricingConfigurations[0]->Prices->Renewal[0]              = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Amount      = 50;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Currency    = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal[1]              = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Amount      = 60;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Currency    = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->PriceOptions                    = array();

/* $Product->BundleProducts = array();
$Product->BundleProducts[0] = new stdClass();
$Product->BundleProducts[0]->ProductCode = '540Q45PQBN';
$Product->BundleProducts[0]->ProductId = 48439;
$Product->BundleProducts[1] = new stdClass();
$Product->BundleProducts[1]->ProductCode = 'PA3JDB5SZ2';
$Product->BundleProducts[1]->ProductId = 46439;
*/
$Product->Fulfillment = 'NO_DELIVERY';
$Product->Prices      = array();

$Product->GeneratesSubscription                            = True;
$Product->SubscriptionInformation                          = new stdClass();
$Product->SubscriptionInformation->DeprecatedProducts      = array();
$Product->SubscriptionInformation->BundleRenewalManagement = null;
$Product->SubscriptionInformation->BillingCycle            = 1;
$Product->SubscriptionInformation->BillingCycleUnits       = 'M';
$Product->SubscriptionInformation->IsOneTimeFee            = false;

$Product->SubscriptionInformation->ContractPeriod                       = new stdClass();
$Product->SubscriptionInformation->ContractPeriod->Period               = -1;
$Product->SubscriptionInformation->ContractPeriod->PeriodUnits          = 'days';
$Product->SubscriptionInformation->ContractPeriod->IsUnlimited          = TRUE;
$Product->SubscriptionInformation->ContractPeriod->Action               = 'RESTART';
$Product->SubscriptionInformation->ContractPeriod->EmailsDuringContract = 'altenwerth.elise@gmail.com';

//$Product->SubscriptionInformation->UsageBilling = 77;

$Product->SubscriptionInformation->GracePeriod              = new stdClass();
$Product->SubscriptionInformation->GracePeriod->Type        = 'GLOBAL';
$Product->SubscriptionInformation->GracePeriod->Period      = 14;
$Product->SubscriptionInformation->GracePeriod->PeriodUnits = 'D';
$Product->SubscriptionInformation->GracePeriod->IsUnlimited = false;

$Product->SubscriptionInformation->RenewalEmails                                               = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Type                                         = 'CUSTOM';
$Product->SubscriptionInformation->RenewalEmails->Settings                                     = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal                      = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before30Days        = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before15Days        = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before7Days         = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before1Day          = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->OnExpirationDate    = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After5Days          = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After15Days         = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal                   = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before30Days     = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before15Days     = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before7Days      = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before1Day       = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After5Days       = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After15Days      = true;

$Product->FulfillmentInformation                                = new stdClass();
$Product->FulfillmentInformation->IsStartAfterFulfillment       = false;
$Product->FulfillmentInformation->IsElectronicCode              = false;
$Product->FulfillmentInformation->IsDownloadLink                = false;
$Product->FulfillmentInformation->IsBackupMedia                 = false;
$Product->FulfillmentInformation->IsDownloadInsuranceService    = false;
$Product->FulfillmentInformation->IsInstantDeliveryThankYouPage = false;
$Product->FulfillmentInformation->IsDisplayInPartnersCPanel     = false;

/* $Product->FulfillmentInformation->CodeList = new stdClass();
$Product->FulfillmentInformation->CodeList->Code = '5C6F821DA1';
$Product->FulfillmentInformation->CodeList->Name = 'General delivery';
$Product->FulfillmentInformation->CodeList->Type = 'STATIC';  */

//$Product->FulfillmentInformation->BackupMedia = new stdClass();

//$Product->FulfillmentInformation->ProductFile = new stdClass();

/* $Product->FulfillmentInformation->AdditionalInformationByEmail = 'arlene03@hotmail.com';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations = array();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Name = 'kbaa1aj7po';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Description = 'Velit delectus sed amet sunt. Sunt deserunt quos recusandae consequuntur est. Velit aut optio error eius rerum. Nihil ipsam possimus ipsum dolores consequatur adipisci.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Language = 'fr';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Name = 'l4ocvz9wwa';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Description = 'Esse voluptatem delectus officiis eos quas asperiores. Quas non hic reiciendis enim. Consequatur similique recusandae laboriosam et autem.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Language = 'pt';
$Product->FulfillmentInformation->AdditionalThankYouPage = 'rvlhvkmxkp';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations = array();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Name = 'rl981w4nua';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Description = 'Qui explicabo molestiae dolorem consequuntur. Ullam maiores temporibus vitae. Totam eos et consequatur. Est sit minima animi nam ut aut.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Language = 'en';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Name = 'qye8hlwz3e';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Description = 'Id est rerum deserunt non et quia magnam. Minus aut nostrum dicta est officiis quia. Commodi nobis sit porro accusamus rerum quis. Fugit et asperiores eum.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Language = 'fr';
*/


try {
    $NewSubscriptionPlan = $client->addProduct($sessionID, $ProdbyCode);
}

catch (SoapFault $e) {
    echo "AddedProductInfo: " . $e->getMessage();
    exit;
}
var_dump("AddedProductInfo", $NewSubscriptionPlan);
?>

Add additional fields

Overview

Use the addAdditionalField method to create new additional fields for your account.

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

AdditionalField

Object

 

Additional field object.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$AdditionalField                             = new stdClass();
$AdditionalField->Label                      = 'Do you agree with the new newsletter policy 2015?';
$AdditionalField->Type                       = 'LISTBOX';
$AdditionalField->Code                       = 'NewsletterPolicy1234576';
$AdditionalField->ApplyTo                    = 'ORDER';
$AdditionalField->Values                     = array();
$AdditionalField->Values[0]                  = 'YES';
$AdditionalField->Values[1]                  = 'NO';
$AdditionalField->ValidationRule             = null;
$AdditionalField->Translations               = array();
$AdditionalField->Translations[0]            = new stdClass();
$AdditionalField->Translations[0]->Label     = "Êtes-vous d'accord avec la politique de la newsletter?";
$AdditionalField->Translations[0]->Values    = array();
$AdditionalField->Translations[0]->Values[0] = 'Oui';
$AdditionalField->Translations[0]->Values[1] = 'Non';
$AdditionalField->Translations[0]->Language  = 'fr';
$AdditionalField->Translations[1]            = new stdClass();
$AdditionalField->Translations[1]->Label     = 'Haben Sie mit dem Newsletter Politik zu?';
$AdditionalField->Translations[1]->Values    = array();
$AdditionalField->Translations[1]->Values[0] = 'Ja';
$AdditionalField->Translations[1]->Values[1] = 'Nein';
$AdditionalField->Translations[1]->Language  = 'de';

try {
    $NewAdditionalField = $client->addAdditionalField($sessionID, $AdditionalField);
}

catch (SoapFault $e) {
    echo "NewAdditionalField: " . $e->getMessage();
    exit;
}

var_dump("NewAdditionalField", $NewAdditionalField);


?>

 

Subscription history

Overview

Retrieve information about a subscription. Subscriptions can be retrieved starting with 5 minutes after their orders are generated in the 2Checkout system.

Parameters

Parameters Type/Description

ReferenceNo

String

 

Unique, system-generated order reference number.

Type

String

 

Purchase type:

  • SALE
  • RENEWAL
  • UPGRADE

SubscriptionReference

String

 

Unique, system-generated subscription reference.

StartDate

String

 

Subscription start date(YYYY-MM-DD) - StartDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the StartDate you provide must be in accordance with your custom configuration.

ExpirationDate

String

 

Subscription expiration date(YYYY-MM-DD) - ExpirationDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.

Lifetime

Boolean

 

Possible values:

  • True – the subscription is evergreen

False – the subscription has a recurring billing cycle less than or equal to three years.

SKU

String

 

Stock keeping unit you defined.

DeliveryInfo

Object

 

Object with information about the delivery made to the customer - structure described below

PartnerCode

String

 

Possible values:

  • Empty = ecommerce order
  • Partner Code

 

1099-K Form Requirements

Overview

The United States Government has enacted a law (Internal Revenue Code Section 6050W) which requires payment processors to send an IRS the 1099-K form annually, to all US sellers starting with 2011.

The 1099-K form, Payment Card and Third Party Network Transactions is an IRS information return used to report certain payment transactions to improve voluntary tax compliance.

Read the instructions below on how to update your 2Checkout account to meet these requirements. 

 

Recommended resources

Availability

Form 1099-K applies to all US sellers.

2Checkout requirements

2Checkout will ask affected Sellers/Merchants to confirm and/or update their 2Checkout account by providing a tax ID number and the appropriate corresponding contact information.

Your tax ID number is one of these:

• Your Social Security Number (SSN)

• Your Employer Identification Number (EIN)

• Your Individual Tax Identification Number (ITIN)

Please use the guidelines below to determine which tax ID number to provide.

  • Business Entities with an EIN

Provide your company EIN and company name.

  • Sole Proprietors with an EIN

Provide your company EIN and your own name.

  • Individual Sellers and Sole Proprietors without an EIN

Provide your SSN or ITIN and your own name.

2Checkout will also need affected Sellers/Merchants to confirm that their account name matches the tax ID number provided and to confirm their physical address so that if Form 1099-K is issued, we can report your information accurately to the IRS.

Updating the 2Checkout account

Follow these steps to update your 2Checkout account in order to meet the fiscal compliance requirements.

1. Log in to your Merchant Control Panel account.

2. Click the Settings tab.

form1099Kcpanel.png

3. In the Account Settings page, click on the Edit Details tab, under Account Information.

form1099Kcpanel1.png

4. On the Account Information page, edit the necessary details, and confirm your account information is correct.

5. Click Update at the bottom of the page to save your new settings.

6. Confirm that the Company Name listed is correct. If your company is incorporated, make sure that the company name listed on your 2Checkout Account is exactly as it is listed on your incorporation documents. If your Company name is incorrect on this page, send an email to supportplus@2checkout.com for assistance in updating this field.

7. Confirm that the Business Office E-mail, Mailing Address, and Physical Address listed on the account are correct. Update if necessary. If the physical address listed on this page is incorrect, send an email to supportplus@2checkout.com for assistance in updating this field.

FAQs

1. How do I receive my 1099-K form?

The platform will automatically generate the PDF for the 1099-K form for all merchants. You will receive an email notification that the file was generated and you will be able to download the file from your Merchant Control Panel, under Account information → Edit account information.

Every year 2Checkout will generate a file for the IRS that will contain all your payments from the previous year.

2. What if I don’t provide my Tax ID number?

If 2Checkout is unable to verify your information because it is incorrect or incomplete, your account will be put in a Restricted status, so you will not be able to receive payouts. The restriction will end once you provide your tax ID number and corresponding contact information, and your information is verified by the IRS matching system.

If you need additional information about this law you can read more details on the IRS website.

Extract invoices

Overview

Use the getInvoices method to extract shopper invoices from the Avangate system based on unique order references. The method returns the binary code for invoices in the PDF file format, Base64 encoded (Base64 is used to represent binary data in the ASCII string format).

getInvoices works for COMPLETE orders for which an invoice was already issued. For refunded orders, getInvoices provides two shopper invoices, one for the original order and the second for the refund, reflecting the repayment made.

In the case of cross-selling orders which contain products from different merchants, getInvoice enables you to re-send only the invoices for your own offerings.

Parameters

Parameters

Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

RefNo

Required (string)

 

Unique, system generated reference for orders.

Request

Response

InvoicesData

Array of objects

 

 

Details below.

 

Sale

String

 

 

Base64 encoded PDF file containing an invoice for a Complete order.

 

Cancellation

String

 

 

Base64 encoded PDF file containing a cancellation invoice.

 

Refunds

Array of string

 

 

Base64 encoded PDF files containing invoices for Refunds.


<?php
 
 
function callRPC($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
 
 
    if ($Debug) {
        $RequestString;
    }
    $ResponseString = curl_exec($curl);
    if ($Debug) {
        $ResponseString;
    }
 
    if (!empty($ResponseString)) {
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
        }
    } else {
        return null;
    }
}
 
$host = 'https://api.avangate.com/rpc/3.0/';
 
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
 
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
 
$i = 1; // counter for api calls
// call login
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
 
$sessionID = callRPC($jsonRpcRequest, $host);
 
var_dump($sessionID);
$Reference = '43997639';

$jsonRpcRequest = array (
'method' => 'getInvoices',
'params' => array($sessionID, $Reference),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

 

SimpleProduct Object Structure

Parameters

Parameter Type/Descriptio
ProductId Int
  Unique Avangate Product ID.
ProductCode String
  Unique Product Code.
ProductName String
  Product Name
ProductType String
  Possible values: REGULAR or BUNDLE
ProductVersion String
  Product version. Can be NULL.
ProductImage String
  URLs to the product image uploaded into the Avangate platform. Can be NULL.
Price Double
  Product price calculated using the configuration of pricing options from the pricing list.
Currency String
  The ISO code of the currency set for the partner - ISO 4217.
PriceType String
  Possible values NET or GROSS.

 

Retrieve wire transfer details

Overview

Retrieve the wire payment details that partners need to use to pay for partner invoices.

Requirements

Next, use setProforma to identify a specific partner invoice.

Parameters

Parameter Type/Description
sessionID Required (String)
  Session identifier string, output of the Login method. An exception is thrown if the values are incorrect.
refNo Required (String)
  Order reference number of an order that was marked with WIRE as payment method.

Response

Parameters Type/Description

WirePaymentDetails

Object

 

Details below

 

Amount

Double

 

 

The total costs incurred by the partner for a partner invoice invoice.

 

Currency

String

 

 

Order currency ISO code - ISO 4217.

 

PaymentReference

String

 

 

Transaction identifier.

 

RoutingNumber

String

 

 

Identification number assigned to financial institutions.

 

BankAccounts

Array of objects

 

 

Array of BankAccountDetails objects with the structure detailed below. Can be NULL.

 

 

Beneficiary

String

 

 

 

Payment beneficiary name. Can be NULL.

 

 

BankName

String

 

 

 

Beneficiary bank name. Can be NULL.

 

 

BankCountry

String

 

 

 

Beneficiary bank country. Can be NULL.

 

 

BankCity

String

 

 

 

Beneficiary bank city. Can be NULL.

 

 

BankAddress

String

 

 

 

Beneficiary bank address. Can be NULL.

 

 

BankAccount

String

 

 

 

Beneficiary bank account number. Can be NULL.

 

 

BankAccountIban

String

 

 

 

Beneficiary IBAN. Can be NULL.

 

 

BankAccountSwiftCode

String

 

 

 

Beneficiary SWIFT code. Can be NULL.

 

 

Currency

String

 

 

 

Bank account currency ISO code – ISO 4217. Can be NULL.

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner

$proformaNumber = 'YOUR_PROFORMA_NUMBER';

try {
    $Proforma= $client->setProforma ($sessionID, $proformaNumber);
} catch (SoapFault $e) {
    echo "ProformaOutput: " . $e->getMessage();
    exit;
}
var_dump ("ProformaOutput", $Proforma);


$paymentDetails = new stdClass();
$paymentDetails->Type = 'WIRE';
$paymentDetails->Curency = 'YOUR_CURRENCY';
$paymentDetails->CustomerIP = 'CUSTOMER_IP';

try {
    $PaymentDetailsSet= $client->setPaymentDetails($sessionID, $paymentDetails);
} catch (SoapFault $e) {
    Echo "Payment: " . $e->getMessage();
    exit;
}
var_dump ("Payment", $PaymentDetailsSet);

try {
    $ProformaPay= $client->payProforma($sessionID);
} catch (SoapFault $e) {
    Echo "ProformaPaid: " . $e->getMessage();
    exit;
}
var_dump ("ProformaPaid ", $ProformaPay);

$refNo = 'YOUR_ORDER_REFNO'

try {
    $client->getWirePaymentDetails ($sessionID, $refNo);
} catch (SoapFault $e) {
    echo "Error: " . $e->getMessage();
}

 

Errors

Error Description

INVALID_PARTNER

No partner is set.

PAYMENT_PROFORMA

You have to set a partner invoice first.

PAYMENT_NOT_SUPPORTED

The current partner invoice is not set as payable through wire.

 

Place an order with PayPal

Request

<?php

//The following script let's you place an new order with Credit/Debit cards as the payment method

$host   = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));
function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);
try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}
$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'FirstName';
$Order->BillingDetails->LastName = 'LastName';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'PAYPAL';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->Email = 'email@avangate.com';
$Order->PaymentDetails->PaymentMethod->ReturnURL = 'http://YourReturnURL.com';
$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
try {
    $newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
    echo "newOrder: " . $e->getMessage();
    exit;
}
var_dump("newOrder", $newOrder);

$url = $newOrder->PaymentDetails->PaymentMethod->RedirectURL;

header ("Location: $url");

W-8 and W-9 fiscal forms

In order to be compliant with the fiscal regulations in the United States, our merchants need to have the W-8/W-9 forms agreed and digitally signed.

What is the W-8 form?

The W-8 form is an Internal Revenue Service (IRS) form that is used to exempt non-US residents from submitting U.S. tax return reporting. Merchants that are registered outside the United States, but that run financial operations in US dollars are required to fill in and sign this form. These merchants (businesses or individuals) are not subjected to standard taxation practices as their investment income is not taxed.

The W-8 form is submitted by merchants only to financial companies that request it (payment processors like 2Checkout) and not directly to the IRS. Merchants that fail to submit the W-8 form can incur a 30% tax withholding and additional penalties.

Who does the W-8 form apply to?

The form applies to non-US residents, namely to foreign entities (foreign individuals or corporations) and exempt foreigners who are neither U.S. citizens nor reside in the US.

There are a variety of W-8 forms and if you are not entirely sure which one applies to you, visit the IRS website for more information.

What is the W-9 form?

The W-9 form is an Internal Revenue Service (IRS) form, also known as a Request for Taxpayer Identification Number (TIN) and Certification form, that is used solely to confirm a person’s taxpayer identification number (TIN).

Any corporation that is required to submit a 1099 form with the IRS must obtain and confirm your correct TIN to report any taxable earnings that may require you to submit a federal tax return.

The TIN holder is responsible for paying all the required taxes based on earnings reported in the provided W-9 form unless the taxpayer is subject to backup withholding. If this is the case, the W-9 form will have to include all the related details.

Who does the W-9 form apply to?

Individuals (merchants) who have US citizenship or reside in the US or entities (corporations and companies) registered in the US are required to fill in and sign this form.

Signing the W-8/W-9 forms on the 2Checkout platform

All merchants signed under Avangate Inc. or 2Checkout Inc. are required to fill in and digitally sign the W-8/W-9 forms and submit them to 2Checkout. Follow the steps below to sign the fiscal forms.

  1. After the onboarding process is completed and your account is approved by the Underwriting team, you (merchant) need to fill in the fiscal compliance form that applies to you (either W-8 or W-9). If your account has not been approved yet by the Underwriting team, you will notice that your account is in RESTRICTED mode until you finalize the submission of the required fiscal forms.
This form can be filled in only by the master account that belongs to the account holder.

2. To sign the W-8/W-9 forms, log in to your master account in the cPanel and click on the Complete now link.

W9_2.png

3. Before submitting the W-9 form, make sure that all the personal and company information you provided is correct. If you notice that some of the information is not correct, contact supportplus@2checkout.com to help you make the necessary changes. Note that any detail changes in the Control Panel (Access the user settings, Account information, Edit account information) will automatically invalidate the forms.

4. Select the I certify that I have the capacity to sign for entity identified above checkbox and then click on the Accept and submit button.

w9_5_fin.png

5. After submitting the form, a message will be displayed on top of the page informing you that form was successfully submitted, as shown in the image below.

w9_4_fin.png

6. To access your W-8/W-9 forms and to verify you have submitted them, navigate to Settings → Account information → Edit account information → IRS Forms section.

W9_6_fin.png

7. After submitting the fiscal compliance form, you will become fiscal compliant and your account will be displayed as ACTIVE.

FAQs

  • How long will my account be Restricted with reason code 406 Fiscal Sign?

Your account will be in Restricted mode until you’ve accepted, signed and submitted the fiscal forms.

  • How many notifications to sign the forms will I receive?

You will receive a notification once a week.

  • What happens when the forms expire?

Your account will be put in Restricted mode with reason code 406 Fiscal Sign and the notification process will restart.

If you need additional information about this law you can read more details on the IRS website.

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