Skip to main content

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.

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.

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 = "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;
}
$Reference = '43997639';
try {
    $invoices = $client->getInvoices($sessionID, $Reference);
}
catch (SoapFault $e) {
    echo "invoices: " . $e->getMessage();
    exit;
}
var_dump("invoices", $invoices);

Partner

Overview

Use the Partner object to search and retrieve partner information.

Structure

Partner Object
PartnerCode String
  Unique identifier that you need to specify when creating a partner in the Control Panel. You can find it under the General Information area when editing partner details.
CompanyName String
  The name of your partner company.
Email String
  The partner email address specified in the Contact Information area.
CommunicationLanguage String
 

ISO 639-1 two-letter language code set for the communication language under Contact information.

Case sensitive: 'en' instead of 'EN'.

 

Possible values:

  • en
  • fr
  • de
Currency String
  The ISO code of the currency set for the partner - ISO 4217. This currency governs transactions between you and the partner. You can configure it in the Commercial settings section, under Payment information.
CreditLimit double
  The credit limit set for the partner. Can be NULL when no credit is offered.
AvailableCreditLimit double
  The credit still available to the partner, after the value of orders already placed but not paid was deducted from the total credit limit configured. Can be NULL when no credit limit is defined.

 

Account Payouts

Overview

Retrieve the account balance from your current payout period, detailed for each billing currency.

You can also search for the historical transfers issued by 2Checkout for your account, and filter the results based on payment date, method or invoice paid.

 

 

Order search options

Overview

Use the OrderSearchOptions object to configure your search order options via JSON-RPC API 6.0.

Object parameters

Parameter name Type Required/Optional Description

ApproveStatus

String

Optional

The desired approved status. Available values: WAITING, OK, FRAUD, INVALIDDATA.

Newer

String

Optional

Needed timestamp. If not provided, will return by default the data for the last 7 days.

Status

String

Optional

Order status. Some of the available options are COMPLETE, PENDING, CANCELED, REFUND.

StartDate

String

Optional

Start date in format Y-m-d. Will overwrite Newer if provided.

EndDate

String

Optional

End date in format Y-m-d.

PartnerOrders

Boolean

Optional

Decide if it will also include partner orders.

ExternalRefNo

String

Optional

The external reference number of the order.

IncludeTestOrders String Optional

Should test orders be included in the result:

Values:

  • YES -  test orders are included
  • NO - test orders are not included
  • ONLY - only the test orders are included
Pagination

Object

Optional

Existing shipping class object with the structure detailed below.

Limit

Int Optional The number of results to be returned

Page

Int Optional The page number

 

 

2Checkout Payment Methods Datasheet

Use local payment methods in conjunction with localization best practices to simplify payments for your international shoppers. But do so keeping in mind the full customer journey from acquisition and conversion through to activation and ultimately retention.

Domestic payment methods are a critical resource to optimize the key stages of transactional processes across the entire customer lifecycle. They fit in the complex puzzle of challenges that includes language and cultural differences, multiple currencies, taxation, user behavior particularities, device and form factor preferences, risk mitigation, legal and regulatory compliance, etc.

Just keep in mind that those so-called “alternative payment methods” can make international customers feel sufficiently “at home” in your shopping cart to result in successful purchases. 

avangate-payment-methods-thumbnail.png

Remove coupon

Overview

Use the deletePromotionCoupon method to remove single or multiple coupons from a promotion.

Parameters

Parameter Type/Description

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to remove coupons from.

promotionCoupon

Required (object)

 

type

Required (string)

 

 

Coupon type. Available values:

  • SINGLE, use in conjunction with Code
  • MULTIPLE, use in conjunction with Codes

 

Code/Codes

Required (string / array of strings)

 

 

Coupon code (for SINGLE) or array of coupon codes (for MULTIPLE).

Response

Parameter Type/Description
promotionCoupon Object

Request

<?php

require ('PATH_TO_AUTH');

// Promotion code corresponding to the promotion you want to remove coupons from
$promotionCode = '';

// Define single coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'SINGLE';
$promotionCoupon->Code = 'YOUR_CODE_HERE';

// Define multiple coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'MULTIPLE';
$promotionCoupon->Codes = ['YOUR_CODE_1', 'YOUR_CODE_2'];

try {
    $updatedPromotion = $client->addPromotionCoupon ($sessionID, $promotionCode, $promotionCoupon);
}

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

var_dump("UpdatedPromotion", $updatedPromotion);

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