{"id":20672114,"url":"https://github.com/workarea-commerce/workarea-paypal","last_synced_at":"2025-04-19T18:50:50.439Z","repository":{"id":56898454,"uuid":"203652740","full_name":"workarea-commerce/workarea-paypal","owner":"workarea-commerce","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-16T17:57:02.000Z","size":209,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-15T12:26:50.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workarea-commerce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-21T19:39:24.000Z","updated_at":"2020-08-18T12:29:53.000Z","dependencies_parsed_at":"2022-08-20T17:40:28.075Z","dependency_job_id":null,"html_url":"https://github.com/workarea-commerce/workarea-paypal","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-paypal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-paypal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-paypal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-paypal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workarea-commerce","download_url":"https://codeload.github.com/workarea-commerce/workarea-paypal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249769612,"owners_count":21323067,"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-16T20:32:05.185Z","updated_at":"2025-04-19T18:50:50.402Z","avatar_url":"https://github.com/workarea-commerce.png","language":"Ruby","funding_links":["https://www.paypal.com/us/webapps/mpp/commerce-platform","https://developer.paypal.com/docs/commerce-platform/payment/checkout/","https://developer.paypal.com/docs/checkout/reference/customize-sdk/","https://developer.paypal.com/docs/integration/direct/webhooks/rest-webhooks/","https://developer.paypal.com/docs/limited-release/custom-card-fields/","https://developer.paypal.com/docs/checkout/integration-features/customize-button/","https://developer.paypal.com/docs/limited-release/custom-card-fields/reference","https://www.sandbox.paypal.com/bizsignup/partner/entry?channelId=partner\u0026channel=marketplace\u0026product=ppcp\u0026partnerId=M3XMHZJKTFK88\u0026integrationType=FO","https://developer.paypal.com/docs/commerce-platform/"],"categories":[],"sub_categories":[],"readme":"Workarea PayPal\n================================================================================\n\nA Workarea Commerce plugin that adds support for PayPal payments. This plugin adds a new tender type in checkout, which allows users to pay for their items with PayPal.\n\nAs of v3.0, this plugin utilizes the [PayPal Commerce Platform](https://www.paypal.com/us/webapps/mpp/commerce-platform). By default this integrates PayPal's [Smart Payment Buttons](https://developer.paypal.com/docs/commerce-platform/payment/checkout/) into your Workarea Application to allow customers to use any payment method supported in their area to complete checkout on your storefront.\n\nUpgrading to v3.0.0\n--------------------------------------------------------------------------------\n\nSee the [upgrade guide](UPGRADE.md) for information on upgrading from v2.x of this plugin.\n\nGetting Started\n--------------------------------------------------------------------------------\n\nAdd the gem to your application's Gemfile:\n\n```ruby\n# ...\ngem 'workarea-paypal'\n# ...\n```\n\nUpdate your application's bundle.\n\n```bash\ncd path/to/application\nbundle\n```\n\nThen, add your client ID and secret to Workarea. See \"Account Setup\" below for more details.\n\nFor production environments, we recommend you run the webhooks rake task to register critical callbacks from PayPal to help keep the state of your orders on Workarea inline with the state of the PayPal transaction. See the `default_webhook_events` description under \"Configuration Options\" for more information.\n\n```bash\nbin/rails workarea:paypal:create_webhooks\n```\n\nAccount Setup\n--------------------------------------------------------------------------------\n\nTo begin using PayPal on your site, you will need to have a PayPal merchant account. For development, you can create an account on [developer.paypal.com](htttps://developer.paypal.com). From there you can create a sandbox REST API app, and use those credentials for any non-live environments.\n\nOnce you have a REST API application in your PayPal sandbox, you must add the client ID and secret to your Workarea application. This can be done through admin configuration, environment variables, Rails credentials, or hard-coded Workarea configuration.\n\n### Admin configuration\n\nThe PayPal plugin adds admin configuration fields to allow admin user's to set credentials without the need for developer intervention. Log in as an admin user, navigate to the Configuration page, find the PayPal section and add the client ID and secret.\n\n### Environment Variables\n\nIf the storing and setting of credentials needs to be more dynamic, you can utilize environment variables. Set the environment variables below to connect to PayPal.\n\n`WORKAREA_PAYPAL_CLIENT_ID`   \n`WORKAREA_PAYPAL_CLIENT_SECRET`\n\n### Rails Credentials\n\nThis option can be used for any environment, but is most useful in development to store the sandbox credentials within the codebase securely, allowing anyone with the `master.key` of your application to have PayPal configured when they load their application in development.\n\nTo add your PayPal info to your Rails credentials, open your credentials file for editing:\n\n```bash\nEDITOR=vi bin/rails credentials:edit\n```\n\nThen, add a PayPal section:\n\n```yaml\npaypal:\n  client_id: YOUR_CLIENT_ID\n  client_secret: YOUR_CLIENT_SECRET\n```\n\n### Hard-coded configuration\n\nThis option is not ideal, as it will prevent admin configuration from ever being used, but can be necessary if you need to automate the switching of PayPal accounts in a multi-site environment. It is **strongly** recommended that you store the credentials elsewhere and load them into your configuration dynamically if you need to use this option.\n\nIn your `config/initializers/workarea.rb`, add:\n\n```ruby\nWorkarea.configure do |config|\n  config.paypal_client_id = 'YOUR_CLIENT_ID'\n  config.paypal_client_secret = 'YOUR_CLIENT_SECRET'\nend\n```\n\nConfiguration Options\n--------------------------------------------------------------------------------\n\n`config.paypal_environment`\n\nThe [PayPal Checkout SDK](https://github.com/paypal/Checkout-Ruby-SDK) gem uses different environment classes depending on whether you are interacting with sandbox or live environments. This config by default will point to the sandbox environment unless you are in production. If you need to customize which environment you wish to connect to you'll have to modify the value of this config. Accepted values are `'Paypal::LiveEnvironment'` or\n`'PayPal::SandboxEnvironment'`.\n\n`config.paypal_sdk_params`\n\nThis config holds a hash of values to be passed as query string arguments to the PayPal when fetching the javascript SDK. See the [PayPal documentation](https://developer.paypal.com/docs/checkout/reference/customize-sdk/) for options. By default, the plugin will pass the client_id, and `'commit' =\u003e false`. It will add `'debug' =\u003e true` if you are in development for easier troubleshooting.\n\n`config.default_webhook_events`\n\nPayPal offers a number of [webhook integration options](https://developer.paypal.com/docs/integration/direct/webhooks/rest-webhooks/) that will make calls to your application when something happens within PayPal. You can [create webhooks manually](https://developer.paypal.com/docs/integration/direct/webhooks/rest-webhooks/#to-use-the-dashboard-to-subscribe-to-events) within the PayPal dashboard, but Workarea provides a more automated way to subscribe to events through the `workarea:paypal:create_webhooks` rake task. When run, this rake task will clear any existing webhooks and create a webhook for each event in `config.default_webhook_events`. By default, `PAYMENT.CAPTURE.COMPLETED` and `PAYMENT.CAPTURE.DENIED` are the only events supported by the plugin. If you wish to add more supported events you will also have to provide logic within [`Workarea::Paypal::HandleWebhookEvent`](https://github.com/workarea-commerce/workarea-paypal/blob/master/app/workers/workarea/paypal/handle_webhook_event.rb) to update your application appropriately.\n\n\n`config.use_paypal_hosted_fields`\n\nThis configuration toggles on [PayPal Custom Card Fields](https://developer.paypal.com/docs/limited-release/custom-card-fields/) which allows you to use PayPal as your primary credit card payment processor. See \"Hosted Fields\" below for more information.\n\n### Javascript Configuration\n\nBoth Smart Payment Buttons and Hosted Fields provide configuration within the javascript `WORKAREA.config` object to customize options passed when initializing those behaviors.\n\n`WORKAREA.config.paypalButtons`\n\nCustomize the Smart Payment Buttons options. See the [PayPal documentation](https://developer.paypal.com/docs/checkout/integration-features/customize-button/) for options.\n\n`WORKAREA.config.paypalHostedFields`\n\nCustomize the Hosted Fields options. See the [PayPal documentation](https://developer.paypal.com/docs/limited-release/custom-card-fields/reference) for options.\n\nHosted Fields\n--------------------------------------------------------------------------------\n\nThe PayPal Commerce Platform allows you to add unbranded, custom credit card fields to your checkout to accept payments directly on your site. When enabled via `config.use_paypal_hosted_fields`, the Workarea plugin integrates this directly into the existing checkout payment step by replacing the default credit card fields with fields rendered by PayPal. This enables you to accept credit card payments with no other payment processor except PayPal.\n\nThis does require providing additional information to PayPal through a Workarea-specific partner signup. For sandbox accounts, You can [complete this process](https://www.sandbox.paypal.com/bizsignup/partner/entry?channelId=partner\u0026channel=marketplace\u0026product=ppcp\u0026partnerId=M3XMHZJKTFK88\u0026integrationType=FO) without additional communication using your **sandbox business account login** (found in the PayPal developer dashboard under Sandbox \u003e Accounts). For live environments, contact [Workarea](https://www.workarea.com/pages/contact-us) or reach out to PayPal for more information how you can enable this behavior for your site.\n\nAdditional Information\n--------------------------------------------------------------------------------\n\nSee the [PayPal Documentation](https://developer.paypal.com/docs/commerce-platform/) for more information on the PayPal Commerce Platform.\n\n### International Addresses\n\nWhen working with international addresses, the data from PayPal regarding country and region codes is not guaranteed to match the identifiers used in Workarea (derived from our usage of the [countries](https://github.com/hexorx/countries) gem), because the 2-digit codes identifying countries and regions are not the same. Therefore, you may have some issues when accepting international payments through PayPal, and thus some changes will need to be applied to ensure a seamless checkout process for international PayPal users.\n\n\nWorkarea Commerce Documentation\n--------------------------------------------------------------------------------\n\nSee [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation.\n\nLicense\n--------------------------------------------------------------------------------\n\nWorkarea Paypal is released under the [Business Software License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-paypal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkarea-commerce%2Fworkarea-paypal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-paypal/lists"}