Worldpay.Partner.Notifications (Worldpay v1.0.0)

Copy Markdown View Source

Worldpay Transaction Notification API — parse partner transaction notifications.

Worldpay sends authorized transaction details to your HTTPS endpoint for debit, credit, and gift card transactions.

Setup

Your notification URL is registered with Worldpay IM. IP whitelist your WAF to allow Worldpay notification IPs.

Usage

In your webhook controller, parse the incoming notification:

{:ok, notification} = Worldpay.Partner.Notifications.parse(body)
notification.transaction_type  # => :credit_sale | :debit_sale | :gift_card | ...
notification.amount            # => 1999
notification.approval_number   # => "123456"

Summary

Functions

Parse a partner transaction notification body.

Types

notification()

@type notification() :: %{
  transaction_type: atom(),
  amount: non_neg_integer() | nil,
  approval_number: String.t() | nil,
  card_type: String.t() | nil,
  card_last4: String.t() | nil,
  merchant_id: String.t() | nil,
  terminal_id: String.t() | nil,
  transaction_date: String.t() | nil,
  reference_number: String.t() | nil,
  raw: map()
}

Functions

parse(body)

@spec parse(String.t() | %{required(String.t()) => term()}) :: {:ok, notification()}

Parse a partner transaction notification body.