Broadleaf Microservices
  • v1.0.0-latest-prod

Preparing a PaymentTransactionServices Payment for Verifone Transactions

To execute Verifone transactions via PaymentTransactionServices, we must first create a Payment in PaymentTransactionServices. These Payments are most commonly created during the payment stage of your checkout flow.

Create a Payment with an Encrypted Card

Use the verifone.js to encrypt a card. Then use this encrypted card in the paymentMethodProperties to create a Payment.

{
  ...
  gatewayType: "VERIFONE",
  type: "CREDIT_CARD",
  paymentMethodProperties: {
    "encrypted_card": "encrypted card",
    "public_key_alias": "public key alias of the public key used to encrypt the card"
  },
  isSingleUsePaymentMethod: false,
  displayAttributes: {
    "creditCardType":"VISA",
    "creditCardNumber":"****1111",
    "creditCardHolder":"John Doe",
    "creditCardExpDateMonth":"02",
    "creditCardExpDateYear":"2023"}
  }
  ...
}

This encrypted card will be exchanged for a reuse_token. This token will be used to execute transactions.

Create a Payment with a Reuse Token

{
  ...
  gatewayType: "VERIFONE",
  type: "CREDIT_CARD",
  paymentMethodProperties: {
    "reuse_token": "reuse token",
  },
  isSingleUsePaymentMethod: false,
  displayAttributes: {
    "creditCardType":"VISA",
    "creditCardNumber":"****1111",
    "creditCardHolder":"John Doe",
    "creditCardExpDateMonth":"02",
    "creditCardExpDateYear":"2023"}
  }
  ...
}

Create a Payment with an Apple or Google Pay

{
  ...
  gatewayType: "VERIFONE",
  type: "APPLE_PAY", // or GOOGLE_PAY
  paymentMethodProperties: {
    "wallet_payload": "wallet payload"
  },
  isSingleUsePaymentMethod: true,
  ...
}
Note
When defining an ApplePay or GooglePay-based Payment, we automatically swap the wallet payload for a Verifone Reuse Token via VerifonePaymentModificationService#swapDigitalWalletPayloadForReuseToken(…​). Under the covers, we execute a $0 Authorize transaction with Verifone to produce the Reuse Token.

Create a Payment with a SIGNUP Stored Credentials

{
  ...
  gatewayType: "VERIFONE",
  type: "CREDIT_CARD",
  shouldSavePaymentForFutureUse: true,
  paymentMethodProperties: {
    "encrypted_card": "encrypted card",
    "public_key_alias": "public key alias of the public key used to encrypt the card",
    "stored_credential_signup": "{"processing_model": "NONE", "contract": "ONE_CLICK,MERCHANT_INITIATED", "name": "Saved Payment Method"}" // this json should be converted to string
  },
  isSingleUsePaymentMethod: false,
  displayAttributes: {
    "creditCardType":"VISA",
    "creditCardNumber":"****1111",
    "creditCardHolder":"John Doe",
    "creditCardExpDateMonth":"02",
    "creditCardExpDateYear":"2023"}
  }
  attributes: {
    isStoredCredentialPayment: true // this is required
  }
  ...
}

Executing a successful Authorize or AuthorizeAndCapture transaction with this Payment will produce a SavedPaymentMethod tied to the customer that contains the Stored Credential reference in its paymentMethodProperties map. This SavedPaymentMethod can then be used for subsequent StoredCredential charges (i.e. additional Authorize or AuthorizeAndCapture transactions based on the StoredCredentials).

Create a Payment with a CHARGE Stored Credentials

{
  ...
  gatewayType: "VERIFONE",
  type: "CREDIT_CARD",
  savedPaymentMethodId: "savedPaymentMethodId", // By declaring the saved payment method id produced from the SIGNUP request, we'll automatically gather the Stored Credentials reference & add it to this request.
  paymentMethodProperties: {
    "encrypted_card": "encrypted card",
    "public_key_alias": "public key alias of the public key used to encrypt the card",
    "stored_credential_charge": "{"processing_model_details": {"processing_model": "CREDENTIAL_ON_FILE"}" // this json should be converted to string. This can be used only if `savedPaymentMethod.attributes.isStoredCredentialPayment` is true
  },
  isSingleUsePaymentMethod: true,
  ...
}
Note
Also see how to add a payment via the Commerce SDK.

PPC Identification

When executing an Authorize or AuthorizeAndCapture transaction with Verifone, a PaymentProviderContract id (PPC) must be provided. When defining the Payment, the PPC can be provided via Payment#paymentMethodProperties with key payment_provider_contract.

If this value is not present, then VerifonePaymentModificationService#modifyPaymentMethodProperties(…​) identifies & populates the value within the Payment#paymentMethodProperties. VerifonePaymentModificationService#resolvePaymentProviderContract(…​) is meant to be a hook point where you can include custom logic for identifying the PPC id.