Project

General

Profile

Actions

Specification » History » Revision 16

« Previous | Revision 16/19 (diff) | Next »
Chooi-Mey, 05/02/2012 02:13 PM


Specification

The chosen integration method is Customer Link. The consumer enters payment information on GlobalCollect's hosted payment pages and GlobalCollect will forward the payment result to the merchant through Payment Status Communicator (PSC).

Demo Application:
  • Without Address:

http://192.168.2.68/ukstore/sample/payment_form.jsp

  • With Address:

http://192.168.2.68/ukstore/sample/payment_form_with_address.jsp

Introduction

Payment Flow:

Java Package Name

Package name:

my.com.eCosway.globalcollect

Table(s) used

GLOBALCOLLECT_INTERFACE

Configuration

The GlobalCollect's Customer Link requires the merchant to provide the following URL:
  • Return URL - A link to be displayed on GlobalCollect's payment pages.
  • PSC URL - GlobalCollect sends the payment information to this URL after the consumer has completed a payment attempt successfully.

globalcollect.properties

This properties file is located at:

resources/properties/uk/globalcollect.properties

The properties file for development environment:

resources/properties/uk/globalcollect-dev.properties

important note: rename to globalcollect.properties

Properties Description:
Property Name Description
cl.url The API URL for Customer Link
merchant.id The merchant ID (provided by GlobalCollect)
merchant.ip The merchant's public IP address
order.api.version The API version of INSERT_ORDER
order.status.api.version The API version of GET_ORDERSTATUS
currency.code 3 letter currency code (ISO-4217)
country.code 2 letter country code
language.code 2 letter language code (ISO-639)

Programming

This section contains 3 parts:
  • Generate redirect URL - describes how to generate the redirect URL
  • Back URL - describes how to handle the returned consumer
  • PSC URL - describes how to capture the payment information

Required libraries

Apache HttpClient:
  • httpclient-4.0.3.jar
  • httpcore-4.0.1.jar
  • httpmime-4.0.3.jar

Download link: http://hc.apache.org/downloads.cgi

Generate redirect URL

The generated URL will be used to redirect the consumer to GlobalCollect's payment pages.

Step-by-Step:
  1. Prepare the following parameters:
    • connection - an established database connection
    • orderId - the unique order ID, 20 alphanumeric characters
    • amount - the order amount in cents, and integer values only
  2. Pass the above parameters to the following interface:
    String redirectUrl = PaymentUtils.genRedirectPaymentUrl(connection, orderId, amount);
    
  3. Insert the order ID information into session.
  4. Redirect the consumer to the generated URL using JavaScript or HttpServletResponse.sendRedirect.

Generate redirect URL with address info and email

The generated URL URL will be used to redirect the consumer to GlobalCollect's payment pages.

Step-by-Step:
  1. Prepare the following parameters:
    • transactionType - the transaction type, e.g. PURCHASE, REGISTRATION
    • connection - an established database connection
    • orderId - the unique order ID, 20 alphanumeric characters
    • amount - the order amount in cents, and integer values only
    • email - the email of the customer
    • profileAddress - the address of the customer
    • shippingAddress - the shipping address of the customer
  2. Pass the above parameters to the following interface:
    String redirectUrl = PaymentUtils.genRedirectPaymentUrl(transactionType, connection, orderId, amount, email, profileAddress, shippingAddress);
    
  3. Insert the order ID information into session.
  4. Redirect the consumer to the generated URL using JavaScript or HttpServletResponse.sendRedirect.

Back URL

The back URL acts as receipt URL also. This is where the consumer will be redirected to after completed the payment.

As GlobalCollect will not forward payment information to the URL, one has to obtain the order details via the active session. The following guide assumes the order ID is stored in the session.

Step-by-Step:
  1. Prepare the following parameters:
    • connection - an established database connection
    • orderId - the unique order ID, 20 alphanumeric characters
  2. Pass the above parameters to the following interface:
    String orderId = (String) session.getAttribute("test_ord_id");
    PaymentUtils.persistPaymentStatusForReceipt(connection, orderId);
    
  3. And then, one can obtain the payment status in the interface table (see Table Name);

PSC URL

For every payment transaction with the status 500 and above, GlobalCollect will post the payment information to the PSC URL.

Step-by-Step:
  1. Prepare the following parameters:
    • connection - an established database connection
    • request - the HttpServletRequest object
  2. Pass the above parameters to:
    PaymentUtils.persistPaymentStatusForPsc(dataBean.getConnection(), request);
    
  3. [Important] The PSC must not contains any HTML element except a 'OK' string e.g.,
    out.print("OK");
    

FAQ

PSC:
  • GlobalCollect post the payment result within 2 minutes after completed payment
  • The PSC URL must be a HTTPS URL
  • Only those payment result with status 500 or above will be posted to PSC URL.
  • The number of retry attempt is 10. If reached the maximum retry attempt, the PSC posting will be disabled.
  • The retry interval is 2-minutes for the first attempt and 1-minute for the subsequence attempts.
GC new SSL Cert installation (on 11th April 2012):
  • To add/import GC new SSL Cert keystore, the Java command as below:
  • ./keytool -import -trustcacerts -alias globalcollectSecureTrust -file Secure_trust.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts
  • ./keytool -import -trustcacerts -alias globalcollectWildcardGcsipCom -file wildcard.gcsip.com.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts
  • ./keytool -import -trustcacerts -alias globalcollectWildcardGcsipNl -file wildcard.gcsip.nl.cer -keystore /usr/java/jdk1.5.0_15/jre/lib/security/cacerts

Updated by Chooi-Mey over 12 years ago · 16 revisions