NAME

Business::TrueLayer::Payment - class representing a payment as used in the TrueLayer v3 API.

SYNOPSIS

my $Payment = Business::TrueLayer::Payment->new(
    amount_in_minor => ...
);

ATTRIBUTES

id (Str)
status (Str)
resource_token (Str)
amount_in_minor (Int)
currency (Str)
payment_method

A Business::TrueLayer::Payment::Method object. Hash refs will be coerced.

user

A Business::TrueLayer::User object. Hash refs will be coerced.

METHODS

Returns the TrueLayer hosted payment page URI, allowing you to redirect a user to it to complete the payment.

my $link = $Payment->hosted_payment_page_link(
    $return_uri, # must be one of those set in the TrueLayer console
);

It only makes sense to do this after you have created a payment, so the object will check some of its attributes and throw an exception if it is not in the correct state.

authorization_required

authorizing

authorized

executed

settled

failed

Check if the payment is at a current state:

if ( $Payment->authorization_required ) {
    # get a payment link
    my $link = $Payment->hosted_payment_page_link;
}

SEE ALSO

Business::TrueLayer::Payment::Method

Business::TrueLayer::User