{"id":15916888,"url":"https://github.com/nestednet/gocardless-laravel","last_synced_at":"2025-03-24T07:31:44.251Z","repository":{"id":57025268,"uuid":"173085964","full_name":"Nestednet/gocardless-laravel","owner":"Nestednet","description":"GoCardless Pro PHP Client package integration for Laravel.","archived":false,"fork":false,"pushed_at":"2020-08-12T20:40:11.000Z","size":31,"stargazers_count":13,"open_issues_count":2,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-19T03:11:19.375Z","etag":null,"topics":["gocardless","laravel","laravel-package","payment-processing","php","php7","webhook","webhooks"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nestednet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-28T09:52:44.000Z","updated_at":"2024-10-12T16:56:09.000Z","dependencies_parsed_at":"2022-08-23T13:51:07.411Z","dependency_job_id":null,"html_url":"https://github.com/Nestednet/gocardless-laravel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nestednet%2Fgocardless-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nestednet%2Fgocardless-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nestednet%2Fgocardless-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nestednet%2Fgocardless-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nestednet","download_url":"https://codeload.github.com/Nestednet/gocardless-laravel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245227437,"owners_count":20580884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gocardless","laravel","laravel-package","payment-processing","php","php7","webhook","webhooks"],"created_at":"2024-10-06T18:06:19.089Z","updated_at":"2025-03-24T07:31:43.821Z","avatar_url":"https://github.com/Nestednet.png","language":"PHP","readme":"# gocardless-laravel\n[![Build Status](https://travis-ci.com/Nestednet/gocardless-laravel.svg?branch=master)](https://travis-ci.com/Nestednet/gocardless-laravel)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Nestednet/gocardless-laravel/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Nestednet/gocardless-laravel/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/nestednet/gocardless-laravel/v/stable)](https://packagist.org/packages/nestednet/gocardless-laravel)\n[![Latest Unstable Version](https://poser.pugx.org/nestednet/gocardless-laravel/v/unstable)](https://packagist.org/packages/nestednet/gocardless-laravel)\n[![License](https://poser.pugx.org/nestednet/gocardless-laravel/license)](https://packagist.org/packages/nestednet/gocardless-laravel)\n\n##### GoCardless Pro PHP Client package integration for Laravel.\n\nThis package tries to provide an easy, scalable and maintainable way to integrate Gocardless into your laravel project.\n\nIt provides a Facade that wraps the Gocardless PHP client and also an easy way to handle the webhooks that Gocardless sends. This is done following the steps that [Spatie](https://spatie.be/opensource/php) uses for their [Stripe Laravel Webhooks package](https://github.com/spatie/laravel-stripe-webhooks).\n\n##### Installation\n\nGet the package with composer:\n\n```bash\ncomposer require nestednet/gocardless-laravel\n```\n\n**1.** If you are using Laravel \u003e5.5 the package will be autodiscobered, for older versions add the service provider at your config/app.php file.\n\n**2.** Publish the configuration file\n```bash\n$ php artisan vendor:publish --provider=\"Nestednet\\Gocardless\\GocardlessServiceProvider\"\n```\nThis will publish both the configuration file and the migration file.\n\n**3.** Review the configuration file\n```\nconfig/gocardless.php\n```\nand add your Gocardless API token and environment to the `.env` file.\n\n**4.** After publishing the migration you can run the migration and create the `gocardless_webhooks_table`\n\n**5.** The package provides a Macro route (`gocardlessWebhooks`). You can create a route at your routes file of your app. This route will be the endpoint where Gocardless will send the webhooks, you should register this webhook endpoint at your Gocardless dashboard.\n\n```php\nRoute::gocardlessWebhooks('gocardless-webhook-endpoint');\n```\n\nThis will register a `POST` route to a the controller provided by this package. You should add the route to the `except` array of the `VerifyCsrfToken` middleware.\n\n```php\nprotected $except = [\n    'gocardless-webhook-endpoint',\n];\n```\n\n##### Usage\n\nOnce the package is properly installed you can use the `Gocardless` facade to access the methods of the Gocardless PHP client. The documentation of this methods can be found here: [Gocardless PHP cleint documentation](https://github.com/gocardless/gocardless-pro-php)\n\nIf you use Gocardless at your project you provably will use webhooks to handle the asynchronous payment states. This package provides an easy way to handle the webhooks.\n\nGocardless will send you webhooks with events. This events will contain the updates of your Gocardless resources.\n\nThis package will verify the signature of the requests and if it's valid. Unless something goes terribly wrong, and even if one of the events inside the webhook fails the controller will reposnd with a `200` to Gocardless. This prevents Gocardless from spamming retries to the endpoint.\n\nIf an event fails to be processed the exception will be saved to the database into the `gocardless_webhook_calls` table, you can find the failed events there.\n\nThis package provides two ways to handle the webhook requests:\n\n* Using jobs\n* Using events\n\n##### Using jobs\nYou can find a jobs array inside the `config\\gocardless.php`. \n\nYou can register any job that you want to the gocardless events. An event from Gocardless references one resource `resource_type` and one `action`. In order to register a job to an action you should add it with the key `{resource_type}_{action}`. \n```php\n'jobs' =\u003e [\n // '{resource_type}_{action} =\u003e path/to/job::class,\n    'payments_created' =\u003e App\\Jobs\\PaymentConfirmed::class,\n]\n```\n\nIn order to avoid timeouts it's highly recommended to use queued jobs.\n\n##### Using events\n\nEvery time an event is processed by the package it will trigger an event with this structure: \n\n`gocardless-webhooks::{resource_type}_{action}`\n\nThe payload of the event will be the `GocardlessWebhookCall` (or an extended model) instance created with the request. \n\nYou can register listeners to this events in the `EventServiceProvider`:\n\n```php\n/**\n * The event listener mappings for the application.\n *\n * @var array\n */\nprotected $listen = [\n    'gocardless-webhooks::payments_created' =\u003e [\n        App\\Listeners\\ListenerOfPaymentsCreated::class,\n    ],\n];\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestednet%2Fgocardless-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnestednet%2Fgocardless-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnestednet%2Fgocardless-laravel/lists"}