The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Business::GoCardless::Webhook

DESCRIPTION

A class for gocardless webhooks, extends Business::GoCardless::Resource. For more details see the gocardless API documentation specific to webhooks: https://developer.gocardless.com/api-reference/#appendix-webhooks

Note to use webhooks you must set the webhook_secret on the client object

ATTRIBUTES

    json
    signature
    has_legacy_data

Operations on a webhook

events

Get a list of Business::GoCardless::Webhook::Event objects for processing:

    foreach my $Event ( @{ $Webhook->events // [] } ) {
        ...
    }

json

Allows you to set the json data sent to you in the webhook:

    $Webhook->json( $json_data )

Will throw a Business::GoCardless::Exception exception if the json fails to parse or if the signature does not match the payload data.

is_legacy

See if the webhook is a legacy (Basic API) webhook

    if ( $Webhook->is_legacy ) {
        ...
    }

CONFIRMING WEBHOOKS

According to the gocardless API docs you should respond once the signature of the webhook has been checked. The response is a HTTP status 204 code:

        HTTP/1.1 204 OK

You should handle this in your own code, the library will not do it for you. See https://developer.gocardless.com/#response for more information

AUTHOR

Lee Johnson - leejo@cpan.org

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/Humanstate/business-gocardless