Developer Portal

Subscriptions

Heartland’s recurring product, PayPlan, allows you to easily setup subscriptions on a tokenized credit card.

Create a Customer

using GlobalPayments.Api.Entities;

var customer = new Customer {
    Id = GenerateCustomerId(),
    Status = "Active",
    FirstName = "Bill",
    LastName = "Johnson",
    Company = "Heartland Payment Systems",
    Address = new Address {
        StreetAddress1 = "987 Elm St",
        City = "Princeton",
        Province = "NJ",
        PostalCode = "12345",
        Country = "USA"
    },
    HomePhone = "9876543210",
    WorkPhone = "9876543210",
    Fax = "9876543210",
    MobilePhone = "9876543210",
    Email = "text@example.com"
}.Create();
import com.global.api.entities.Address;
import com.global.api.entities.Customer;

Address address = new Address();
address.setStreetAddress1("987 Elm St");
address.setCity("Princeton");
address.setProvince("NJ");
address.setPostalCode("12345");
address.setCountry("USA");

Customer customer = new Customer();
customer.setId(generateCustomerId());
customer.setStatus("Active");
customer.setFirstName("Bill");
customer.setLastName("Johnson");
customer.setCompany("Heartland Payment Systems");
customer.setAddress(address);
customer.setHomePhone("9876543210");
customer.setWorkPhone("9876543210");
customer.setFax("9876543210");
customer.setMobilePhone("9876543210");
customer.setEmail("text@example.com");
customer = customer.create();
<?php
use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\Entities\Customer;

$customer = new Customer();
$customer->id = generateCustomerId();
$customer->firstName = 'John';
$customer->lastName = 'Doe';
$customer->status = 'Active';
$customer->email = 'john.doe@example.com';
$customer->address = new Address();
$customer->address->streetAddress1 = '123 Main St.';
$customer->address->city = 'Dallas';
$customer->address->province = 'TX';
$customer->address->postalCode = '75024';
$customer->address->country = 'USA';
$customer->workPhone = '5551112222';
$customer = $customer->create();
# coming soon
# coming soon
import { Address, Customer } from "globalpayments-api";

let customer = new Customer();
customer.id = generateCustomerId();
customer.firstName = "John";
customer.lastName = "Doe";
customer.status = "Active";
customer.email = "john.doe@email.com";
customer.address = new Address();
customer.address.streetAddress1 = "123 Main St.";
customer.address.city = "Dallas";
customer.address.state = "TX";
customer.address.postalCode = "98765";
customer.address.country = "USA";
customer.workPhone = "5551112222";
customer = await customer.create();

Create a Payment Method

using GlobalPayments.Api.PaymentMethods;

var paymentMethod = customer.AddPaymentMethod(
    GeneratePaymentMethodId(),
    new CreditCardData {
        Number = "4111111111111111",
        ExpMonth = 12,
        ExpYear = 2025
    }
).Create();
import com.global.api.paymentMethods.CreditCardData;
import com.global.api.paymentMethods.RecurringPaymentMethod;

CreditCardData card = new CreditCardData();
card.setNumber("4111111111111111");
card.setExpMonth(12);
card.setExpYear(2025);

RecurringPaymentMethod paymentMethod = customer.addPaymentMethod(
    generatePaymentMethodId(),
    card
).create();
<?php
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;

$card = new CreditCardData();
$card->number = '4111111111111111';
$card->expMonth = '12';
$card->expYear = '2025';

$paymentMethod = $customer->addPaymentMethod(
    generatePaymentMethodId(),
    $card
)->create();
# coming soon
# coming soon
import { CreditCardData } from "globalpayments-api";

const card = new CreditCardData();
card.number = "4111111111111111";
card.expMonth = "12";
card.expYear = "2025";

const paymentMethod = await customerPerson
  .addPaymentMethod(generatePaymentMethodId(), card)
  .create();

Create a Schedule

using GlobalPayments.Api.Entities;

var schedule = paymentMethod.AddSchedule(GenerateScheduleId())
    .WithAmount(30.02m)
    .WithCurrency("USD")
    .WithStartDate(DateTime.Parse("02/01/2027"))
    .WithFrequency(ScheduleFrequency.WEEKLY)
    .WithStatus("Active")
    .WithReprocessingCount(2)
    .WithEndDate(DateTime.Parse("04/01/2027"))
    .Create();
import com.global.api.entities.Schedule;
import com.global.api.entities.enums.ScheduleFrequency;
import java.math.BigDecimal;

Schedule schedule = paymentMethod.addSchedule(generateScheduleId())
    .withAmount(new BigDecimal("30.02"))
    .withCurrency("USD")
    .withStartDate(DateUtils.parse("02/01/2027"))
    .withFrequency(ScheduleFrequency.Weekly)
    .withStatus("Active")
    .withReprocessingCount(2)
    .withEndDate(DateUtils.parse("04/01/2027"))
    .create();
<?php
use GlobalPayments\Api\Entities\Enums\ScheduleFrequency;

$schedule = $paymentMethod->addSchedule(
    generateScheduleId()
)
    ->withStatus('Active')
    ->withAmount(30.02)
    ->withCurrency('USD')
    ->withStartDate(\DateTime::createFromFormat('Y-m-d', '2027-02-01'))
    ->withFrequency(ScheduleFrequency::WEEKLY)
    ->withEndDate(\DateTime::createFromFormat('Y-m-d', '2027-04-01'))
    ->withReprocessingCount(2)
    ->create();
# coming soon
# coming soon
import {
  EmailReceipt,
  ScheduleFrequency
} from "globalpayments-api";

const schedule = await paymentMethodVisa
  .addSchedule(generateScheduleId())
  .withStartDate(new Date(2027, 1, 1))
  .withAmount(30.01)
  .withFrequency(ScheduleFrequency.Weekly)
  .withReprocessingCount(1)
  .withStatus("Active")
  .withEmailReceipt(EmailReceipt.Never)
  .create();

Next Steps

Learn more about Heartland Ecommerce recurring payments with: