open_payments/incoming_payment
Types
The options for creating an incoming payment.
pub type CreateOptions {
CreateOptions(
resource_server: String,
wallet_address: String,
incoming_amount: option.Option(types.Amount),
expires_at: option.Option(String),
metadata: option.Option(json.Json),
)
}
Constructors
-
CreateOptions( resource_server: String, wallet_address: String, incoming_amount: option.Option(types.Amount), expires_at: option.Option(String), metadata: option.Option(json.Json), )
The ILP details a sender uses to pay into an incoming payment.
pub type IlpPaymentMethod {
IlpPaymentMethod(ilp_address: String, shared_secret: String)
}
Constructors
-
IlpPaymentMethod(ilp_address: String, shared_secret: String)
See https://openpayments.dev/apis/resource-server/operations/get-incoming-payment/
pub type IncomingPayment {
IncomingPayment(
id: String,
wallet_address: String,
completed: Bool,
incoming_amount: option.Option(types.Amount),
received_amount: types.Amount,
expires_at: option.Option(String),
metadata: option.Option(dynamic.Dynamic),
created_at: String,
methods: List(IlpPaymentMethod),
)
}
Constructors
-
IncomingPayment( id: String, wallet_address: String, completed: Bool, incoming_amount: option.Option(types.Amount), received_amount: types.Amount, expires_at: option.Option(String), metadata: option.Option(dynamic.Dynamic), created_at: String, methods: List(IlpPaymentMethod), )
A page of incoming payments, as returned by list.
pub type IncomingPaymentList {
IncomingPaymentList(
pagination: types.PageInfo,
result: List(IncomingPayment),
)
}
Constructors
-
IncomingPaymentList( pagination: types.PageInfo, result: List(IncomingPayment), )
The options for listing incoming payments.
first or last sets the page size (1 to 100); only one may be given,
and last pages backwards from cursor, so it requires one.
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), )
The public view of an incoming payment, as returned by get_public to a
client that doesn’t hold an access token for it. auth_server is where a
grant for the incoming payment can be requested.
See https://openpayments.dev/apis/resource-server/operations/get-incoming-payment/
pub type PublicIncomingPayment {
PublicIncomingPayment(
auth_server: String,
received_amount: option.Option(types.Amount),
)
}
Constructors
-
PublicIncomingPayment( auth_server: String, received_amount: option.Option(types.Amount), )
Values
pub fn complete(
client: client.Client,
access_token: String,
id: String,
) -> Result(IncomingPayment, error.OpenPaymentsError)
Marks an incoming payment as completed, so that it will no longer accept
any further payments.
id is the full incoming payment URL, as returned by create.
See https://openpayments.dev/apis/resource-server/operations/complete-incoming-payment/
pub fn create(
client: client.Client,
access_token: String,
options: CreateOptions,
) -> Result(IncomingPayment, error.OpenPaymentsError)
Creates a new incoming payment on the given wallet address. See https://openpayments.dev/apis/resource-server/operations/create-incoming-payment/
pub fn get(
client: client.Client,
access_token: String,
id: String,
) -> Result(IncomingPayment, error.OpenPaymentsError)
Fetches the latest state of an incoming payment.
id is the full incoming payment URL, as returned by create.
See https://openpayments.dev/apis/resource-server/operations/get-incoming-payment/
pub fn get_public(
id: String,
) -> Result(PublicIncomingPayment, error.OpenPaymentsError)
Fetches the public details of an incoming payment, without signing the
request or sending an access token. Use get instead to read the full
incoming payment with an access token.
id is the full incoming payment URL.
See https://openpayments.dev/apis/resource-server/operations/get-incoming-payment/
pub fn list(
client: client.Client,
access_token: String,
options: ListOptions,
) -> Result(IncomingPaymentList, error.OpenPaymentsError)
Lists the incoming payments on the given wallet address. See https://openpayments.dev/apis/resource-server/operations/list-incoming-payments/