4D Payments SDK 2016 .NET Edition

Questions / Feedback?

FDMSGiftCard Component

Properties   Methods   Events   Configuration Settings   Errors  

The FDMSGiftCard component is used to manipulate funds on Stored Value (Gift) Cards with the FDMS Closed Loop Gift Card System. This component supports both card-present and card-not-present gift card transactions, and allows for simple, direct, secure communication to the Datawire gateway to FDMS through a standard Internet connection. This component can be integrated into web pages or stand- alone Point Of Sale applications. Because all TLS/SSL communications are handled inside the component, any application or web page can be deployed without the need for expensive dedicated TLS/SSL servers.




A Stored Value Card (or Gift Card as they are commonly called) is a not actually a type of credit or debit card. Simply put, a Stored Value Card is a card with a magnetic strip on the back that holds information about monies that have been "pre-paid" into an account for the purpose of making financial transactions. Examples include a retailer's gift card, a prepaid telephone card, a college campus meal plan card, a reloadable subway pass, etcetera. Not included are government income-support cards, otherwise known as EBT cards or electronic food stamps.

The FDMSGiftCard component makes gift card transactions very easy by adding an additional layer of abstraction between the programmer and the protocol. There is no need to deal with raw sockets, TLS/SSL handshakes, or data packet formatting. The steps to setting up the component and authorizing a transaction are outlined below:

First, you must register and activate your account with Datawire. Datawire will provide you with a MerchantNumber and MerchantTerminalNumber, but you'll need to use the FDMSRegister component to activate the merchant and receive a DatawireId. Once you acquire the DatawireId and receive your transaction URLs through Service Discovery, you may begin to authorize transactions.

To authorize a credit card, set the MerchantNumber and MerchantTerminalNumber with the values supplied by FDMS and Datawire, and the DatawireId with the value retrieved by the FDMSRegister component after activating your merchant account. Set the URL property with one of the URLs you retrieved during Service Discovery.

  FDMSGiftCard.MerchantNumber = "57111111111";          // Supplied by FDMS/Datawire  
  FDMSGiftCard.MerchantTerminalNumber = "00000000001";  // Supplied by FDMS/Datawire
  FDMSGiftCard.DatawireId = "00010388888888888878";     // Retrieved with the FDMSRegister component.  

After the merchant information is setup, you may enter transaction data. When the card is Manually Entered, the merchant should fill the Number and EntryDataSource fields. Otherwise, you should fill the MagneticStripe field with the Track 2 data read from the back of the card.

  FDMSGiftCard.Card.MagneticStripe = "6010567008288444=00010004000070771026";
  FDMSGiftCard.Card.EntryDataSource = edsTrack2;

Then set additional information about the transaction, including any merchant-designated tracking information, such as the Id of the employee making the transaction, the terminal where the transaction is taking place, any alternate identification for the merchant location, and transaction and reference numbers.

  FDMSGiftCard.TransactionNumber = "0000001V000003";
  FDMSGiftCard.ClerkId = "123";
  FDMSGiftCard.ReferenceNumber = "555523";  
  FDMSGiftCard.AlternateMerchantId = "132123";  
  FDMSGiftCard.TerminalId = "1234"; 
Now you must choose what transaction you wish to make. Adding Value to a card, Redeeming a card, voiding a previous transaction, or retrieving the card's current balance.

To add funds to an existing Gift Card, simply set the TransactionAmount with the amount to add to the card, and then call LoadCard. Activating a new gift card is handled similarly, by calling ActivateCard instead.

To redeem funds from a Gift Card due to a customer purchase, set TransactionAmount to the total for the purchase and call RedeemCard. If the Gift Card account contains enough funds, Code will indicate the card was approved. If there are not enough funds available on the card to cover the TransactionAmount, normally the transaction will be declined. However, the merchant may set RedemptionType to rtPartialRedemption. This allows the customer to split the cost of the purchase between the Gift Card and another form of payment. Instead of declining the Gift Card, PreviousBalance and NewBalance can be used to deduce the amount removed from the Gift Card. The merchant may subtract that from the requested TransactionAmount to determine the difference to charge the customer.

You may also inquire as to the total funds contained on the card by calling BalanceInquiry. This will not effect the amount of funds contained on the card in any way.

You also have the ability to lock funds on a card with the LockCard method, so that they may not be used for any other purchase until first unlocked. Previous transactions may be voided with VoidTransaction, and any transactions for which you did not receive a response (due to network issues), should be immediately reversed using the ReverseLastTransaction method.

The status of any of the above transactions will be stored in the Code field, with human-readable text appearing in Text. Like the FDMSRetail component, there are several other Response fields which will contain data that should be logged.

Property List

The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

AlternateMerchantIdMerchant-designated store or location number.
ApplicationIdIdentifies the merchant application to the Datawire System.
CardContains the customer's credit card information.
ClerkIdIdentifies the clerk executing this transaction.
DatawireIdIdentifies the merchant to the Datawire System.
LockTypeIndicates the type of lock requested by the LockCard method.
MerchantNumberA unique number used to identify the merchant within the FDMS and Datawire systems.
MerchantTerminalNumberUsed to identify a unique terminal within a merchant location.
ProxyA set of properties related to proxy access.
RedemptionTypeIdentifies the type of redemption to execute.
ReferenceNumberReference number used to identify the transaction.
ResponseContains the response returned from the FDMS Closed Loop Gift Card system.
SSLAcceptServerCertInstructs the component to unconditionally accept the server certificate that matches the supplied certificate.
SSLCertThe certificate to be used during SSL negotiation.
SSLServerCertThe server certificate for the last established connection.
TerminalIdMerchant-generated 4-digit terminal Id.
TimeoutA timeout for the component.
TransactionAmountPurchase amount to be authorized.
TransactionNumberUniquely identifies the transaction.
URLLocation of the Datawire server to which transactions are sent.
VoidTypeIdentifies the type of void to execute.

Method List

The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

ActivateCardActivates a Gift Card.
BalanceInquiryRetrieves the balance remaining on a gift card.
ConfigSets or retrieves a configuration setting.
InterruptInterrupts the current action.
LoadCardAdds funds to a gift card.
LockCardLocks funds on a gift card.
RedeemCardRemoves funds from the gift card for a purchase.
ResetClears all properties to their default values.
ReverseLastTransactionReverses the last attempted transaction.
VoidTransactionVoids a previous transaction.

Event List

The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

ConnectedFired immediately after a connection completes (or fails).
DataPacketInFired when receiving a data packet from the transaction server.
DataPacketOutFired when sending a data packet to the transaction server.
DisconnectedFired when a connection is closed.
ErrorInformation about errors during data delivery.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StatusShows the progress of the FDMS/Datawire connection.

Configuration Settings

The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.

AssignMerchantWorkingKeyAssigns a merchant working key to be used by all Internet transactions with EANs.
CardAvailableDateDate in the future when the gift card's activation will complete.
CardExpirationDateDate you wish the gift card to expire.
ClientTimeoutIndicates timeout client application will wait for response.
CurrencyCodeCurrency Code for this transaction.
DebugTraceWhether to enable debug logging.
DecryptedWorkingKeyThe decrypted Merchant Working Key.
EANExtended Account Number.
EchoBackGeneric field used at the merchant's discretion.
EncryptedWorkingKeyThe encrypted Merchant Working Key.
FDMSPublicKeyThe FDMS Public Key.
GenerateMerchantKeyPairGenerates a private and public key pair.
GenerateWorkingKeyGenerates a Merchant Working Key.
IsOnlineRefundIndicates whether a transaction is Online Refund Authorization.
IsRetailTransactionDetermines whether the transaction was performed in an retail or internet environment.
MerchantKeyIDThe Merchant Key ID associated with the Merchant ID.
MerchantPrivateKeyThe Merchant's Private Key.
MerchantPublicKeyThe Merchant's Public Key.
RefundAdds value back onto a card.
SCVSecurity Card Value.
SourceCodeUsed to identify the source of the transaction.
User1Generic field used at the merchant's discretion.
User2Generic field used at the merchant's discretion.
CloseStreamAfterTransferIf true, the component will close the upload or download stream after the transfer.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the component whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallListenerIf true, the component binds to a SOCKS firewall as a server (IPPort only).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the component binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
UseNTLMv2Whether to use NTLM V2.
CACertFilePathsThe paths to CA certificate files when using Mono on Unix/Linux.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedProtocolReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
GUIAvailableTells the component whether or not a message loop is available for processing events.
LicenseInfoInformation about the current license.
UseInternalSecurityAPITells the component whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 4D Payments Inc. - All rights reserved.
4D Payments SDK 2016 .NET Edition - Version 16.0 [Build 8017]