View Source Plaid.PaymentInitiation (elixir_plaid v1.2.1)
Plaid Payment Initiation API calls and schema.
Link to this section Summary
Functions
Create a payment for a recipient.
Create a recipient for payment initiation.
Get payment details.
Get a recipient for payment initiation.
List payments.
List the payment recipients that you have previously created.
Link to this section Functions
create_payment(recipient_id, reference, amount, options \\ %{}, config)
View SourceSpecs
create_payment( recipient_id :: String.t(), reference :: String.t(), amount :: Plaid.PaymentInitiation.Amount.t(), options, Plaid.config() ) :: {:ok, Plaid.PaymentInitiation.CreatePaymentResponse.t()} | {:error, Plaid.Error.t()} when options: %{optional(:schedule) => Plaid.PaymentInitiation.Schedule.t()}
Create a payment for a recipient.
Does a POST /payment_initiation/payment/create
call which creates
a one-time or standing (recurring) payment for a recipient.
params
Params
recipient_id
- The ID of the recipient the payment is for.reference
- A reference for the payment.amount
- A payment amount.
options
Options
:schedule
- The schedule that the payment will be executed on.
examples
Examples
PaymentInitiation.create_payment(
"recipient-id-prod-123xxx",
"Purchase Order 123",
%PaymentInitiation.Amount{currency: "GBP", value: 200},
%{
schedule: %PaymentInitiation.Schedule{
interval: "WEEKLY",
interval_execution_day: 2,
start_date: "2021-01-01",
end_date: "2021-01-31"
}
},
client_id: "123",
secret: "abc"
)
{:ok, %PaymentInitiation.CreateRecipientResponse{}}
Specs
create_recipient(name :: String.t(), options, Plaid.config()) :: {:ok, Plaid.PaymentInitiation.CreateRecipientResponse.t()} | {:error, Plaid.Error.t()} when options: %{ optional(:iban) => String.t(), optional(:bacs) => Plaid.PaymentInitiation.BACS.t(), optional(:address) => Plaid.PaymentInitiation.Address.t() }
Create a recipient for payment initiation.
Does a POST /payment_initiation/recipient/create
call which creates a payment
recipient for payment initiation.
The endpoint is idempotent: if a request has already been made with the
same payment details, Plaid will return the same recipient_id
.
params
Params
name
- The name of the recipient.
options
Options
:iban
- The International Bank Account Number (IBAN) for the recipient.:bacs
- The sort code of the account.:address
- The address of the payment recipient.
If :bacs
data is not provided, :iban
becomes required.
examples
Examples
PaymentInitiation.create_recipient("Wonder Wallet", client_id: "123", secret: "abc")
{:ok, %PaymentInitiation.CreateRecipientResponse{}}
Specs
get_payment(payment_id :: String.t(), Plaid.config()) :: {:ok, Plaid.PaymentInitiation.GetPaymentResponse.t()} | {:error, Plaid.Error.t()}
Get payment details.
Does a POST /payment_initiation/payment/create
call to get
details about a payment.
params
Params
payment_id
- The payment_id returned from /payment_initiation/payment/create.
examples
Examples
PaymentInitiation.get_payment(
"payment-id-prod-123xxx",
client_id: "123",
secret: "abc"
)
{:ok, %PaymentInitiation.GetPaymentResponse{}}
Specs
get_recipient(recipient_id :: String.t(), Plaid.config()) :: {:ok, Plaid.PaymentInitiation.CreateRecipientResponse.t()} | {:error, Plaid.Error.t()}
Get a recipient for payment initiation.
Does a POST /payment_initiation/recipient/get
call to
get details about a payment recipient.
params
Params
recipient_id
- The ID of the recipient.
examples
Examples
PaymentInitiation.get_recipient("recipient-id-sandbox-123xxx", client_id: "123", secret: "abc")
{:ok, %PaymentInitiation.GetRecipientResponse{}}
Specs
list_payments(options, Plaid.config()) :: {:ok, Plaid.PaymentInitiation.ListPaymentsResponse.t()} | {:error, Plaid.Error.t()} when options: %{optional(:count) => integer(), optional(:cursor) => String.t()}
List payments.
Does a POST /payment_initiation/payment/list
call to get
all created payments.
options
Options
:count
- The maximum number of payments to return.:cursor
- A date string in RFC 3339 format. Only payments created before the cursor will be returned.
examples
Examples
PaymentInitiation.list_payments(
client_id: "123",
secret: "abc"
)
{:ok, %PaymentInitiation.ListPaymentsResponse{}}
Specs
list_recipients(Plaid.config()) :: {:ok, Plaid.PaymentInitiation.ListRecipientsResponse.t()} | {:error, Plaid.Error.t()}
List the payment recipients that you have previously created.
Does a POST /payment_initiation/recipient/list
call to
list all recipients you have previously created.
examples
Examples
PaymentInitiation.list_recipients(client_id: "123", secret: "abc")
{:ok, %PaymentInitiation.ListRecipientsResponse{}}