Developer Portal

Gift Card Payments

Merchant gift card programs lead customers to spend—on average—60 percent more than the value of their gift cards. In addition, 72 percent of shoppers also shop for themselves when they go online or in-store to purchase a gift card.

Heartland helps you acquire more loyal customers with our innovative gift card program. You can personalize your own gift cards, offer reloading capabilities and use a card-not-present program that allows your customers to use their phone number as their identifier.

Create a Gift Card Object

When consuming gift cards, you will need to first create a GiftCardData object to pass to the subsequent methods.

Creating a Gift Card

<?php
use GlobalPayments\Api\PaymentMethods\GiftCardData;

$card = new GiftCardData();
$card->number = "5022440000000000098";
using GlobalPayments.Api.PaymentMethods;

var card = new GiftCardData {
    Number = "5022440000000000098";
};
import com.global.api.paymentMethods.GiftCardData;

GiftCardData card = new GiftCardData();
card.setNumber("5022440000000000098");
from globalpayments.api.payment_methods import GiftCardData

card = GiftCardData()
card.number = '5022440000000000098'
# coming soon
import { GiftCardData } from "globalpayments-api";

const card = new GiftCardData();
card.number = "5022440000000000098";

Get a Gift Card Balance

You might want to check the balance of a Gift Card before you try to create a sale.

Get Gift Card Balance

<?php
$response = $card->balanceInquiry()
    ->execute();
var response = card.BalanceInquiry()
    .Execute();
import com.global.api.entities.Transaction;

Transaction response = card.balanceInquiry()
    .execute();
response = card.balance_inquiry() \
    .execute()
# coming soon
const response = await card.balanceInquiry()
  .execute();

Charge a Gift Card (Sale)

Creating a sale on a Gift Card is simple.

Charge Gift Card

<?php
$response = $card->charge(10)
    ->withCurrency("USD")
    ->execute();
var response = card.Charge(10m)
    .WithCurrency("USD")
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = card.charge(new BigDecimal("10"))
    .withCurrency("USD")
    .execute();
response = card.charge(10) \
    .with_currency('USD') \
    .execute()
# coming soon
const response = await card.charge(10)
  .withCurrency("USD")
  .execute();

Add Value to a Gift Card

You can add a value to an existing Gift Card

Add to Gift Card

<?php
$response = $card->addValue(10)
    ->withCurrency("USD")
    ->execute();
var response = card.AddValue(10m)
    .WithCurrency("USD")
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = card.addValue(new BigDecimal("10"))
    .withCurrency("USD")
    .execute();
response = card.add_value(10) \
    .with_currency('USD') \
    .execute()
# coming soon
const response = await card.addValue(10)
  .withCurrency("USD")
  .execute();

Reward a Gift Card

To create a reward against a gift card you just need to pass in the card and the dollar amount to be rewarded.

Reward Gift Card

<?php
$response = $card->rewards(10)
    ->execute();
var response = card.Rewards(10m)
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = card.rewards(new BigDecimal("10"))
    .execute();
response = card.rewards(10) \
    .execute()
# coming soon
const response = await card.rewards(10)
  .execute();

Activate a Gift Card

Activating a gift card is as simple as providing the dollar amount, currency code and gift card object

Activate Gift Card

<?php
$response = $card->activate(10)
    ->execute();
var response = card.Activate(10m)
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = card.activate(new BigDecimal("10"))
    .execute();
response = card.activate(10) \
    .execute()
# coming soon
const response = await card.activate(10)
  .execute();

Deactivate a Gift Card

Activating a gift card is as simple as providing the dollar amount, currency code and gift card object

Deactivate Gift Card

<?php
$response = $card->deactivate()
    ->execute();
var response = card.Deactivate()
    .Execute();
import com.global.api.entities.Transaction;

Transaction response = card.deactivate()
    .execute();
response = card.deactivate() \
    .execute()
# coming soon
const response = await card.deactivate()
  .execute();

Replace a Gift Card

Sometimes there is a need to replace a gift card with a new gift card.

Replace Gift Card

<?php
use GlobalPayments\Api\PaymentMethods\GiftCardData;

$card2 = new GiftCardData();
$card2->number = "5022440000000000007";

$response = $card->replaceWith($card2)
    ->execute();
using GlobalPayments.Api.PaymentMethods;

var card2 = new GiftCardData {
    Number = "5022440000000000007";
};

var response = card.ReplaceWith(card2)
    .Execute();
import com.global.api.paymentMethods.GiftCardData;

GiftCardData card2 = new GiftCardData();
card2.setNumber("5022440000000000007");

Transaction response = card.replaceWith(card2)
    .execute();
from globalpayments.api.payment_methods import GiftCardData

card2 = GiftCardData()
card2.number = '5022440000000000007'

response = card.replaceWith(card2) \
    .execute()
# coming soon
import { GiftCardData } from "globalpayments-api";

const card2 = new GiftCardData();
card2.number = "5022440000000000007";

const response = await card.replaceWith(card2)
  .execute();

Void a Gift Card Transaction

To void a gift card transaction, you will need only a gift transaction id.

Void Gift Card Transaction

<?php
use GlobalPayments\Api\Entities\Transaction;

$response = Transaction::fromId($transactionId)
    ->void()
    ->execute();
using GlobalPayments.Api.Entities;

var response = Transaction.FromId(transactionId)
    .Void()
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = Transaction.fromId(transactionId)
    .void()
    .execute();
# coming soon
from globalpayments.api.entities import Transaction

response = Transaction.from_id(transaction_id) \
    .void() \
    .execute()
import { Transaction } from "globalpayments-api";

const response = await Transaction.fromId(transactionId)
  .void()
  .execute();

Reverse a Gift Card By Transaction

You can reverse (or partially reverse) a gift card transaction with the transaction id.

Reverse Gift Card By Transaction

<?php
use GlobalPayments\Api\Entities\Transaction;

$response = Transaction::fromId($transactionId)
    ->reverse(10)
    ->execute();
using GlobalPayments.Api.Entities;

var response = Transaction.FromId(transactionId)
    .Reverse(10m)
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = Transaction.fromId(transactionId)
    .reverse(new BigDecimal("10"))
    .execute();
# coming soon
from globalpayments.api.entities import Transaction

response = Transaction.from_id(transaction_id) \
    .reverse(10) \
    .execute()
import { Transaction } from "globalpayments-api";

const response = await Transaction.fromId(transactionId)
  .reverse(10)
  .execute();

Reverse a Gift Card

You can reverse (or partially reverse) a gift card transaction with the transaction id.

Reverse Gift Card

<?php
use GlobalPayments\Api\Entities\Transaction;

$response = Transaction::fromId($transactionId)
    ->reverse(10)
    ->execute();
using GlobalPayments.Api.Entities;

var response = Transaction.FromId(transactionId)
    .Reverse(10m)
    .Execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;

Transaction response = Transaction.fromId(transactionId)
    .reverse(new BigDecimal("10"))
    .execute();
# coming soon
from globalpayments.api.entities import Transaction

response = Transaction.from_id(transaction_id) \
    .reverse(10) \
    .execute()
import { Transaction } from "globalpayments-api";

const response = await Transaction.fromId(transactionId)
  .reverse(10)
  .execute();