NAME

Business::GoCardless::Payment

DESCRIPTION

A class for a gocardless payment, extends Business::GoCardless::Resource

ATTRIBUTES

amount
amount_refunded
charge_date
created_at
currency
description
faster_ach
fx
id
links
metadata
reference
retry_if_possible
scheme
status

Operations on a payment

retry
cancel
update
refund

$Payment->retry if $Payment->failed;

retry and cancel optionally take metadata:

$Payment->cancel( metadata => { ... } );

update

Update the payment's metadata and/or retry_if_possible, returns the updated Payment object:

$Payment->update( metadata => { ... },retry_if_possible => 1 );

refund

Create a refund against the payment, returns a Business::GoCardless::Refund object. Note that refunds are restricted by default on GoCardless accounts and must be enabled by GoCardless support before this will work.

my $Refund = $Payment->refund(
    amount                    => 100,           # required
    total_amount_confirmation => 100,           # defaults to amount_refunded + amount
    reference                 => 'REFUND001',   # optional
    metadata                  => { ... },       # optional
);

total_amount_confirmation is a safety check used by GoCardless to prevent accidental duplicate refunds - it is the total amount refunded on the payment once this refund is applied. If the payment object is stale (i.e. another refund has since been made) then GoCardless will reject the refund.

Status checks on a payment

pending
paid
failed
chargedback
cancelled
withdrawn
refunded
submitted
confirmed

if ( $Payment->failed ) {
    ...
}

Links

Accessors for details found in the links section

payout_id

The ID of the payout the payment was paid out in

mandate_id

The ID of the mandate the payment was collected against

creditor_id

The ID of the creditor receiving the payment

AUTHOR

Lee Johnson - lee@payprop.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. If you would like to contribute documentation, features, bug fixes, or anything else then please raise an issue / pull request:

https://github.com/payprop/business-gocardless