NAME
Business::GoCardless::BillingRequest
DESCRIPTION
A class for a gocardless billing request, extends Business::GoCardless::Resource
Billing Requests are the recommended way to collect payments and/or set up mandates, replacing Redirect Flows. See https://developer.gocardless.com/api-reference/#billing-requests-billing-requests
ATTRIBUTES
actions
auto_fulfil
created_at
creditor_address
creditor_identifier
creditor_name
creditor_scheme_identifier
experimentation
fallback_enabled
fallback_occurred
id
instalment_schedule_request
links
mandate_request
metadata
payment_context_code
payment_purpose_code
payment_request
purpose_code
resources
sign_flow_url
status
subscription_request
Operations on a billing request
collect_customer_details
Collect the customer details (if not already known), takes customer and customer_billing_detail hashrefs:
$BillingRequest->collect_customer_details(
customer => {
email => 'lee@example.com',
given_name => 'Lee',
family_name => 'Johnson',
},
customer_billing_detail => {
address_line1 => '1 Test Street',
city => 'London',
postal_code => 'E1 1AA',
country_code => 'GB',
},
);
collect_bank_account
Collect the customer's bank account details:
$BillingRequest->collect_bank_account(
account_holder_name => 'Lee Johnson',
account_number => '55779911',
branch_code => '200000',
country_code => 'GB',
);
confirm_payer_details
Confirm the payer details have been collected (required for mandate requests):
$BillingRequest->confirm_payer_details;
fulfil
Fulfil the billing request once it is ready_to_fulfil, creating the payment and/or mandate:
$BillingRequest->fulfil;
cancel
Cancel the billing request, causing any billing request flows to expire:
$BillingRequest->cancel;
notify
Notify the customer about the billing request:
$BillingRequest->notify( notification_type => 'email' );
fallback
Trigger a fallback from Pay by Bank to direct debit (when fallback_enabled):
$BillingRequest->fallback;
choose_currency
Choose the currency of the billing request (when it supports multiple):
$BillingRequest->choose_currency( currency => 'EUR' );
select_institution
Select the customer's bank (for Pay by Bank):
$BillingRequest->select_institution(
institution => 'monzo',
country_code => 'GB',
);
Status checks on a billing request
pending
ready_to_fulfil
fulfilling
fulfilled
cancelled
if ( $BillingRequest->pending ) {
...
}
Flows and institutions
create_flow
Create a Business::GoCardless::BillingRequestFlow for the billing request, which provides the authorisation_url to send the customer to:
my $Flow = $BillingRequest->create_flow(
redirect_uri => 'https://example.com/complete',
exit_uri => 'https://example.com/exit',
);
my $url = $Flow->authorisation_url;
institutions
Get a list of Business::GoCardless::Institution objects for the billing request, for use with "select_institution":
my @institutions = $BillingRequest->institutions( country_code => 'GB' );
Links
Shortcut methods to get the IDs of the resources created by the billing request:
customer_id
mandate_id
payment_id
subscription_id
instalment_schedule_id
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