HitPay (hit_pay v0.2.3)

An Elixir client for HitPay payment gateway (https://hit-pay.com/docs.html)

Link to this section Summary

Functions

Create a payment request

Delete a payment request

Get payment status

Verify a webhook

Link to this section Functions

Link to this function

create_payment_request(params)

Specs

create_payment_request(map()) :: {:ok, map()} | {:error, any()}

Create a payment request

Examples

params = %{
    email: "tan@thekirinlab.com",
    redirect_url: "https://packargo.thekirinlab.com/hitpay/success",
    webhook: "https://packargo.thekirinlab.com/hitpay/webhook",
    amount: "599",
    currency: "SGD"
} |> HitPay.create_payment_request
Link to this function

delete_payment_request(request_id)

Specs

delete_payment_request(binary()) :: {:ok, map()} | {:error, any()}

Delete a payment request

Examples

HitPay.delete_payment_request("93e61239-4334-42fc-be25-6c221b982699")
Link to this function

get_payment_status(request_id)

Specs

get_payment_status(binary()) :: {:ok, map()} | {:error, any()}

Get payment status

Examples

HitPay.get_payment_status("93e61239-4334-42fc-be25-6c221b982699")
Link to this function

verify_webhook?(params)

Specs

verify_webhook?(map()) :: boolean()

Verify a webhook

Examples

%{
  "amount" => "35.00",
  "currency" => "SGD",
  "hmac" => "8ae5832ebc8ff5e794815e06b99cb7593dfa3e7b9e5f027f19e9af7f8442a55f",
  "payment_id" => "93e85e66-7579-4144-b478-dedc79054385",
  "payment_request_id" => "93e85e4f-101c-4947-bd93-e6392423c3d2",
  "phone" => "",
  "reference_number" => "FWBGCKSA",
  "status" => "completed"
} |> HitPay.verify_webhook?()