Developer Portal

Credit Card Payments

Follow these steps to take credit and debit card payments using your language of choice on one of our terminals.

Device setup

// see .Net/Java
// RequestIdProvider
using GlobalPayments.Api.Terminals;

public class RequestIdProvider : IRequestIdProvider {
    private Random random;

    public RequestIdProvider() { 
        random = new Random(DateTime.Now.Millisecond);
    }

    public int GetRequestId() {
        return new Random().Next(100000, 999999);
    }
}

// Device connection
var device = DeviceService.Create(new ConnectionConfig {
    DeviceType = DeviceType.HPA_ISC250,
    ConnectionMode = ConnectionModes.TCP_IP,
    IpAddress = "10.12.220.130",
    Port = "12345",
    TimeOut = 30000,
    RequestIdProvider = new RequestIdProvider()
});
// RequestIdProvider
import java.util.Random;
import org.joda.time.DateTime;
import com.global.api.terminals.IRequestIdProvider;

public class RequestIdProvider implements IRequestIdProvider {
    private Random random;

    public RequestIdProvider() { 
        random = new Random(DateTime.now().getMillisOfSecond());
    }

    public int getRequestId() { 
        return 100000 + random.nextInt(999999);
    }
}

// Device configuration
import com.global.api.entities.enums.ConnectionModes;
import com.global.api.entities.enums.DeviceType;
import com.global.api.services.DeviceService;
import com.global.api.terminals.ConnectionConfig;
import com.global.api.terminals.abstractions.IDeviceInterface;

ConnectionConfig deviceConfig = new ConnectionConfig();
deviceConfig.setDeviceType(DeviceType.HPA_ISC250);
deviceConfig.setConnectionMode(ConnectionModes.TCP_IP);
deviceConfig.setIpAddress("10.12.220.130");
deviceConfig.setPort(12345);
deviceConfig.setTimeout(30000);
deviceConfig.setRequestIdProvider(new RequestIdProvider());

IDeviceInterface device = DeviceService.create(config);
# see .Net/Java
# see .Net/Java
// see .Net/Java
#import "HpsHpaDevice.h"

HpsConnectionConfig *config = [[HpsConnectionConfig alloc] init];
config.ipAddress = @"10.12.220.172";
config.port = @"10009";
config.connectionMode = HpsConnectionModes_TCP_IP;

HpsHpaDevice * device = [[HpsHpaDevice alloc] initWithConfig:config];

Credit Sale Example

// see .Net/Java
var response = device.CreditSale(11m)
    .Execute();
import com.global.api.terminals.TerminalResponse;
import java.math.BigDecimal;

TeminalResponse response = device.creditSale(new BigDecimal("11"))
    .execute();
# see .Net/Java
# see .Net/Java
// see .Net/Java
HpsHpaCreditSaleBuilder *builder = [[HpsHpaCreditSaleBuilder alloc] initWithDevice:device];
builder.amount = [NSNumber numberWithDouble:11.0];
builder.referenceNumber = 1;
builder.creditCard = card;
builder.address = address;

[builder execute:^(HpsHpaCreditResponse *payload, NSError *error) {}];

Next Steps

Learn more about credit and debit card payments with: