VFN_Capture()
This subprocedure calls Verifone’s Capture service.
Subprocedure Prototype
|
Returns *OFF if an error occurs during processing, *ON otherwise. |
|
|
|
|
|
Optional parameter that, if passed, will contain error data returned from the subprocedure. |
Example Code
// Example Program: T_CAP
// Description:
// This is a test program to illustrate how to call the VFN_Capture()
// subprocedure to collect payment authorization for settlement.
//
// This program assumes you have already called VFN_StartSession(),
// and will call VFN_EndSession() afterwards.
Ctl-Opt DftActGrp(*No) ActGrp(*Caller) BndDir('PTTIBND');
/COPY QRPGLECPY,VFNCB
// This is included for demo output purposes.
Dcl-Pr WriteToJobLog Int(10) Extproc('Qp0zLprintf');
pString Pointer Value Options(*String);
End-Pr;
Dcl-C NewLine x'15';
// This will capture returned error information
Dcl-Ds ErrorDS LikeDS(VFN_ErrorDS_t) Inz(*LikeDS);
// This will be used to pass request information to the API call
Dcl-Ds CaptureReqDS LikeDS(VFN_CaptureReqDS_t) Inz(*LikeDS);
// This will store parsed response data from the API call
Dcl-Ds CaptureRspDS LikeDS(VFN_CaptureRspDS_t) Inz(*LikeDS);
reset ErrorDS;
reset CaptureReqDS;
reset CaptureRspDS;
// This must be a device that has already been successfully registered
// with VFN_Register() and which exists in VFNDVC.
CaptureReqDS.DeviceID = 'test';
// These fields can be assigned a log file name, and will write the
// request and response xml data to the logging directory.
CaptureReqDS.RequestLog = 'T_CAP_Request.xml';
CaptureReqDS.ResponseLog = 'T_CAP_Response.xml';
// These fields were chosen to simulate a card-swipe transaction.
// Specifying the Payment Type is optional here.
CaptureReqDS.TransAmount = 47.72;
//CaptureReqDS.PaymentType = 'CREDIT';
CaptureReqDS.TaxInd = '0';
// if VFN_Capture() returns *Off, it means that an error occurred
// as part of the overall communication process, and the information
// will be in ErrorDS - ErrorDS.Message is the main field to look at
// for troubleshooting.
if not VFN_Capture( CaptureReqDS : CaptureRspDS : ErrorDS );
// handle error
WriteToJobLog( 'Message ID: ' + ErrorDS.MessageId + NewLine );
WriteToJobLog( 'Message: ' + ErrorDS.Message + NewLine );
*INLR = *On;
return;
else;
// These are a selection of fields that would likely be returned
// from a successful swiped credit card transaction.
WriteToJobLog( 'Response Text: ' + CaptureRspDS.ResponseText
+ NewLine );
WriteToJobLog( 'Result: ' + CaptureRspDS.Result + NewLine );
WriteToJobLog( 'Result Code: ' + CaptureRspDS.ResultCode + NewLine );
WriteToJobLog( 'Termination Status: ' + CaptureRspDS.TerminationStatus
+ NewLine );
WriteToJobLog( 'Counter: ' + %Char(CaptureRspDS.Counter) + NewLine );
WriteToJobLog( 'Payment Type: ' + CaptureRspDS.PaymentType + NewLine );
WriteToJobLog( 'Payment Media: ' + CaptureRspDS.PaymentMedia
+ NewLine );
WriteToJobLog( 'Approved Amount: ' + CaptureRspDS.ApprovedAmount
+ NewLine );
WriteToJobLog( 'Original Transaction Amount: '
+ CaptureRspDS.OrigTransAmount + NewLine );
WriteToJobLog( 'Card Entry Mode: ' + CaptureRspDS.CardEntryMode
+ NewLine );
WriteToJobLog( 'Cardholder: ' + CaptureRspDS.Cardholder + NewLine );
// Please see QRPGLECPY,VFNCB for the other fields
// in VFN_CaptureReqDS_t and VFN_CaptureRspDS_t
endif;
*INLR = *On;
return;
Data Structures
|
|
|
Required The ID of the payment device, registered in VFNDVC, that is processing the transaction. |
|
Specifies the file name or path of the request log file. Will have no effect if logging is not enabled. Example: |
|
Specifies the file name or path of the response log file. Will have no effect if logging is not enabled. Example: |
|
Required For VX Devices, this value is limited to a 7P 2 field. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MX Solutions Devices only |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MX Solutions Devices only |
|
MX Solutions Devices only |
|
MX Solutions Devices only |
|
MX Solutions Devices only This timestamp field will be formatted internally in order to match Verifone's requirements. |
|
MX Solutions Devices only |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MX Solutions Devices only |
|
MX Solutions Devices only |
|
MX Solutions Devices only |
|
Override the default value set in VFN_Register() or REGVFNDVC. Default Value: |
|
Override the default value set in VFN_Register() or REGVFNDVC. Default Value: |
|
Override the default value set in VFN_Register() or REGVFNDVC. Default Value: |
|
|
|
This field corresponds to the field RESPONSE_TEXT in your device's Verifone documentation. |
|
This field corresponds to the field RESULT in your device's Verifone documentation. |
|
This field corresponds to the field RESULT_CODE in your device's Verifone documentation. |
|
This field corresponds to the field TERMINATION_STATUS in your device's Verifone documentation. |
|
This field corresponds to the field COUNTER in your device's Verifone documentation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|