{"id":18716353,"url":"https://github.com/killbill/killbill-gocardless-plugin","last_synced_at":"2025-04-12T13:30:59.874Z","repository":{"id":49168662,"uuid":"335680147","full_name":"killbill/killbill-gocardless-plugin","owner":"killbill","description":"GoCardless Payment Plugin (tutorial)","archived":false,"fork":false,"pushed_at":"2023-05-15T14:09:32.000Z","size":55,"stargazers_count":2,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-05-01T09:46:24.697Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/killbill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-03T16:08:01.000Z","updated_at":"2024-01-13T19:26:53.000Z","dependencies_parsed_at":"2023-02-08T19:31:47.549Z","dependency_job_id":null,"html_url":"https://github.com/killbill/killbill-gocardless-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killbill%2Fkillbill-gocardless-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killbill%2Fkillbill-gocardless-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killbill%2Fkillbill-gocardless-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killbill%2Fkillbill-gocardless-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/killbill","download_url":"https://codeload.github.com/killbill/killbill-gocardless-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223518488,"owners_count":17158689,"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":[],"created_at":"2024-11-07T13:12:25.665Z","updated_at":"2024-11-07T13:12:26.413Z","avatar_url":"https://github.com/killbill.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# killbill-gocardless-plugin\n![Maven Central](https://img.shields.io/maven-central/v/org.kill-bill.billing.plugin.java/gocardless-plugin?color=blue\u0026label=Maven%20Central)\n\nKill Bill payment plugin that uses [Gocardless](https://gocardless.com/) as the payment gateway.\n\n## Kill Bill compatibility\n\n| Plugin version | Kill Bill version |\n|---------------:|------------------:|\n|          1.x.y |            0.24.z |\n\n\n## Build\n\n```\nmvn clean install -DskipTests\n```\n\n## Installation\n\n```\nkpm install_java_plugin gocardless --from-source-file target/gocardless-plugin-*-SNAPSHOT.jar --destination /var/tmp/bundles\n```\n\n## Setup\n\nA GoCardless access token is required in order to use GoCardless. You can [sign up](https://manage-sandbox.gocardless.com/signup) to create a sandbox account and obtain a token from [here](https://manage-sandbox.gocardless.com/developers/access-tokens/create).\n\n## Configuration\n\nConfigure the plugin with the Gocardless token/environment as follows:\n\n```\ncurl -v \\\n     -X POST \\\n     -u admin:password \\\n     -H 'X-Killbill-ApiKey: bob' \\\n     -H 'X-Killbill-ApiSecret: lazar' \\\n     -H 'X-Killbill-CreatedBy: admin' \\\n     -H 'Content-Type: text/plain' \\\n     -d 'org.killbill.billing.plugin.gocardless.gocardlesstoken=xxx\n\t org.killbill.billing.plugin.gocardless.environment=xxx' \\\n     http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-gocardless\n```\n\nwhere:\n\n* `gocardlesstoken`: GoCardless access token obtained above\n* `environment`: The Gocardless environment. Possible values are `SANDBOX`/`LIVE`. default value is `SANDBOX`\n\n## Testing\n\n1. Create a Kill Bill account for the customer (The following request uses the default Kill Bill API key and secret, change them if needed):\n\n```\ncurl -v \\\n     -X POST \\\n     -u admin:password \\\n     -H 'X-Killbill-ApiKey: bob' \\\n     -H 'X-Killbill-ApiSecret: lazar' \\\n     -H 'X-Killbill-CreatedBy: tutorial' \\\n     -H 'Content-Type: application/json' \\\n     -d '{ \"currency\": \"USD\" }' \\\n     'http://127.0.0.1:8080/1.0/kb/accounts'\n```\n\nThis returns the Kill Bill `accountId` in the `Location` header.\nFor example, in the following sample response, `17444cb7-bfa7-4f8c-a3c3-a98d31003566` is the account Id.\n\n```\n\u003c Access-Control-Allow-Credentials: true\n\u003c Location: http://127.0.0.1:8080/1.0/kb/accounts/17444cb7-bfa7-4f8c-a3c3-a98d31003566\n\u003c Content-Type: application/json\n```\n\n2. Use the plugin `/checkout` API to create a redirect flow:\n\n```\ncurl -v \\\n     -X POST \\\n     -u admin:password \\\n     -H \"X-Killbill-ApiKey: bob\" \\\n     -H \"X-Killbill-ApiSecret: lazar\" \\\n     -H 'X-Killbill-CreatedBy: tutorial' \\\n     -H \"Content-Type: application/json\" \\\n     'http://127.0.0.1:8080/plugins/killbill-gocardless/checkout?kbAccountId=\u003cACCOUNT_ID\u003e'\n```\n\nThis returns a response similar to the following:\n\n```\n{\n  \"formFields\": [],\n  \"formMethod\": \"GET\",\n  \"formUrl\": \"https://pay-sandbox.gocardless.com/billing/static/flow?id=BRF000103WH5G2459BAT7ET0Q0TMTG3Z\",\n  \"kbAccountId\": \"5b4fc584-8af9-4d52-80ed-b46361cf1dc3\",\n  \"properties\": []\n}\n```\n\nCopy the `formUrl` from the response and save it for further use.\n\n3. Redirect the user to the `formUrl` and have them fill the form with their bank account details to set up a mandate. For testing you can enter the `formUrl` in a browser and enter the following bank account details (See [setting up a mandate](https://developer.gocardless.com/direct-debit/setting-up-a-mandate)):\n  * Bank code: 026073150\n  * Account number: 2715500356\n  * Account type: checking\n  \nThis redirects the user to a success page with the `redirect_flow_id` in the URL. Copy this `redirect_flow_id` and save it for further use.\n\n4. Finally, complete the redirect flow using the `redirect_flow_id` obtained above:\n\n```\ncurl -v \\\n     -X POST \\\n     -u admin:password \\\n     -H 'X-Killbill-ApiKey: bob' \\\n     -H 'X-Killbill-ApiSecret: lazar' \\\n     -H 'X-Killbill-CreatedBy: tutorial' \\\n     -H 'Content-Type: application/json' \\\n     -d '{\n       \"pluginName\": \"killbill-gocardless\",\n       \"pluginInfo\": {\n         \"properties\": [\n           {\n             \"key\": \"redirect_flow_id\",\n             \"value\": \"\u003credirect_flow_id\u003e\"\n           },\n           {\n             \"key\": \"session_token\",\n             \"value\": \"killbill_token\"\n           }\n         ]\n       }\n     }' \\\n     'http://127.0.0.1:8080/1.0/kb/accounts/\u003cACCOUNT_ID\u003e/paymentMethods?isDefault=true'\n```\n\nThis adds the the mandate as a payment method in Kill Bill and returns the `paymentMethodId` in the Location header.\n\n5. You can then trigger payments against that payment method:\n\n```\ncurl -v \\\n     -X POST \\\n     -u admin:password \\\n     -H \"X-Killbill-ApiKey: bob\" \\\n     -H \"X-Killbill-ApiSecret: lazar\" \\\n     -H \"X-Killbill-CreatedBy: tutorial\" \\\n     -H \"Content-Type: application/json\" \\\n     --data-binary '{\"transactionType\":\"PURCHASE\",\"amount\":\"10\"}' \\\n    'http://127.0.0.1:8080/1.0/kb/accounts/\u003cACCOUNT_ID\u003e/payments'\n```\nThis returns the `paymentId` in the `Location` header.\n\n6. You can then obtain information about the payment as follows:\n\n```\ncurl -v \\\n     -u admin:password \\\n     -H \"X-Killbill-ApiKey: bob\" \\\n     -H \"X-Killbill-ApiSecret: lazar\" \\\n    'http://127.0.0.1:8080/1.0/kb/payments/\u003cPAYMENT_ID\u003e?withPluginInfo=true'\n```\n\n7. If you do not want the plugin to be called, you can specify `withPluginInfo=false` as follows:\n\n```\ncurl -v \\\n     -u admin:password \\\n     -H \"X-Killbill-ApiKey: bob\" \\\n     -H \"X-Killbill-ApiSecret: lazar\" \\\n    'http://127.0.0.1:8080/1.0/kb/payments/\u003cPAYMENT_ID\u003e?withPluginInfo=false'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillbill%2Fkillbill-gocardless-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkillbill%2Fkillbill-gocardless-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillbill%2Fkillbill-gocardless-plugin/lists"}