{"id":23146660,"url":"https://github.com/zeekinteractive/pay-invoices-with-amazon","last_synced_at":"2025-04-04T13:24:05.416Z","repository":{"id":219975478,"uuid":"746786394","full_name":"ZeekInteractive/pay-invoices-with-amazon","owner":"ZeekInteractive","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-11T20:18:51.000Z","size":1203,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T20:54:16.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/ZeekInteractive.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-22T17:11:08.000Z","updated_at":"2024-01-30T16:58:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"54c4e41d-479b-4682-b165-97c6e8f627ab","html_url":"https://github.com/ZeekInteractive/pay-invoices-with-amazon","commit_stats":null,"previous_names":["zeekinteractive/pay-invoices-with-amazon"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeekInteractive%2Fpay-invoices-with-amazon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeekInteractive%2Fpay-invoices-with-amazon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeekInteractive%2Fpay-invoices-with-amazon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeekInteractive%2Fpay-invoices-with-amazon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZeekInteractive","download_url":"https://codeload.github.com/ZeekInteractive/pay-invoices-with-amazon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247183151,"owners_count":20897527,"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-12-17T16:34:12.102Z","updated_at":"2025-04-04T13:24:05.394Z","avatar_url":"https://github.com/ZeekInteractive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use\n\nPlugin description and use can be found in [readme.txt](readme.txt).\n\nA thorough description of how to install and use the plugin can be found [here](https://zeekinteractive.github.io/pay-invoices-with-amazon-internal/).\n\nPackaged releases can be found on [releases](https://github.com/ZeekInteractive/pay-invoices-with-amazon/releases).\n\nThe latest release can be installed from WP CLI with:\n\n```bash\nwp plugin install https://github.com/ZeekInteractive/pay-invoices-with-amazon/releases/latest/download/piwa.zip --activate --force\n```\n\n## Use as a Function\n\n`piwa()` can be called with an array of arguments in [plugins](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/), [mu-plugins](https://wordpress.org/documentation/article/must-use-plugins/), [templates](https://developer.wordpress.org/themes/basics/template-hierarchy/), or a theme's [functions.php](https://developer.wordpress.org/themes/basics/theme-functions/).\n\nThe below example adds payment buttons of various types at the end of Post content if various Categories are assigned.\n\nThe existance of `Plugin Name:` makes it possible to place it in `wp-content/plugins/` or a folder within `wp-content/plugins` to activate or deactivate within `WP Admin \u003e Plugins`. If placing within a theme's `functions.php` or another file that already opens with `\u003c?php`, the first line `\u003c?php` should be removed to avoid errors.\n\n```php\n\u003c?php\n/**\n * Plugin Name: Pay Based on Category\n * Description: Display a message with payment buttons on Posts depending on assigned Category. If all the categories are assigned, all the buttons and messages will be added.\n * Version: 1.0\n *\n * @see https://developer.wordpress.org/reference/hooks/the_content/\n * @see https://developer.wordpress.org/reference/functions/is_singular/\n * @see https://developer.wordpress.org/reference/functions/has_category/\n * @see https://www.php.net/manual/en/function.function-exists.php\n */\nadd_filter(\n\t'the_content',\n\tfunction( $content ) {\n\t\t// If the PIWA plugin is not active or this is not a singular template of the \"post\" post type, do not modify the content.\n\t\tif (\n\t\t\t! function_exists( 'piwa' )\n\t\t\t|| ! is_singular( [ 'post' ] )\n\t\t) {\n\t\t\treturn $content;\n\t\t}\n\n\t\t// If the post is in category Uncategorized, append a pay button where the user specifies the amount.\n\t\tif ( has_category( 'Uncategorized' ) ) {\n\t\t\t$content .= '\u003cp\u003eThanks for reading!\u003cbr/\u003eIf you feel inclined to contribute, please use the form below.\u003c/p\u003e' . piwa();\n\t\t}\n\t\t// If the post is in category Pay it Forward, append a pay button for $7.00 labeled \"Pay it Forward\".\n\t\tif ( has_category( 'Pay it Forward' ) ) {\n\t\t\t$content .= '\u003cp\u003eThanks for reading!\u003cbr/\u003eIf you enjoyed this post, please pay it forward with a small donation:\u003c/p\u003e' . piwa([\n\t\t\t\t'amount' =\u003e 7.00,\n\t\t\t\t'title'  =\u003e 'Pay it Forward',\n\t\t\t]);\n\t\t}\n\t\t// If the post is in category Invoice, append a pay button where the customer inputs an Invoice Number and amount.\n\t\tif ( has_category( 'Invoice' ) ) {\n\t\t\t$content .= '\u003cp\u003eThank you for your business!\u003cbr/\u003eTo make a payment, please input an amount and the associated invoice number:\u003c/p\u003e' . piwa([\n\t\t\t\t'show_customer_invoice_input' =\u003e true,\n\t\t\t]);\n\t\t}\n\n\t\treturn $content;\n\t},\n\t10 // Default priority is 10. The latest possible priority is PHP_INT_MAX. Attaching to a priority lower than 10 may cause other filters, such as wpautop, to add paragraph tags incorrectly.\n);\n```\n\n# Development\n\n### Download \u0026 install dependencies\n\n```bash\ngit clone git@github.com:ZeekInteractive/piwa.git\ncd piwa\n./bin/install\n```\n\n### Payment Details (Debug Information)\n\nDetailed information on checkout session status and technical responses from the API can be viewed by adding `\u0026details` to the end of the Payment Listing admin screen URL.\n\nFor example: `/wp-admin/edit.php?post_type=amazon-payment\u0026details`\n\n## Commands in [bin](bin):\n\n### [Install](bin/install)\n\nUpdates and installs the Amazon SDK using composer for PHP minimum `5.6.20`.\n\n```bash\n./bin/install\n```\n\n### [phpcs](bin/phpcs)\n\n- Installs and configures [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki) and `PHP Code Beautifier` with [WordPress-Extra](https://github.com/WordPress/WordPress-Coding-Standards/blob/develop/WordPress-Extra/ruleset.xml) and [ruleset.xml](ruleset.xml).\n- Runs `phpcbf` to fix minor errors before generating reports.\n- Runs `phpcs` with code context, specific rule names, highlighted lines, and icons indicating line, errors, warnings, rule names, and file names.\n- Runs `phpcs` summary count by rule type.\n- Outputs or runs commands which, if executed, will add `// phpcs:ignore Rule.Name` comments to lines which still have warnings.\n\nReport:\n```bash\n./bin/phpcs\n```\n\nPatch:\n- Adds comments to ignore all remaining warnings \u0026 re-runs the report.\n```bash\n./bin/phpcs --add-all-ignores \u0026\u0026 ./bin/phpcs\n```\n\nReport, including all warnings even if annotated with a comment to ignore:\n```bash\n./bin/phpcs --ignore-annotations\n```\n\n### [Tag](bin/tag)\n\nTags the current commit on `main` with a release number and comment and pushes to origin.\nDeletes the old tag of the same name locally and on origin if it existed.\n\n```bash\nversion=1.0.example\ntitle='Title of the release'\n./bin/tag \"$version\" \"$title\"\n```\n\n### [Package](bin/package)\n\nBuilds a .zip for installation or release with `vendor` included and development file patterns listed in [bin/package-exclude.txt](bin/package-exclude.txt) excluded. Outputs the zip to `piwa.zip`. Deletes an the old zip of that name if it existed. Runs `./bin/install`.\n\n```bash\n./bin/package\n```\n\n### [Release](bin/release)\n\nEdits a release on GitHub so the title is the tag title, the description is a link to the changelog, and uploads the zipped package. \"1.0\" is the tag to release. The .zip in the current directory will be uploaded.\n\n```bash\nversion=1.0.example\n./bin/release $version\n```\n\n### Tag \u0026 Package \u0026 Release\n\n```bash\nversion=1.0.example\ntitle='Title of the release'\n./bin/tag $version \"$title\" \u0026\u0026 ./bin/package \u0026\u0026 ./bin/release $version\n```\n\n## Localization\n\n### Generate a new master [piwa.pot](languages/piwa.pot)\n\nFrom the plugin root directory:\n\n```bash\nwp i18n make-pot . --no-location\n```\n\nThis will overwrite the `.pot`. New strings can also be added by editing manually. All translatable strings are stored in [src/i18n.php](src/i18n.php).\n\n### Compile `.mo` files when `.po` files have been edited.\n\nRequires `brew install msgfmt` or similar.\n\nFrom [languages/](languages):\n```bash\nfor file in `find . -name \"*.po\"` ; do msgfmt -o ${file/.po/.mo} $file ; done\n```\n\nAlso see [developer.wordpress.org:localization](https://developer.wordpress.org/plugins/internationalization/localization/).\n\n\n### Plugin Settings\n\nSettings can be reset with:\n\n```bash\nwp option delete piwa\n```\n\nSettings can be hard-coded with the follow script, preferably placed in `wp-content/mu-plugins/`:\n\n```php\n\u003c?php\n/**\n * Where to find keys \u0026 IDs:\n * @see https://pay.amazon.com/help/202022560\n */\nforeach(\n\t[\n\t\t'sandbox_mode'       =\u003e 1,\n\t\t'merchant_id'        =\u003e '',\n\t\t'client_id_store_id' =\u003e '',\n\t\t'public_key_id'      =\u003e '',\n\t] as $key =\u003e $value\n) {\n\tputenv( sprintf( 'piwa_%s=%s', $key, $value ) );\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeekinteractive%2Fpay-invoices-with-amazon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeekinteractive%2Fpay-invoices-with-amazon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeekinteractive%2Fpay-invoices-with-amazon/lists"}