IoT Payments
IoT payments can occur from a variety of sources on a variety of platforms.
Prepare to Charge a Credit Card
For the below sections, the code samples will reference the following objects:
Prepare to charge a credit card
using GlobalPayments.Api.Entities;
using GlobalPayments.Api.PaymentMethods;
var card = new CreditCardData {
Token = "single- or multi-use token"
};
var address new Address {
PostalCode = "12345"
};
<?php
use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
$card = new CreditCardData();
$card->token = "single- or multi-use token";
$address = new Address();
$address->postalCode = "12345";
import com.global.api.entities.Address;
import com.global.api.paymentMethods.CreditCardData;
CreditCardData card = new CreditCardData();
card.setToken("single- or multi-use token");
Address address = new Address();
address.setCode("12345");
# coming soon
from globalpayments.api.entities import Address
from globalpayments.api.payment_methods import CreditCardData
card = CreditCardData()
card.token = 'single- or multi-use token'
address = Address()
address.postal_code = '12345'
import { Address, CreditCardData } from "globalpayments-api";
const card = new CreditCardData();
card.token = "single- or multi-use token";
const address = new Address();
address.code = "12345";
Not using tokens?
Our SDKs support using tokens in place of card data, but using tokens is optional if you have other requirements. Review other options in the Credit Card section of our SDK documentation.
Charge a Credit Card
The credit sale transaction authorizes a sale purchased with a credit card. The authorization is placed in the current open batch (should auto-close for e-commerce transactions). If a batch is not open, this transaction will create an open batch.
Charge a credit card
var response = card.Charge(10.00m)
.WithCurrency("USD")
.WithAddress(address)
.Execute();
<?php
$response = $card->charge(10)
->withCurrency("USD")
->withAddress($address)
->execute();
import com.global.api.entities.Transaction;
import java.math.BigDecimal;
Transaction response = card.charge(new BigDecimal("10"))
.withCurrency("USD")
.withAddress(address)
.execute();
# coming soon
response = card.charge(10) \
.with_currency('USD') \
.with_address(address) \
.execute()
const response = await card.charge(10)
.withCurrency("USD")
.withAddress(address)
.execute();
Next Steps
Learn more about Heartland Ecommerce card payments with: