All Projects → confact → Stripe.cr

confact / Stripe.cr

Licence: mit
Stripe API Wrapper for crystal

Programming Languages

crystal
512 projects

Labels

Projects that are alternatives of or similar to Stripe.cr

Checkout One Time Payments
Use Checkout to quickly collect one-time payments.
Stars: ✭ 417 (+1290%)
Mutual labels:  stripe
Stripe Rails
A Rails Engine for integrating with Stripe
Stars: ✭ 627 (+1990%)
Mutual labels:  stripe
Kirby Pay
Make online payments with Kirby
Stars: ✭ 27 (-10%)
Mutual labels:  stripe
Next Stripe
Simplified server-side Stripe workflows in Next.js
Stars: ✭ 480 (+1500%)
Mutual labels:  stripe
Django Payments
Universal payment handling for Django.
Stars: ✭ 575 (+1816.67%)
Mutual labels:  stripe
Vue Stripe
Stripe Checkout & Elements for Vue.js
Stars: ✭ 669 (+2130%)
Mutual labels:  stripe
Gringotts
A complete payment library for Elixir and Phoenix Framework
Stars: ✭ 396 (+1220%)
Mutual labels:  stripe
Elements Examples
Stripe Elements examples.
Stars: ✭ 874 (+2813.33%)
Mutual labels:  stripe
Stripity stripe
An Elixir Library for Stripe
Stars: ✭ 597 (+1890%)
Mutual labels:  stripe
Stripe Rs
Moved to https://github.com/wyyerd/stripe-rs.
Stars: ✭ 16 (-46.67%)
Mutual labels:  stripe
Vue Stripe Elements
A Vue 2 component collection for StripeElements
Stars: ✭ 498 (+1560%)
Mutual labels:  stripe
Stripe Java
Java library for the Stripe API.
Stars: ✭ 530 (+1666.67%)
Mutual labels:  stripe
Build A Saas App With Flask
Learn how to build a production ready web app with Flask and Docker.
Stars: ✭ 694 (+2213.33%)
Mutual labels:  stripe
Stripe Connect Rocketrides
Sample on-demand platform built on Stripe: Connect onboarding for pilots, iOS app for passengers to request rides.
Stars: ✭ 426 (+1320%)
Mutual labels:  stripe
Servicebot
Open-source subscription management & billing automation system
Stars: ✭ 857 (+2756.67%)
Mutual labels:  stripe
Flasksaas
A great starting point to build your SaaS in Flask & Python, with Stripe subscription billing 🚀
Stars: ✭ 412 (+1273.33%)
Mutual labels:  stripe
Pinax Stripe
a payments Django app for Stripe
Stars: ✭ 650 (+2066.67%)
Mutual labels:  stripe
Billing
A general purpose interface to Stripe that's optimized for Laravel 5 SaaS applications.
Stars: ✭ 14 (-53.33%)
Mutual labels:  stripe
Vue Stripe Payment
Vue wrapper for jquery.payment by stripe
Stars: ✭ 11 (-63.33%)
Mutual labels:  stripe
Pay
Payments for Ruby on Rails apps
Stars: ✭ 759 (+2430%)
Mutual labels:  stripe

Stripe

Shard CI API Documentation Website GitHub release

Stripe API wrapper for Crystal.

This version (>1.0) is changed to follow Ruby's method and class structure. We will follow Stripe::Class.method but follow crystal parameters to take care of the types automatically.

Notice

This api wrapper was tested on api version 2020-03-02 but have been trying to make it flexible with String? and correspondent in the types.

Installation

Add this to your application's shard.yml:

dependencies:
  stripe:
    github: confact/stripe.cr

Usage

require "stripe"

Stripe.api_key = "YOUR_API_TOKEN"

token = Stripe::Token.create(card: {
  number: "4242424242424242",
  exp_month: 12,
  exp_year: 2019,
  cvc: 123,
})

customer = Stripe::Customer.create(source: token)
charge = Stripe::Charge.create(amount: 1000, currency: "usd", customer: customer)

custom API version

You can set custom api version if needed. Version need to be set before first api call is called. otherwise it won't be used.

require "stripe"

Stripe.api_key = "YOUR_API_TOKEN"
Stripe.version = "2019-03-29"

Example of setting up a subscription

Here is a simple way to setup a subscription by using payment_method.

Follow the instruction for setting up an subscription at stripe: https://stripe.com/docs/billing/subscriptions/set-up-subscription

When the step is at server code, check the code below that is corresponding towards the ruby code for same step.

Setting up an customer:

  token = params['StripeToken'] # or what the param for the token is called for you.
  customer = Stripe::Customer.create(email: email,
                         description: name, # just example
                         payment_method: token, # or token.payment_method.id
                         # depends what you do in the frontend to handle the token.
                         invoice_settings: { default_payment_method: token })

create a subscription with that customer:

Stripe::Subscription.create(customer: customer,
plan: STRIPE_PLAN_ID,
expand: ["latest_invoice.payment_intent"]) # yes - create_subscription support expand.

The rest is frontend to check SCA and more. You should not need to do more than this on the backend.

But follow https://stripe.com/docs/billing/subscriptions/set-up-subscription for the frontend part to make sure it works for SCA and other things.

Progress

API methods

Core

Balance
  • [x] Retrieve balance

  • [ ] Retrieve a balance transaction

  • [ ] List all balance history

Charges
  • [x] Create a charge

  • [x] Retrieve a charge

  • [ ] Update a charge

  • [ ] Capture a charge

  • [ ] List all charges

Sources
  • [x] Create a source

  • [x] Retrieve a source

  • [x] Attach a source to customer

  • [x] Detach a source from customer

  • [ ] Update a source

Subscriptions
  • [x] Create a Subscription

  • [x] Retrieve a Subscription

  • [x] Update a Subscription

  • [x] Delete a Subscription

  • [x] List all Subscriptions

Setup Intent
  • [x] Create a Setup Intent

  • [x] Retrieve a Setup Intent

  • [x] Confirm a Setup Intent

  • [ ] Update a Setup Intent

  • [ ] Cancel a Setup Intent

  • [ ] Delete a Setup Intent

  • [x] List all Setup Intents

Payment Intent
  • [x] Create a Payment Intent

  • [x] Retrieve a Payment Intent

  • [x] Confirm a Payment Intent

  • [ ] Update a Payment Intent

  • [ ] Cancel a Payment Intent

  • [ ] Delete a Payment Intent

  • [x] List all Payment Intents

Customers
  • [x] Create a customer

  • [x] Retrieve a customer

  • [x] Update a customer

  • [x] Delete a customer

  • [x] List all customers

Customer Tax IDs
  • [x] Create a customer tax ID

  • [x] Retrieve a customer tax ID

  • [x] Delete a customer tax ID

Refund
  • [x] Create a refund

  • [x] Retrieve a refund

  • [ ] Update a refund

  • [ ] List all refunds

Tax Rate
  • [x] Create a tax rate

  • [x] retrieve a tax rate

  • [ ] Update a tax rate

  • [ ] List all tax rates

Tokens
  • [x] Create a card token

  • [ ] Create a bank account token

  • [ ] Create a PII token

  • [ ] Create an account token

  • [ ] Retrieve a token

Invoices
  • [x] Create a invoice

  • [x] Retrieve a invoice

  • [x] Update a invoice

  • [ ] Delete a invoice

  • [x] List all invoices

Objects

Core

  • [x] Balance

  • [ ] Balance transaction

  • [x] Charge

  • [x] Plan

  • [x] Product

  • [x] Customer

  • [x] Customer Tax ID

  • [x] Subscription

  • [x] Invoice

  • [ ] Dispute

  • [ ] Dispute evidence

  • [ ] Event

  • [ ] File

  • [ ] File link

  • [ ] Payout

  • [x] Refund

  • [x] Tax Rate

  • [x] Token

  • [x] Payment Intent

  • [x] Setup Intent

Payment methods

  • [x] Payment Method

  • [x] Bank account

  • [x] Card

  • [x] Source

  • [x] Attach a payment method to a customer

Connect

  • [ ] Account

  • [ ] Login link

  • [ ] Application fee refund

  • [ ] Application fee

  • [ ] Country spec

  • [ ] Top-up

  • [ ] Transfer

  • [ ] Transfer reversal

Prices
  • [ ] Create a price

  • [ ] Retrieve a price

  • [ ] Update a price

  • [ ] List all prices

Discounts
  • [ ] Create a discount

  • [ ] Retrieve a discount

  • [ ] Update a discount

  • [ ] List all discounts

Promotion codes
  • [ ] Create a promotion code

  • [ ] Retrieve a promotion code

  • [ ] Update a promotion codes

  • [ ] List all promotion codes

Coupons
  • [ ] Create a coupon

  • [ ] Retrieve a coupon

  • [ ] Update a coupon

  • [ ] List all coupons

Development

TODO: Write development instructions here

Contributing

  1. Fork it (https://github.com/confact/stripe.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].