open_payments/outgoing_payment
Types
The options for creating an outgoing payment.
pub type CreateOptions {
CreateOptions(
resource_server: String,
wallet_address: String,
source: CreateSource,
metadata: option.Option(json.Json),
)
}
Constructors
-
CreateOptions( resource_server: String, wallet_address: String, source: CreateSource, metadata: option.Option(json.Json), )
The subset of the outgoing payment fields accepted when creating one.
An outgoing payment is created either from a quote, or directly from an
incoming payment with an explicit debitAmount.
pub type CreateSource {
FromQuote(quote_id: String)
FromIncomingPayment(
incoming_payment: String,
debit_amount: types.Amount,
)
}
Constructors
-
FromQuote(quote_id: String) -
FromIncomingPayment( incoming_payment: String, debit_amount: types.Amount, )
The spent amounts for the current outgoing payment grant, as identified by the presented access token.
pub type GrantSpentAmounts {
GrantSpentAmounts(
spent_receive_amount: option.Option(types.Amount),
spent_debit_amount: option.Option(types.Amount),
)
}
Constructors
-
GrantSpentAmounts( spent_receive_amount: option.Option(types.Amount), spent_debit_amount: option.Option(types.Amount), )
The options for listing outgoing payments.
pub type ListOptions {
ListOptions(
resource_server: String,
wallet_address: String,
cursor: option.Option(String),
first: option.Option(Int),
last: option.Option(Int),
)
}
Constructors
-
ListOptions( resource_server: String, wallet_address: String, cursor: option.Option(String), first: option.Option(Int), last: option.Option(Int), )
See https://openpayments.dev/apis/resource-server/operations/get-outgoing-payment/
pub type OutgoingPayment {
OutgoingPayment(
id: String,
wallet_address: String,
quote_id: option.Option(String),
failed: Bool,
receiver: String,
receive_amount: types.Amount,
debit_amount: types.Amount,
sent_amount: types.Amount,
grant_spent_debit_amount: option.Option(types.Amount),
grant_spent_receive_amount: option.Option(types.Amount),
metadata: option.Option(dynamic.Dynamic),
created_at: String,
)
}
Constructors
-
OutgoingPayment( id: String, wallet_address: String, quote_id: option.Option(String), failed: Bool, receiver: String, receive_amount: types.Amount, debit_amount: types.Amount, sent_amount: types.Amount, grant_spent_debit_amount: option.Option(types.Amount), grant_spent_receive_amount: option.Option(types.Amount), metadata: option.Option(dynamic.Dynamic), created_at: String, )
A page of outgoing payments, as returned by list.
pub type OutgoingPaymentList {
OutgoingPaymentList(
pagination: types.PageInfo,
result: List(OutgoingPayment),
)
}
Constructors
-
OutgoingPaymentList( pagination: types.PageInfo, result: List(OutgoingPayment), )
Values
pub fn create(
client: client.Client,
access_token: String,
options: CreateOptions,
) -> Result(OutgoingPayment, error.OpenPaymentsError)
Creates a new outgoing payment on the given wallet address, either from a quote or directly from an incoming payment. See https://openpayments.dev/apis/resource-server/operations/create-outgoing-payment/
pub fn get(
client: client.Client,
access_token: String,
id: String,
) -> Result(OutgoingPayment, error.OpenPaymentsError)
Fetches the latest state of an outgoing payment.
id is the full outgoing payment URL, as returned by create.
See https://openpayments.dev/apis/resource-server/operations/get-outgoing-payment/
pub fn get_grant_spent_amounts(
client: client.Client,
access_token: String,
resource_server: String,
) -> Result(GrantSpentAmounts, error.OpenPaymentsError)
Fetches the amounts already spent under the outgoing payment grant identified by the given access token. See https://openpayments.dev/apis/resource-server/operations/get-outgoing-payment-grant/
pub fn list(
client: client.Client,
access_token: String,
options: ListOptions,
) -> Result(OutgoingPaymentList, error.OpenPaymentsError)
Lists the outgoing payments on the given wallet address. See https://openpayments.dev/apis/resource-server/operations/list-outgoing-payments/