Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cardLast4 is undefined when calling CreditCardData.charge #11

Open
charlie-s opened this issue Apr 6, 2020 · 1 comment
Open

cardLast4 is undefined when calling CreditCardData.charge #11

charlie-s opened this issue Apr 6, 2020 · 1 comment

Comments

@charlie-s
Copy link

When calling CreditCardData.charge, the response contains a cardLast4 property, but its value is undefined. Is this something we should expect to have access to in the response?

Here's an example:

const {
    Address,
    CreditCardData,
    ServicesConfig,
    ServicesContainer,
} = require('globalpayments-api');

const card = new CreditCardData();
card.token = ...;

const address = new Address();
address.streetAddress1 = ...;
address.postalCode = ...;

const transaction = await card
    .charge(...)
    .withCurrency('USD')
    .withAddress(address)
    .execute();

console.log(transaction);

output:

Transaction {
  responseCode: '00',
  responseMessage: 'APPROVAL',
  authorizedAmount: undefined,
  availableBalance: undefined,
  avsResponseCode: '0',
  avsResponseMessage: 'AVS Not Requested.',
  balanceAmount: undefined,
  cardType: 'Visa',
  cardLast4: undefined,
  cavvResponseCode: undefined,
  commercialIndicator: undefined,
  cvnResponseCode: 'M',
  cvnResponseMessage: 'Match.',
  pointsBalanceAmount: undefined,
  recurringDataCode: undefined,
  referenceNumber: '000000000000',
  transactionDescriptor: undefined,
  transactionReference: TransactionReference {
    transactionId: '0000000000',
    paymentMethodType: 2,
    authCode: 'ABC123'
  }
}
@charlie-s
Copy link
Author

charlie-s commented Apr 6, 2020

I've checked the rawResponse in the portico connector and unfortunately the TokenPANLast4 isn't present. I can make a call to load the transaction detail after the initial transaction is run. Seems a little heavy handed but it does work:

const transaction = await card
    .charge(...)
    .withCurrency('USD')
    .withAddress(address)
    .execute();

const transactionFull = await ReportingService
    .transactionDetail(transaction.transactionReference.transactionId)
    .execute();

transactionFull.maskedCardNumber; // '424242******4242'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant