{"id":20664563,"url":"https://github.com/outr/scala-stripe","last_synced_at":"2025-09-13T15:35:04.534Z","repository":{"id":55947976,"uuid":"77475560","full_name":"outr/scala-stripe","owner":"outr","description":"Complete Browser and Server client integration of Stripe in Scala and Scala.js","archived":false,"fork":false,"pushed_at":"2021-08-30T14:35:37.000Z","size":185,"stargazers_count":13,"open_issues_count":3,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T19:01:12.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","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/outr.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-12-27T18:40:32.000Z","updated_at":"2024-12-26T21:29:29.000Z","dependencies_parsed_at":"2022-08-15T10:10:12.996Z","dependency_job_id":null,"html_url":"https://github.com/outr/scala-stripe","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/outr/scala-stripe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fscala-stripe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fscala-stripe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fscala-stripe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fscala-stripe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outr","download_url":"https://codeload.github.com/outr/scala-stripe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fscala-stripe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266253499,"owners_count":23900051,"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-16T19:25:03.326Z","updated_at":"2025-07-21T06:32:16.120Z","avatar_url":"https://github.com/outr.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scala-stripe\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f08431e50c8e4440ac307b1cdf9b288a)](https://www.codacy.com/app/matthicks/scala-stripe?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=outr/scala-stripe\u0026utm_campaign=badger)\n[![Build Status](https://travis-ci.org/outr/scala-stripe.svg?branch=master)](https://travis-ci.org/outr/scala-stripe)\n[![Stories in Ready](https://badge.waffle.io/outr/scala-stripe.png?label=ready\u0026title=Ready)](https://waffle.io/outr/scala-stripe)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/outr/scala-stripe)\n[![Maven Central](https://img.shields.io/maven-central/v/com.outr/scala-stripe_2.12.svg)](https://maven-badges.herokuapp.com/maven-central/com.outr/scala-stripe_2.12)\n[![Latest version](https://index.scala-lang.org/com.outr/scala-stripe/scala-stripe/latest.svg)](https://index.scala-lang.org/com.outr/scala-stripe/scala-stripe)\n\nProvides both client (Stripe.js using Scala.js) and server (NIO Scala) functionality for dealing with Stripe.\n\nFor more information on the Stripe API see https://stripe.com/docs/api\n\nFor more information on Stripe.js see https://stripe.com/docs/stripe.js\n\n## SBT Configuration ##\n\nscala-stripe is published to Sonatype OSS and Maven Central and supports JVM and Scala.js with 2.11 and 2.12:\n\n```\nlibraryDependencies += \"com.outr\" %% \"scala-stripe\" % \"1.1.11\"   // Scala\nlibraryDependencies += \"com.outr\" %%% \"scala-stripe\" % \"1.1.11\"  // Scala.js / Cross-Build\n```\n\n## Dependencies\n\nIt's important to know how much your biting off when you are adding another dependency to your project. As such, we've\nendeavored to keep the dependencies to a minimum:\n\n* Scribe for logging (https://github.com/outr/scribe)\n* Gigahorse for non-blocking IO (https://github.com/eed3si9n/gigahorse)\n* Circe for JSON pickling (https://github.com/circe/circe)\n\n## Getting Started\n\nThough the JVM supports creating credit card tokens, the ideal path is to avoid the server ever having any such knowledge.\nTo that end we will use Scala.js to first create the card token, and then the server (JVM) will use that token to make\na purchase.\n\n### In the Browser\n\n#### Setting up Stripe.js\n\nWe must first set our publishable key. Make sure you are using the public key (starts with \"pk_\"):\n\n```scala\nStripe.setPublishableKey(stripePublicKey)\n```\n\n#### Validating the credit card\n\n```scala\nval validationResult: Boolean = Stripe.card.validateCardNumber(creditCardNumber)\n```\n\n#### Creating a Stripe Token for the credit card\n\nThe following example is a basic use-case, and assumes you'll provide implementations of sending the token to the server\nas well as showing token failure messages as that information is specific to your implementation.\n\n```scala\nStripe.card.createToken(new StripeCardInfo {\n  number = creditCardNumber\n  exp_month = cardExpirationMonth\n  exp_year = cardExpirationYear\n}, (status: Int, info: CardTokenInfo) =\u003e {\n  if (status == 200) {\n    sendCardTokenInfoToServer(info.id, ...other useful information the server might need...)\n  } else {\n    showCardTokenFailure(info.error)\n  }\n})\n```\n\n### On the Server\n\n#### Creating a Stripe instance\n\nAs discussed in the Browser section, we have two keys: public (\"pk_\") and secret (\"sk_\"). For the server to work with\nStripe we should use our private key to create an instance of `Stripe`:\n\n```scala\nval stripe = new Stripe(stripePrivateKey)\n```\n\n#### Charging the Credit Card\n\nNow that we have received the card token on the server, we can use that to make a purchase with Stripe:\n\n```scala\nstripe.charges.create(Money(5.0), \"USD\", source = creditCardTokenId, customer = customerId).map {\n  case Left(failure) =\u003e // Handle error from Stripe server\n  case Right(charge) =\u003e // Success! Handle the Charge instance returned\n}\n```\n\n#### Next Steps\n\nHopefully that is enough to get you started with stripe-scala. There is much more available and we attempt to be a very\nclose wrapper around the Stripe API. If you have any problems refer to the Stripe API documentation as we try to remain\nvery close to them.\n\n## Features for 2.0.0 (In-Progress)\n\n* [ ] Stripe API Relay\n    * [ ] Orders\n    * [ ] Order Items\n    * [ ] Returns\n    * [ ] Products\n    * [ ] SKUs\n* [ ] Stripe API Radar\n    * [ ] Reviews\n* [ ] Stripe API Core Resources\n    * [ ] File Uploads\n* [ ] Stripe API Payments\n    * [ ] Alipay Accounts\n    * [ ] Sources\n* [ ] Stripe.js\n    * [ ] Apple Pay\n\n## Features for 1.1.0 (Released 2017.08.08)\n\n* [X] Migration to youi-client away from Gigahorse\n* [X] Better error handling support\n\n## Features for 1.0.0 (Released 2016.01.05)\n\n* [X] Stripe.js functionality in Scala.js (Excludes Apple Pay)\n    * [X] Card\n    * [X] Bank Account\n    * [X] Personally Identifiable Information (PII)\n* [X] Stripe API Core Resources\n    * [X] Balance\n    * [X] Charges\n    * [X] Customers\n    * [X] Disputes\n    * [X] Events\n    * [X] Refunds\n    * [X] Tokens\n    * [X] Transfers\n    * [X] Transfer Reversals\n* [X] Stripe API Connect\n    * [X] Account\n    * [X] Application Fees\n    * [X] Application Fee Refunds\n    * [X] Country Specs\n    * [X] External Accounts\n* [X] Stripe API Payments\n    * [X] Bank Accounts\n    * [X] Cards\n* [X] Stripe API Subscriptions\n    * [X] Coupons\n    * [X] Discounts\n    * [X] Invoices\n    * [X] Invoice Items\n    * [X] Plans\n    * [X] Subscriptions","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutr%2Fscala-stripe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutr%2Fscala-stripe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutr%2Fscala-stripe/lists"}