Worldpay.RAFT (Worldpay v1.0.0)

Copy Markdown View Source

Worldpay RAFT 610 Interface — ISO 8583 card-present processing.

Covers all payment types supported by the RAFT platform: Credit, Debit, EBT (SNAP/WIC), Gift Card, Fleet, Check/ACH, WIC.

This module provides:

  1. Worldpay.RAFT.Message — ISO 8583 message builders
  2. Worldpay.RAFT.Response — response field extractors
  3. Worldpay.RAFT — submit messages over TCP/TLS to RAFT

RAFT transaction types

Credit card

  • Authorization (0100)
  • Sale (0200)
  • Capture (0220)
  • Reversal — full (0420), partial (0420 with partial flag)
  • Refund (0200 with reversal indicator)
  • Incremental authorization

Debit card

  • Authorization (0100)
  • Pre-authorization / DUKPT key exchange
  • Reversal
  • Balance Inquiry (0100)

EBT (Electronic Benefits Transfer)

  • SNAP purchase
  • SNAP return
  • Cash Benefits withdrawal
  • Balance Inquiry
  • Voice Authorization / Voucher Clear

Gift Card

  • Activation (0200)
  • Balance Inquiry (0100)
  • Mini-Statement (0100)
  • Mass Transaction (0200)
  • Reload / Add Value (0200)

Fleet Card

  • Authorization
  • Reversal

Check / ACH

  • Enhanced Check Authorization (0200)
  • Reversal (0420)

WIC (Women, Infants, Children)

  • Authorization
  • Reconciliation records

Network management

  • System Health Check (0800)
  • Key Change Request (0800)
  • Lane Validation Request
  • FleetOne Batch Close
  • Reconciliation (0500/0510): Batch Inquiry, Batch Release, Batch Totals

Summary

Functions

Build a credit card authorization request.

Build a balance inquiry message.

Build a batch inquiry message (0500).

Build a batch release (close) message (0500).

Build a batch totals request.

Build a capture (settlement) message.

Build a Check/ACH Enhanced Check Authorization.

Build an EBT Cash Benefits withdrawal.

Build an EBT SNAP return/refund.

Build an EBT SNAP purchase message.

Build a Fleet card authorization.

Build a FleetOne batch close request.

Build a Gift Card activation message.

Build a Gift Card mini-statement message.

Build a Gift Card add-value (reload) message.

Build a system health check message (0800).

Build a DUKPT key change request (0800).

Build a lane validation request.

Build a refund / credit message.

Build a full reversal message.

Build a credit card sale (auth + auto-capture).

Build a WIC authorization.

Submit a RAFT ISO 8583 message over TCP/TLS.

Functions

build_auth(opts)

@spec build_auth(keyword()) :: auth_msg()

Build a credit card authorization request.

Required opts

  • :pan — primary account number
  • :expiry — MMYY format
  • :amount — in cents/pennies (integer)
  • :merchant_id — RAFT merchant ID
  • :terminal_id — terminal identifier
  • :stan — systems trace audit number (6 digits)
  • :entry_mode"022" (swipe) | "051" (EMV) | "071" (contactless) | "011" (keyed)

Optional opts

  • :cvv2 — card verification value
  • :avs_zip — zip for AVS check
  • :avs_address — address for AVS
  • :track2 — raw track 2 data (card-present)
  • :emv_data — EMV TLV hex string (Field 55)
  • :cashback_amount — cashback in cents (debit)
  • :pin_block — encrypted PIN (DUKPT, debit/EBT)
  • :incremental — boolean (incremental auth)
  • :original_amount — original auth amount (for incremental)

build_balance_inquiry(opts)

@spec build_balance_inquiry(keyword()) :: balance_inquiry_msg()

Build a balance inquiry message.

build_batch_inquiry(opts)

@spec build_batch_inquiry(keyword()) :: batch_inquiry_msg()

Build a batch inquiry message (0500).

build_batch_release(opts)

@spec build_batch_release(keyword()) :: batch_release_msg()

Build a batch release (close) message (0500).

build_batch_totals(opts)

@spec build_batch_totals(keyword()) :: batch_totals_msg()

Build a batch totals request.

build_capture(opts)

@spec build_capture(keyword()) :: capture_msg()

Build a capture (settlement) message.

build_check_auth(opts)

@spec build_check_auth(keyword()) :: check_auth_msg()

Build a Check/ACH Enhanced Check Authorization.

build_ebt_cash(opts)

@spec build_ebt_cash(keyword()) :: ebt_cash_msg()

Build an EBT Cash Benefits withdrawal.

build_ebt_return(opts)

@spec build_ebt_return(keyword()) :: ebt_return_msg()

Build an EBT SNAP return/refund.

build_ebt_snap_purchase(opts)

@spec build_ebt_snap_purchase(keyword()) :: ebt_snap_purchase_msg()

Build an EBT SNAP purchase message.

build_fleet_auth(opts)

@spec build_fleet_auth(keyword()) :: fleet_auth_msg()

Build a Fleet card authorization.

build_fleet_batch_close(opts)

@spec build_fleet_batch_close(keyword()) :: fleet_batch_close_msg()

Build a FleetOne batch close request.

build_gift_activation(opts)

@spec build_gift_activation(keyword()) :: gift_activation_msg()

Build a Gift Card activation message.

build_gift_mini_statement(opts)

@spec build_gift_mini_statement(keyword()) :: gift_mini_statement_msg()

Build a Gift Card mini-statement message.

build_gift_reload(opts)

@spec build_gift_reload(keyword()) :: gift_activation_msg()

Build a Gift Card add-value (reload) message.

build_health_check(opts)

@spec build_health_check(keyword()) :: health_check_msg()

Build a system health check message (0800).

build_key_change(opts)

@spec build_key_change(keyword()) :: key_change_msg()

Build a DUKPT key change request (0800).

build_lane_validation(opts)

@spec build_lane_validation(keyword()) :: lane_validation_msg()

Build a lane validation request.

build_refund(opts)

@spec build_refund(keyword()) :: refund_msg()

Build a refund / credit message.

build_reversal(opts)

@spec build_reversal(keyword()) :: reversal_msg()

Build a full reversal message.

build_sale(opts)

@spec build_sale(keyword()) :: auth_msg()

Build a credit card sale (auth + auto-capture).

build_wic_auth(opts)

@spec build_wic_auth(keyword()) :: wic_auth_msg()

Build a WIC authorization.

submit(message, config)

@spec submit(%{required(atom()) => term()}, Worldpay.Config.t()) ::
  {:ok, %{required(String.t()) => term()}} | {:error, Worldpay.Error.t()}

Submit a RAFT ISO 8583 message over TCP/TLS.

In production, RAFT connection details (host, port, TLS certs) are supplied by Worldpay Implementation Manager. This function establishes a TLS connection, frames the message in the RAFT envelope, sends it, and parses the response.

Note: The actual ISO 8583 bit-map encoding and field serialization are proprietary to RAFT. This function is a integration point; replace serialize/1 and deserialize/1 with the RAFT-specific codec provided by Worldpay.