api guide v1 - icepayoctober 15, 2015 – icepay api guide v1.3 1. getting started with the icepay...

30
API Guide V1.3

Upload: others

Post on 07-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

API Guide

V1.3

Page 2: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

2 October 15, 2015 – ICEPAY API Guide V1.3

Table of Contents

Table of Contents ....................................................................................................................................................................... 2

1. Getting started with the ICEPAY API ................................................................................................................................... 4

2. ICEPAY Postbacks ................................................................................................................................................................ 4

3. ICEPAY Class - This is the base class for all ICEPAY subclasses. ............................................................................................ 5

Methods .......................................................................................................................................................................................... 5

4. ICEPAY_CC Class – For global credit card payments ............................................................................................................ 9

Methods .......................................................................................................................................................................................... 9

Examples ....................................................................................................................................................................................... 10

5. ICEPAY_DDebit Class – For Dutch Direct Debits ................................................................................................................ 11

Methods ........................................................................................................................................................................................ 11

Examples ....................................................................................................................................................................................... 11

6. ICEPAY_DirectEBank Class – For SOFORT Banking (Direct E-banking) payments ............................................................... 12

Methods ........................................................................................................................................................................................ 12

7. ICEPAY_GiroPAY Class – For German GIROPAY payments ................................................................................................. 13

Methods ........................................................................................................................................................................................ 13

8. ICEPAY_iDEAL Class – For Dutch iDEAL Payments ............................................................................................................. 14

Methods ........................................................................................................................................................................................ 14

Examples ....................................................................................................................................................................................... 15

9. ICEPAY_MisterCash Class – For payments with Mister Cash ............................................................................................. 16

Methods ........................................................................................................................................................................................ 16

Examples ....................................................................................................................................................................................... 17

10. ICEPAY_PayPal Class – For payments with PayPal. ........................................................................................................ 18

Methods ........................................................................................................................................................................................ 18

11. ICEPAY_PaySafeCard Class – For payments with PaySafeCard. ..................................................................................... 19

Methods ........................................................................................................................................................................................ 19

12. ICEPAY_Phone Class – For global phone payments. ...................................................................................................... 20

Methods ........................................................................................................................................................................................ 20

Examples ....................................................................................................................................................................................... 20

Page 3: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

3 October 15, 2015 – ICEPAY API Guide V1.3

13. ICEPAY_SMS Class – For SMS Payments ........................................................................................................................ 21

Methods ........................................................................................................................................................................................ 21

14. ICEPAY_Wire Class - For global wire transfer payments. ............................................................................................... 22

Methods ........................................................................................................................................................................................ 22

Examples ....................................................................................................................................................................................... 22

15. Basic Tutorial - This is the base class for all ICEPAY subclasses. ..................................................................................... 24

16. Successful payments - Example page for successful payments. ..................................................................................... 26

17. Cancelled/failed payments – Example page for failed payments .................................................................................. 27

18. Postback – Example page for postbacks ........................................................................................................................ 28

Change log

Version Date (d/m/y) Changes Author

1.3 15/10/2015 Update on page 5, Remark on the SetReference method, the reference should be unique JM

1.2 16/07/2015 Update on page 14, Friesland Bank is removed and replaced by KNAB SC

1.1 21/04/2015 Update made to related document links, changed name of document SC

1.0 09/04/2015 Initial document, content copied from old website, restyled and formatted. SC

Related documents

Title Version Location

Guide to Advanced Implementation Latest https://icepay.com/downloads/tech-docs/ICEPAY-Advanced-Implementation-Guide.pdf

Supported Parameters Sheet Latest https://icepay.com/downloads/tech-docs/icepay_supported_parameters.pdf

Web Service Implementation Guide Latest https://icepay.com/downloads/tech-docs/icepay_webservice.pdf

General Terms and Conditions EN Latest https://icepay.com/downloads/pdf/company/TC-2015-EN.pdf

General Terms and Conditions NL Latest https://icepay.com/downloads/pdf/company/AV-2015-NL.pdf

General Terms and Conditions FR Latest https://icepay.com/downloads/pdf/company/TC-2015-FR.pdf

Page 4: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

4 October 15, 2015 – ICEPAY API Guide V1.3

1. Getting started with the ICEPAY API

There are a few important things you need to know or have done before attempting to integrate online payments:

1. You should be familiar with C#, VB.NET or PHP programming and object-oriented programming concepts

2. You should have some basic HTML knowledge

3. You need to have a basic understanding of the internet

4. You must have downloaded and installed the ICEPAY API

5. You should understand concept of ICEPAY callbacks

2. ICEPAY Postbacks

From the moment you initiate an online payment, ICEPAY will produce postbacks and post them to your website. These

postbacks contain valuable information indicating whether your payment is:

OK Payment has been completed successfully.

Open Payment has not yet been completed. You will receive another

postback in the near future, which will tell you if the payment has

been completed or expired.

Error Payment failed, expired or manually cancelled by the end-user.

Refunded The request refund of the payment has been processed

successfully.

Charged back A charge back for the payment has been requested by the end-

user.

This allows you to build an intelligent system, which can act upon a status change, e.g. synchronize your database, send e-tickets

based on the status, etc.

Page 5: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

5 October 15, 2015 – ICEPAY API Guide V1.3

3. ICEPAY Class - This is the base class for all ICEPAY subclasses. The ICEPAY class is the base class for all other ICEPAY subclasses.

Remarks: You should only be using this class if you want end-users to be redirected to the screen where they will be able to

choose from a list of payment methods.

Methods ICEPAY.Constructor (int merchantID, string secretCode) You will need an API Key in order to call the constructor.

Argument Description

Merchant ID This is part of your API Key

Secret code This is part of your API Key

ICEPAY.SetOrderID (string orderID) Use this method to set the Order ID for a payment. The Order ID can be the ID of your internal database record. You can later use this information in the Postback script to do transaction synchronization between ICEPAY and your database.

Remarks: the Order ID must be unique and its length may not be longer than 10 characters!

ICEPAY.SetReference (string reference) Use this method to set the reference for a payment. The reference is custom information that you want to add to a payment. You can later use this information in the Postback script for your own purposes. Remarks: the reference must be unique.

ICEPAY.SetLogging (bool logging) You can enable or disable logging. Enabling logging would provide you with debug logs, which later can come in handy when you contact technical support. Logging is by default turned OFF.

ICEPAY.SetLoggingDirectory (string loggingDirectory) Set the logging directory path. Please make sure that your website has write access in the specified directory.

ICEPAY.SetStreamMethod (string streamMethod) Set the streaming method to acquire the payment URL. By default, the streaming method is FOPEN. Checks will be made for method availability if the method is not set.

Argument Description

FOPEN Requires the PHP FOPEN library to be installed and compiled.

cURL Requires the PHP cURL library (client URL) to be installed and compiled.

file_get_contents Requires the PHP file_get_contents library to be installed and compiled.

ICEPAY.Pay (string country, string language, string currency, int amount, string description) Calling the Pay method will return you a URL to the ICEPAY payment selection screen. You can use this URL to automatically redirect the end-user to the payment selection screen. On the payment selection screen, the end-user can make a selection from a list of available payment methods. By setting the arguments such as country, language, etc. you will be able to influence the list of available payment methods. For instance, if you provide U.S. dollar (USD) as the currency, then the iDEAL payment method will disappear from the list, as this payment method does not support the U.S. dollar currency. For a complete overview of all the supported parameters and currency's you can consult the following document: Supported Parameters

Page 6: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

6 October 15, 2015 – ICEPAY API Guide V1.3

Argument Description

Country Specifies the country. The following countries are supported: 00 Country does not matter

NL Netherlands

AT Austria

AU Australia

BE Belgium

CA Canada

CH Switzerland

CZ Czech Republic

DE Germany

ES Spain

FR France

IT Italy

LU Luxembourg

PL Poland

PT Portugal

SK Slovakia

GB United Kingdom

US United States

Remarks: payment methods that are not supported in the specified country will disappear from the payment selection screen

Language Specifies the language of the payment selection screen. Payment methods that do not support the language will disappear from the list

Currency Specifies the currency of the payment. The following currencies are supported: GBP Pound sterling

EUR Euro

USD U.S. dollar

Remarks: payment methods that do not support the specified currency will disappear from the payment selection screen

Amount Specifies the amount (in cents) of the payment. Payment methods that do not support the specified amount will disappear from the payment selection screen

Page 7: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

7 October 15, 2015 – ICEPAY API Guide V1.3

Description Specifies the description of the payment

ICEPAY.OnSuccess () Your Success URL should be calling this method to check if it is actually called by ICEPAY. Returns True if the call is valid, otherwise False. ICEPAY.OnError () Your Error URL should be calling this method to check if it is actually called by ICEPAY. Returns True if the call is valid, otherwise False. ICEPAY.GetData () Returns information for the Success URL or Error URL.

Field Description

status Can be any of the following values:

statusCode A description of the status.

merchant This is the merchant ID that is part of your API Key.

orderID This is the order ID generated by ICEPAY. You can safely ignore this.

paymentID Please mention this value when you ever contact ICEPAY support regarding a payment.

reference This is the reference of the payment that you may have set using the SetReference method (see above)

transactionID This is the transaction ID generated by the issuer.

ICEPAY.OnPostback () Your Postback URL should be calling this method to check if it is actually called by ICEPAY. Returns True if the call is valid, otherwise False. ICEPAY.GetPostback () This method returns the Postback information posted by ICEPAY. The Postback information contains valuable information regarding the payment.

In .NET, this information will be returned as an ICEPAY.ICEPAY.Postback Type.

In PHP, this information will be returned as an array.

Page 8: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

8 October 15, 2015 – ICEPAY API Guide V1.3

Field Description

Status Contains the status of the payment. You can expect one of the following string values:

OK Payment completed OPEN Payment not yet completed. Expect another postback in the near future. ERR Payment was cancelled, has failed or expired. REFUND Payment was refunded by the merchant. CBACK Payment was charged back by the end-user.

statusCode A description of the status.

Merchant This is the merchant ID that is part of your API Key.

orderID This is the order ID generated by ICEPAY. You can safely ignore this.

paymentID This is the ICEPAY transaction ID. Please mention this value when you ever contact ICEPAY support regarding a payment.

Reference This is the reference of the payment that you may have set using the SetReference method (see above).

transactionID This is the transaction ID generated by the issuer.

consumerName The name of the end-user. This information is only available for iDEAL payments and wire transfers.

consumerAccountNumber The account number of the end-user. Only the last four digits is available. This information is only available for wire transfers.

consumerAddress Address of the end-user.

consumerHouseNumber Address' house number of the end-user.

consumerCity City in which the end-user resides.

consumerCountry Country in which the end-user resides.

consumerEmail E-mail of the end-user.

consumerPhoneNumber Phone number of the end-user.

consumerIPAddress IP address of the end-user.

Amount Amount that is paid by the end-user.

Currency The money that a country uses: a specific kind of money.

Page 9: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

9 October 15, 2015 – ICEPAY API Guide V1.3

Duration The call duration in seconds. This information is only available for phone payments.

paymentMethod Specifies which payment method was used for this payment, e.g. CREDITCARD, IDEAL, etc.

4. ICEPAY_CC Class – For global credit card payments

The ICEPAY_CC class allows you to initiate credit card payments.

Methods

ICEPAY_CC.Pay ( string issuer , string language , string currency , int amount , string description )

Calling the Pay method will return you a URL to the credit card payment screen. You can use this URL to automatically redirect the

end-user.

Argument Description

Issuer Specifies the issuer that should be handling the credit card payment. The following issuers are

supported:

AMEX American Express

MASTER MasterCard

VISA Visa

Language Specifies the language of the payment screen. The following languages are supported:

DE German

EN English

NL Netherlands

Currency Specifies the currency of the payment. The following currencies are supported:

GBP Pound sterling

EUR Euro

USD U.S. dollar

Amount Specifies the amount (in cents) of the payment.

Description Specifies the description of the payment.

Page 10: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

10 October 15, 2015 – ICEPAY API Guide V1.3

Examples

Below you will find an example of how to initiate a credit card payment. The issuer that will be handling the payment is American Express.

The payment screen language is Dutch. The amount to be charged is GBP 4.00.

PHP

C#

VB.NET

require_once( "icepay.php" );

$cc = new ICEPAY_CC( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $cc->Pay( "AMEX", "NL", "GBP", 400, "Example product worth 4 GBP" );

header( "location: " . $url );

ICEPAY.ICEPAY_CC cc = new ICEPAY.ICEPAY_CC( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

string url = cc.Pay("AMEX", "NL", "GBP", 400, "Example product worth 4 GBP");

Response.Redirect(url);

Dim cc as new ICEPAY_CC(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

Dim url as string = cc.Pay("AMEX", "NL", "GBP", 400, "Example product worth 4 GBP")

Response.Redirect(url)

Page 11: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

11 October 15, 2015 – ICEPAY API Guide V1.3

5. ICEPAY_DDebit Class – For Dutch Direct Debits

The ICEPAY_DDEBIT class is used to initiate direct debit payments.

Methods

ICEPAY_DDebit.Pay ( string country , string language , string currency , string amount , string description)

Calling the Pay method will return you a URL to the direct debit payment screen. You can use this URL to automatically

redirect the end-user to the payment screen.

Argument Description

Country Specifies the country of the direct debit.

Currently, only NL (The Netherlands) is supported.

Language Specifies the payment screen language.

The following languages are supported:

EN English; NL Dutch

Currency Specifies the currency of the payment.

Currently, only EUR (Euro) is supported.

Amount Specifies the amount (in cents) of the payment.

Description Specifies the description of the payment.

Examples

In the examples below, we will be initiating a direct debit payment of € 30, - and redirecting the end-user to the direct debit

payment screen.

PHP

C#

require_once( "icepay.php" );

$cc = new ICEPAY_CC( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $cc->Pay( "AMEX", "NL", "GBP", 400, "Example product worth 4 GBP" );

header( "location: " . $url );

ICEPAY.ICEPAY_DDebit dd = new ICEPAY.ICEPAY_DDebit(10000,

"ABcdEFgHIJklmNOPQrSTUvwXyZ");

string url = dd.Pay("NL", "NL", "EUR", 3000, "30 EUR direct debit");

Response.Redirect(url);

Page 12: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

12 October 15, 2015 – ICEPAY API Guide V1.3

VB.NET

6. ICEPAY_DirectEBank Class – For SOFORT Banking (Direct E-banking)

payments

The ICEPAY_DirectEBank class allows you to initiate SOFORT Banking (Direct E-Banking) payments.

Methods ICEPAY_DirectEBank.Pay (string country, string language, string currency, int amount, int string description)

Calling the Pay method will return you a URL to the SOFORT Banking (Direct E-Banking) payment screen. You can use this URL to

automatically redirect the end-user.

Argument Description

Country Specifies the country of the end-user.

AT Austria BE Belgium CH Switzerland DE Germany GB Great Britain

Language Specifies the payment screen language.

DE German EN English FR French NL Dutch

Currency Specifies the currency of the payment. The following currencies are supported:

GBP Pound sterling EUR Euro

Amount Specifies the amount (in eurocents) of the payment.

The minimum amount is 30 eurocents. The maximum amount is 1000000 eurocents.

Description Specifies the description of the payment.

Dim dd as new ICEPAY.ICEPAY_DDebit(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

Dim url as string = dd.Pay("NL", "NL", "EUR", 3000, "30 EUR direct debit")

Response.Redirect(url)

Response.Redirect(url);

Page 13: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

13 October 15, 2015 – ICEPAY API Guide V1.3

7. ICEPAY_GiroPAY Class – For German GIROPAY payments

The ICEPAY_GiroPAY. Pay class allows you to initiate GIROPAY payments.

Methods

ICEPAY_GiroPAY. Pay ( int amount, string description )

Calling the Pay method will return you a URL to the GIROPAY payment screen. You can use this URL to automatically redirect the end-user.

Argument Description

Country Specifies the country of the end-user.

Currently, only DE (Germany) is supported.

Language Specifies the payment screen language.

Currently, only DE (German) is supported.

Currency Specifies the currency of the payment.

Currently, only EUR (Euro) is supported.

Amount Specifies the amount (in eurocents) of the payment.

The minimum amount is 30 eurocents. The maximum amount is 1000000 eurocents.

Description Specifies the description of the payment.

Page 14: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

14 October 15, 2015 – ICEPAY API Guide V1.3

8. ICEPAY_iDEAL Class – For Dutch iDEAL Payments

The class ICEPAY_iDEAL allows you to easily initiate an iDEAL payment with just a few lines of code.

Remarks: iDEAL only supports the Euro currency and the Dutch language interface. Therefore, you cannot set these two parameters.

Methods

ICEPAY_iDEAL.Pay ( string issuer , int amount , string description )

Calling the Pay method will return you a URL to the iDEAL payment screen. You can use this URL to automatically redirect the end-

user to the iDEAL payment screen.

Argument Description

Issuer Specifies the bank that will be handling the iDEAL payment.

The following banks are supported:

ABNAMRO ABN AMRO Bank

ASNBANK ASN Bank

KNAB KNAB

ING ING Bank

RABOBANK Rabobank

SNSBANK SNS Bank

SNS Regio Bank SNS Regio Bank

TRIODOSBANK Triodos Bank

VANLANSCHOT Van Lanschot Bankiers

Amount Specifies the amount (in eurocents) of the payment.

The minimum amount is 30 eurocents. The maximum amount is 1000000 eurocents.

Description Specifies the description of the payment.

Page 15: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

15 October 15, 2015 – ICEPAY API Guide V1.3

Examples

Below you will find an example of how to initiate an iDEAL payment. The issuer that will be handling the payment is the ABN

AMRO bank. The amount to be charged is € 5.

PHP

C#

VB.NET

require_once( "icepay.php" );

$iDEAL = new ICEPAY_iDEAL( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $iDEAL->Pay("ABNAMRO", 500, "iDEAL payment of 5 EUR" );

header( "location: " . $url );

ICEPAY.ICEPAY_iDEAL iDEAL = new ICEPAY_iDEAL(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

String url = iDEAL.Pay("ABNAMRO", 500, "iDEAL payment of 5 EUR");

Response.Redirect(url);

Dim iDEAL as New ICEPAY.ICEPAY_iDEAL(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

Dim url as String = iDEAL.Pay("ABNAMRO", 500, "iDEAL payment of 5 EUR")

Response.Redirect(url)

Page 16: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

16 October 15, 2015 – ICEPAY API Guide V1.3

9. ICEPAY_MisterCash Class – For payments with Mister Cash

The class ICEPAY_MisterCash is used to initiate MisterCash payments.

Methods

ICEPAY_MisterCash.Pay (string country, string language, string amount, string description)

Calling the Pay method will return you a URL to the MisterCash payment screen. You can use this URL to automatically redirect

the end-user to the payment screen.

Argument Description

Country Specifies the country.

Supported countries:

BE Belgium

NL Netherlands

Language Specifies the payment screen language.

Supported languages:

DE German

EN English

FR French

NL Dutch

IT Italian

ES Spanish

JA Japanese

Amount Specifies the amount (in cents) of the payment.

The minimum amount is 200 cents; the maximum amount is 200000 cents.

Description Specifies the description of the payment.

Page 17: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

17 October 15, 2015 – ICEPAY API Guide V1.3

Examples

In the examples below, we will be initiating a MisterCash payment of € 2.00 and redirecting the end-user to the MisterCash

payment screen.

PHP

C#

VB.NET

require_once( "icepay.php" );

$mistercash = new ICEPAY_MisterCash( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $mistercash->Pay( "NL", "EN", 200, "MisterCash payment of 2.00 EUR" );

header( "location: " . $url );

ICEPAY.ICEPAY_MisterCash w = new ICEPAY.ICEPAY_MisterCash( 10000,

"ABcdEFgHIJklmNOPQrSTUvwXyZ" );

string url = w.Pay("NL", "EN", 200, "MisterCash payment of 2.00 EUR");

Response.Redirect(url);

Dim w as new ICEPAY.ICEPAY_MisterCash(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

Dim url as string = w.Pay("NL", "EN", 200, "MisterCash payment of 2.00 EUR");

Response.Redirect(url);

Page 18: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

18 October 15, 2015 – ICEPAY API Guide V1.3

10. ICEPAY_PayPal Class – For payments with PayPal.

The ICEPAY_PayPal class is used to initiate PayPal payments.

Methods

ICEPAY_PayPal.Pay ( string country, string currency, int amount, string description )

Calling the Pay method will return you a URL to the PayPal payment screen. You can use this URL to automatically redirect the end-

user to the payment screen.

Argument Description

Country Specifies the country of the end-user. The country code consists of a 2-letter country code in ISO 3166-1 format such

as NL, DE, UK, BE. You can also use "00" for global coverage.

Currency Specifies the currency of the payment. The following currencies are supported:

GBP Pound sterling

EUR Euro

USD U.S. dollar

Amount Specifies the amount in cents of the payment.

The minimum amount is 30 cents. The maximum amount is 1000000 cents.

Description Specifies the description of the payment.

Page 19: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

19 October 15, 2015 – ICEPAY API Guide V1.3

11. ICEPAY_PaySafeCard Class – For payments with PaySafeCard.

The ICEPAY_PaySafeCard class is used to initiate paysafecard payments.

Methods

ICEPAY_PaySafeCard.Pay ( string currency, int amount, string description )

Calling the Pay method will return you a URL to the paysafecard payment screen. You can use this URL to automatically

redirect the end-user to the payment screen.

Argument Description

Currency Specifies the currency of the payment. The following currencies are supported:

GBP Pound sterling

EUR Euro

USD U.S. dollar

Amount Specifies the amount in cents of the payment.

The minimum amount is 30 cents. The maximum amount is 1000000 cents.

Description Specifies the description of the payment.

Page 20: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

20 October 15, 2015 – ICEPAY API Guide V1.3

12. ICEPAY_Phone Class – For global phone payments.

The ICEPAY_Phone class is used to initiate short phone payments.

Methods

ICEPAY_Phone.Pay ( string country , string language , string currency , string amount , string description)

Calling the Pay method will return you a URL to the phone payment screen. You can use this URL to automatically redirect

the end-user to the payment screen.

Argument Description

Country Specifies the country of the caller.

Language Specifies the payment screen language and voice language.

Currency Specifies the currency of the payment.

Amount Specifies the amount (in cents) of the payment.

Description Specifies the description of the payment.

The phone payment method has more restrictions than other payment methods. The following document shows the

allowed combinations: ICEPAY Supported Parameters Sheet

Examples

PHP

C#

require_once( "icepay.php" );

$p = new ICEPAY_Phone( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $p->Pay( "BE", "EN", "EUR", 125, "Phone payment of 1.25 EUR" );

header( "location: " . $url );

ICEPAY.ICEPAY_Phone p = new ICEPAY.ICEPAY_Phone(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

string url = p.Pay("BE", "EN", "EUR", 125, "Phone payment of 1.25 EUR");

Response.Redirect(url);

Page 21: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

21 October 15, 2015 – ICEPAY API Guide V1.3

VB.NET

13. ICEPAY_SMS Class – For SMS Payments

The ICEPAY_SMS class allows you to initiate SMS payments.

Methods

ICEPAY_SMS.Pay ( string country , string language , string currency , int amount , string description )

Calling the Pay method will return you a URL to the SMS payment screen. You can use this URL to automatically redirect

the end-user.

The SMS payment method has more restrictions than other payment methods. The following document shows the

allowed combinations: ICEPAY Supported Parameters Sheet

Argument Description

Country Specifies the country of the end-user.

Language Specifies the payment screen language and the language of the outgoing SMS message.

The following languages are supported:

EN English

NL Dutch

Currency Specifies the currency of the payment.

Amount Specifies the amount (in cents) of the payment. Please see the next table for more information on the

allowed amounts.

Description Specifies the description of the payment.

ICEPAY.ICEPAY_Phone p = new ICEPAY.ICEPAY_Phone(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

string url = p.Pay("BE", "EN", "EUR", 125, "Phone payment of 1.25 EUR");

Response.Redirect(url);

Page 22: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

22 October 15, 2015 – ICEPAY API Guide V1.3

14. ICEPAY_Wire Class - For global wire transfer payments.

The ICEPAY_Wire class is used to initiate wire transfer payments.

Methods

ICEPAY_Wire.Pay ( string language , string currency , string amount , string description )

Calling the Pay method will return you a URL to the wire transfer payment screen. You can use this URL to automatically

redirect the end-user to the payment screen.

Examples

In the examples below, we will be initiating a Wire Transfer payment of € 0.30 and redirecting the end-user to the wire

transfer payment screen.

Argument Description

Language

Specifies the payment screen language.

Supported languages:

DE German

EN English

ES Spanish

FR French

NL Dutch

Currency

Specifies the currency of the payment.

Supported currencies:

EUR Euro

GBP Pound sterling

USD U.S. dollar

Amount Specifies the amount (in cents) of the payment.

The minimum amount is 30 cents, the maximum amount is 1000000 cents.

Description Specifies the description of the payment.

Page 23: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

23 October 15, 2015 – ICEPAY API Guide V1.3

PHP

C#

VB.NET

require_once( "icepay.php" );

$w = new ICEPAY_Wire( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $w->Pay( "EN", "EUR", 30, "Wire transfer payment of 0.30 EUR" );

header( "location: " . $url );

ICEPAY.ICEPAY_Wire w = new ICEPAY.ICEPAY_Wire( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

string url = w.Pay("EN", "EUR", 30, "Wire transfer payment of 0.30 EUR");

Response.Redirect(url);

Dim w as new ICEPAY.ICEPAY_Wire(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

Dim url as string = w.Pay("EN", "EUR", 30, "Wire transfer payment of 0.30 EUR");

Response.Redirect(url);

Page 24: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

24 October 15, 2015 – ICEPAY API Guide V1.3

15. Basic Tutorial - This is the base class for all ICEPAY subclasses. If you need a payment selection screen, please use this class. This is a basic tutorial, designed to help you get started with the ICEPAY API.

Let us start by initiating a credit card payment of US$ 1.99 that will be handled by VISA. The user interface language will

be in English. We will be using a fictional API key which consists of the ID 10000 and secret code

ABcdEFgHIJklmNOPQrSTUvwXyZ.

The following code will illustrate how to initiate a payment and redirect the end-user to the credit card payment screen:

PHP: default.php

<?php

if ( $_SERVER['REQUEST_METHOD'] == "POST" )

{

require_once( "icepay.php" );

$cc = new ICEPAY_CC( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$url = $cc->Pay( "VISA", "EN", "USD", 199 );

header( "location: " . $url );

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>ICEPAY Demo: Basic Tutorial</title>

</head>

<body>

<form action="default.php" method="post">

<h1>ICEPAY Demo: Basic Tutorial</h1>

<input type="submit" value="Initialize payment" />

</form>

</body>

</html>

Page 25: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

25 October 15, 2015 – ICEPAY API Guide V1.3

C#: default.aspx

VB.NET: default.aspx

As you may have noticed the amount needs to be defined in cents.

<%@ Page Language="C#" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

if (Page.IsPostBack)

{

ICEPAY.ICEPAY_CC ice = new ICEPAY.ICEPAY_CC(10000,

"ABcdEFgHIJklmNOPQrSTUvwXyZ");

Response.Redirect(ice.Pay("VISA", "EN", "USD", 199, "Demo payment"));

}

}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>ICEPAY Demo: Basic Tutorial</title>

</head>

<body>

<form id="form1" runat="server">

<h1>ICEPAY Demo: Basic Tutorial</h1>

<asp:Button ID="Button1" runat="server" Text="Initialize payment" />

</form>

</body>

</html>

<%@ Page Language="vb" %>

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

If Page.IsPostBack Then

Dim ice As New ICEPAY.ICEPAY_CC(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

Response.Redirect(ice.Pay("VISA", "EN", "EUR", 199, "Demo payment"))

End If

End Sub

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>ICEPAY Demo: Basic Tutorial</title>

</head>

<body>

<form id="form1" runat="server">

<h1>ICEPAY Demo: Basic Tutorial</h1>

<asp:Button id="Button1" runat="server" Text="Initialize payment" />

</form>

</body>

</html>

Page 26: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

26 October 15, 2015 – ICEPAY API Guide V1.3

16. Successful payments - Example page for successful payments.

After end-users complete the credit card payment, they will be redirected to a so called Success URL. This is a web page

on your website where you should tell your end-users that the payment has been handled successfully. You can set the

Success URL in your ICEPAY account.

The following code explains how this works. Calling the OnSuccess method returns True if it is an authentic call from

ICEPAY. If so, then you should display your "Thank You" message.

PHP: ok.php

C#: ok.aspx

<?php

require_once( "icepay.php" );

$icepay = new ICEPAY( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

if ( !$icepay->OnSuccess() ) die();

$data = $icepay->GetData();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>OK</title>

</head>

<body>

<?php if ( $data->status == "OK" ): ?>

<h1>Thank You! You have successfully completed the payment!</h1>

<?php endif ?>

</body>

</html>

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

ICEPAY.ICEPAY ice = new ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

if (ice.OnSuccess() && ice.GetData().status == "OK")

pnlThankYou.Visible = true;

}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>OK</title>

</head>

<body>

<form id="form1" runat="server">

<asp:Panel runat="server" Visible="false" ID="pnlThankYou">

<h1>Thank You, your order is complete</h1>

</asp:Panel>

</form>

</body>

</html>

Page 27: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

27 October 15, 2015 – ICEPAY API Guide V1.3

VB.NET: ok.aspx

17. Cancelled/failed payments – Example page for failed payments

Similarly, if a payment did not succeed then end-users will be redirected to a so-called Error URL. This is a web page on your

website where you will tell your end-users that something went wrong. You can set the Error URL in your ICEPAY account.

PHP: error.php

<%@ Page Language="vb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Dim ice As New ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

If ice.OnSuccess AndAlso ice.GetData().status = "OK" Then

pnlThankYou.Visible = True

End If

End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>OK</title>

</head>

<body>

<form id="form1" runat="server">

<asp:Panel runat="server" Visible="false" ID="pnlThankYou">

<h1>Thank You, your order is complete</h1>

</asp:Panel>

</form>

</body>

</html>

<?php

require_once( "icepay.php" );

$icepay = new ICEPAY( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

$data = $icepay->GetData();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Error</title>

</head>

<body>

<h1>Oops, some error occured</h1>

<p>Error description: <?php echo $data->statusCode ?></p>

</body>

</html>

Page 28: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

28 October 15, 2015 – ICEPAY API Guide V1.3

C#: error.aspx

VB.NET: error.aspx

18. Postback – Example page for postbacks

If your website must act upon a payment status change, e.g. send an e-ticket to your customer if the payment is completed, or

update your database, then you must put this business logic in the Postback script. You must never abuse the Success URL or

Error URL for this purpose. The latter two are for presentation purposes only!

Many things can happen to a credit card payment. The end-user may initiate a charge back via the credit card company; the

payment may be cancelled by the end-user, etc. You should take a look at the list of possible postbacks (Point 2).

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected ICEPAY.ICEPAY ice;

protected void Page_Load(object sender, EventArgs e)

{

ICEPAY.ICEPAY ice = new ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Error</title>

</head>

<body>

<h1>Oops, some error occured</h1>

<p>Error description: <%=ice.GetData().statusCode%></p>

</body>

</html>

<%@ Page Language="vb" %>

<script runat="server">

Protected ice As ICEPAY.ICEPAY

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

ice = New ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

End Sub

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Error</title>

</head>

<body>

<h1>Oops, some error occured</h1>

<p>Error description: <%=ice.GetData().statusCode%></p>

</body>

</html>

Page 29: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

29 October 15, 2015 – ICEPAY API Guide V1.3

Your postback script must handle the different types of postback properly.

The following code will illustrate this:

PHP: postback.php

C#: postback.aspx

<?php

require_once( "icepay.php" );

$icepay = new ICEPAY( 10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ" );

if ( $icepay->OnPostback() )

{

$data = $icepay->GetPostback();

switch ( strtoupper($data->status) )

{

case "OK": // Successful payment

break;

case "OPEN": // Payment is not yet completed

break;

case "ERR": // Error happened

break;

case "REFUND": // Merchant did a refund

break;

case "CBACK": // Charge back by end-user

break;

}

}

?>

<%@ Page Language="C#" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

ICEPAY.ICEPAY ice = new ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ");

if (ice.OnPostBack())

{

ICEPAY.ICEPAY.Postback data = ice.GetPostback();

switch (data.status.ToUpper())

{

case "OK": // Successful payment

break;

case "OPEN": // Payment is not yet completed

break;

case "ERR": // Error happened

break;

case "REFUND": // Merchant did a refund

break;

case "CBACK": // Charge back by end-user

break;

}

}

}

</script>

Page 30: API Guide V1 - ICEPAYOctober 15, 2015 – ICEPAY API Guide V1.3 1. Getting started with the ICEPAY API There are a few important things you need to know or have done before attempting

30 October 15, 2015 – ICEPAY API Guide V1.3

VB.NET: postback.aspx

<%@ Page Language="vb" %>

<script runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Dim ice As New ICEPAY.ICEPAY(10000, "ABcdEFgHIJklmNOPQrSTUvwXyZ")

If ice.OnPostBack Then

Dim data As ICEPAY.ICEPAY.Postback = ice.GetPostback()

Select Case data.status.ToUpper()

Case "OK" ' Successful payment

Case "OPEN" ' Payment is not yet completed

Case "ERR" ' Error happened

Case "REFUND" ' Merchant did a refund

Case "CBACK" ' Charge back by end-user

End Select

End If

End Sub

</script>