Introduction

The PNGateway secure API is accessed via standard HTTP POST requests. Each of these requests requires the authentication fields (site_id and password), as well as the type code. If any of these fields are omitted the transaction request will be denied.

We do return a 404 error if the authentication fails or we don’t get a valid “type” parameter.

Currently the ACH integration is unavailable, however, we are attempting to have this finalized as soon as possible.

Credit Card Integration

Sale or Authorization

Request Fields

Field Required Description
site_id Yes Site ID supplied for this account
password Yes API Password supplied for this account
type Yes The type code tells us what type of request this is. ie. Sale, Refund, etc.
See Type Codes.
amount Yes Amount – supplied up to 2 decimal places, ‘.’ used as decimal separator.
currency Yes 3 character currency ISO code. e.g. USD
ip Yes The customer’s IP address.
merchant_reference Yes A unique reference for the transaction, supplied by the merchant.
firstname Yes The customer’s first name
lastname Yes The customer’s last name
address Yes The customer’s street address
city Yes The customer’s city of residence
state Yes The customer’s state of residence
country Yes The customer’s country of residence
zipcode Yes The customer’s zip code
phone Yes The customer’s phone number – numerical only, no special characters
email Yes The customer’s email address
product Yes A brief description of the product/service purchased.
card_holder Yes Name on the customer’s credit card
card_number Yes The credit card number
expiry_month Yes The card expiry month as a 2 digit number
expiry_year Yes The card expiry year as a 4 digit number
cvv Yes The card’s CVV2 value

Response Fields

API responses are returned as a query string containing the following fields:

Field Description
result A textual representation of the final transaction state. Sale, Authorized, Captured, Voided or Refunded are the possible responses.
transaction_id The transaction id generated by the PNGateway to identify the transaction.
code The status code for the transaction. 00 is success, all others are declined.
message A textual representation of the result code.

Sample Request

$request = array(
			"site_id" => "100",
			"password" => "85531c3d26",
			"amount" => 6.00,
			"type" => 1,
			"merchant_reference" => "Testing " . uniqid(),
			"currency" => "USD",
			"ip" => $_SERVЕR["RE_ADDR"],
			"firstname" => "Test",
			"lastname" => "User",
			"address" => "123 Test St",
			"city" => "Testville",
			"zipcode" => "1234",
			"state" => "TT",
			"country" => "US",
			"phone" => "1234567890",
			"email" => "test@test.com",
			"product" => "Test Item",
			"card_holder" => "Test Card",
			"card_number" => "4111111111111111",
			"expiry_month" => "04",
			"expiry_year" => "2020",
			"cvv" => "123",
);

$ch = curl_init("https://merchant.pngateway.com/api/cc.php"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request)); $response = curl_exec($ch);
curl_close($ch);
parse_str($response, $result);
var_dump($result);

Capture, Void or Refund

Request Fields

Field Required Description
site_id Yes Site ID supplied for this account
password Yes API Password supplied for this account
type Yes The type code tells us what type of request this is. i.e. Sale, Refund, etc. See Type Codes.
transaction_id Yes The transaction id returned for the original sale transaction.
amount No / Yes* Amount – supplied up to 2 decimal places, ‘.’ used as decimal separator. * Amount is only used and required for refunds

Response Fields

API responses are returned as a query string containing the following fields:

Field Description
result A textual representation of the final transaction state. Sale, Authorized, Captured, Voided or Refunded are the possible responses.
transaction_id The transaction id generated by the PNGateway to identify the transaction.
code The status code for the transaction. 00 is success, all others are declined.
message A textual representation of the result code.

Sample Request

// Example Refund Request
		$request = array(
			"site_id" => "2000",
			"password" => "testSitePass",
			"type" => 5,
			"transaction_id" => "12345678",
			"amount" => 6.00,
		);
 
$ch = curl_init("https://merchant.pngateway.com/api/cc.php");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request));
$response = curl_exec($ch);
curl_close($ch);
parse_str($response, $result);
var_dump($result);

Error Codes Define

Here are some of the commonly error codes when integrating to the secure PNGateway system.

result=Error&message=Authentication+invalid&code=A01

This means the site_id or the API Password is incorrect and you must use the correct site authentication details in order to bypass this error

(400103) The service for this merchant is unavailable

This error comes most probably when the merchant does not place the correct API Password which requires to come up with each transaction which validates and communicates with the gateway.

ACH Integration

ACH integration is currently unavailable though it is expected to be operational soon.

Transaction Type Codes

Code Action Description
1 Sale Performs a full authorization and capture in one request.
2 Authorization Holds the requested amount from a customer’s card, but does not finalize the charge.
3 Capture Finalizes a previously authorized transaction.
4 Void Cancels a currently authorized, but not yet captured, transaction.
5 Refund Refunds a previous sale, or captured, transaction.

List of Country Codes

Here you find the country codes list, needed for your integration.

Country Codes

AF Afghanistan BS Bahamas
AL Albania BH Bahrain
DZ Algeria BD Bangladesh
AS American Samoa BB Barbados
AD Andorra BY Belarus
AO Angola BE Belgium
AI Anguilla BZ Belize
AQ Antarctica BJ Benin
AG Antigua and Barbuda BM Bermuda
AR Argentina BT Bhutan
AM Armenia BO Bolivia
AW Aruba BA Bosnia & Herzegovina
AU Australia BW Botswana
AT Austria BV Bouvet Island
AZ Azerbaijan BR Brazil
BN Brunei Darussalam BG Bulgaria
BF Burkina Faso BI Burundi
KH Cambodia CF Central African Repub
CM Cameroon TD Chad
CA Canada CL Chile
CV Cape Verde CN China
KY Cayman Islands CX Christmas Island
CC Cocos Keeling Islands CR Costa Rica
CO Colombia CI Cote D’Ivoire Ivory
KM Comoros HR Croatia Hrvatska
CG Congo CU Cuba
CK Cook Islands CS Czechoslovakia
CY Cyprus CZ Czech Republic
DK Denmark DJ Djibouti
DM Dominica DO Dominican Republic
TP East Timor EC Ecuador
EG Egypt GQ Equatorial Guinea
SV El Salvador ER Eritrea
EE Estonia ET Ethiopia
FK Falkland Islands FO Faroe Islands
FJ Fiji FI Finland
FR France FX France, Metropolitan
GF French Guiana PF French Polynesia
GA Gabon GM Gambia
GE Georgia DE Germany
GH Ghana GI Gibraltar
GR Greece GL Greenland
GD Grenada GP Guadeloupe
GU Guam GT Guatemala
GN Guinea GW Guinea-Bissau
GY Guyana HT Haiti
HM Heard HN Honduras
HK Hong Kong HU Hungary
IS Iceland IN India
ID Indonesia IR Iran
IQ Iraq IE Ireland
IL Israel IT Italy
JM Jamaica JP Japan
JO Jordan KZ Kazakhstan
KE Kenya KI Kiribati
KP Korea North KR Korea South
KW Kuwait KG Kyrgyzstan
LA Laos LV Latvia
LB Lebanon LS Lesotho
LR Liberia LY Libya
LI Liechtenstein LT Lithuania
LU Luxembourg MO Macau
MK Macedonia MG Madagascar
MW Malawi MY Malaysia
MV Maldives ML Mali
MT Malta MH Marshall Islands
MQ Martinique MR Mauritania
MU Mauritius YT Mayotte
MX Mexico FM Micronesia
MD Moldova MC Monaco
MN Mongolia MS Montserrat
MA Morocco MZ Mozambique
MM Myanmar NA Namibia
NR Nauru NP Nepal
NL Netherlands AN Netherlands Antilles
NT Neutral Zone NC New Caledonia
NZ New Zealand NI Nicaragua
NE Niger NG Nigeria
NU Niue NF Norfolk Island
MP Northern Mariana Islands NO Norway
OM Oman PK Pakistan
PW Palau PS Palestine
PA Panama PG Papua New Guinea
PY Paraguay PE Peru
PH Philippines PN Pitcairn
PL Poland PT Portugal
PR Puerto Rico QA Qatar
RE Reunion RO Romania
RU Russian Federation RW Rwanda
GS S. Georgia KN Saint Kitts and Nevis
LC Saint Lucia VC Saint Vincent
WS Samoa SM San Marino
ST Sao Tome and Principe SA Saudi Arabia
SN Senegal SC Seychelles
SL Sierra Leone SG Singapore
SK Slovak Republic SI Slovenia
SB Solomon Islands SO Somalia
ZA South Africa ES Spain
LK Sri Lanka SH St. Helena
PM St. Pierre and Miquelon SD Sudan
SR Suriname SJ Svalbard
SZ Swaziland SE Sweden
CH Switzerland SY Syria
TW Taiwan TJ Tajikistan
TZ Tanzania TH Thailand
TG Togo TK Tokelau
TO Tonga TT Trinidad and Tobago
TN Tunisia TR Turkey
TM Turkmenistan TC Turks and Caicos Islands
TV Tuvalu UG Uganda
UA Ukraine AE United Arab Emirates
GB United Kingdom US United States
UY Uruguay UZ Uzbekistan
VU Vanuatu VA Vatican City State
VE Venezuela VN Viet Nam
VG Virgin Islands British VI Virgin Islands U.S.
WF Wallis and Futuna Islands EH Western Sahara
YE Yemen YU Yugoslavia
ZR Zaire ZM Zambia
ZW Zimbabwe

List of City Codes

USA – United States of America

AL Alabama AK Alaska
AB Alberta AS American Samoa
AZ Arizona AR Arkansas
AA Armed Forces Ame AE Armed Forces Eur
AP Armed Forces Pac BC British Columbia
CA California CT Connecticut
CO Colorado DC District of Columbia
DE Delaware FL Florida
FM Fed St Micronesia GA Georgia
GU Guam HI Hawaii
ID Idaho IL Illinois
IN Indiana IA Iowa
KS Kansas KY Kentucky
LA Louisiana ME Maine
MB Manitoba MH Marshall Islands
MD Maryland MA Massachusetts
MI Michigan MN Minnesota
MS Mississippi MO Missouri
MT Montana NE Nebraska
NV Nevada NB New Brunswich
NH New Hampshire NJ New Jersey
NM New Mexico NY New York
NF Newfoundland NC North Carolina
ND North Dakota MP Northern Mariana Is
NT Northwest Ter NS Nova Scotia
OH Ohio OK Oklahoma
ON Ontario OR Oregon
PW Palau PA Pennsylvania
PE Prince Edward Is PR Puerto Rico
QC Quebec RI Rhode Island
SK Saskatchewan SC South Carolina
SD South Dakota TN Tennessee
TX Texas UT Utah
VT Vermont VI Virgin Islands
VA Virginia WA Washington
WV West Virginia WI Wisconsin
WY Wyoming YT Yukon

List of City Codes

Australia

ACT Australian Capital Territory NSW New South Wales
NT Northern Territory QLD Queensland
SA South Australia VIC Victoria
WA Western Australia  

Canada

AB Alberta BC British Columbia
MB Manitoba NB New Brunswick
NL Newfoundland and Labrador NS Nova Scotia
NT Northwest Territories NU Nunavut
ON Ontario PE Prince Edward Island
QC Quebec SK Saskatchewan
YT Yukon

 

PaymentNetworks.com is providing the information in this document to you “AS-IS” with all faults and makes no warranties of any kind (whether express, implied or statutory) with respect to the information contained herein. PaymentNetworks.com assumes no liability for damages (whether direct or indirect), caused by errors or omissions, or resulting from the use of this document or the information contained in this document or resulting from the application or use of the product or service described herein. PaymentNetworks reserves the right to make changes to any information herein without further notice.