All Projects → simontreanor → FunStripe

simontreanor / FunStripe

Licence: other
An F# library to connect to the Stripe API, including code generators to update the model and requests.

Programming Languages

F#
602 projects

Projects that are alternatives of or similar to FunStripe

Stripy
Micro wrapper for Stripe's REST API.
Stars: ✭ 49 (+40%)
Mutual labels:  stripe-api
Taxi Booking App
This is a complete ride booking app, It uses google maps cordova plugin, firebase database and onesignal as notification provider.
Stars: ✭ 212 (+505.71%)
Mutual labels:  stripe-api
codespawn
Code generator written in Rust
Stars: ✭ 34 (-2.86%)
Mutual labels:  code-generation
Stripe Elixir
Stripe API client for Elixir
Stars: ✭ 66 (+88.57%)
Mutual labels:  stripe-api
React Native Stripe Api
🤑 A small React Native library for Stripe Rest API
Stars: ✭ 190 (+442.86%)
Mutual labels:  stripe-api
spring-boot-react-ecommerce-app
eCommerce application based on the microservices architecture built using Spring Boot and ReactJS.
Stars: ✭ 221 (+531.43%)
Mutual labels:  stripe-api
Stripe Rs
Moved to https://github.com/wyyerd/stripe-rs.
Stars: ✭ 16 (-54.29%)
Mutual labels:  stripe-api
scalagen
WIP - Scalameta powered code generation
Stars: ✭ 38 (+8.57%)
Mutual labels:  code-generation
React Express Stripe
💰 Minimal Boilerplate for Stripe used in React and Express. Charge payments from your customers with this project.
Stars: ✭ 209 (+497.14%)
Mutual labels:  stripe-api
pony-capnp
Cap’n Proto plugin for generating serializable Pony classes. 🐴 - 🎩'n 🅿️
Stars: ✭ 19 (-45.71%)
Mutual labels:  code-generation
Terraform Provider Stripe
A Terraform Provider for Stripe
Stars: ✭ 143 (+308.57%)
Mutual labels:  stripe-api
Stripe
Stripe library for Vapor
Stars: ✭ 151 (+331.43%)
Mutual labels:  stripe-api
opensbli
A framework for the automated derivation and parallel execution of finite difference solvers on a range of computer architectures.
Stars: ✭ 56 (+60%)
Mutual labels:  code-generation
Stripe Kit
Stars: ✭ 50 (+42.86%)
Mutual labels:  stripe-api
go-zero
A cloud-native Go microservices framework with cli tool for productivity.
Stars: ✭ 23,294 (+66454.29%)
Mutual labels:  code-generation
Stripe Demo Connect Roastery Saas Platform
Roastery demo SaaS platform using Stripe Connect
Stars: ✭ 33 (-5.71%)
Mutual labels:  stripe-api
go-recipes
🦩 Tools for Go projects
Stars: ✭ 2,490 (+7014.29%)
Mutual labels:  code-generation
evon
Fast and versatile event dispatcher code generator for Golang
Stars: ✭ 15 (-57.14%)
Mutual labels:  code-generation
gg
General Golang Code Generator
Stars: ✭ 88 (+151.43%)
Mutual labels:  code-generation
sisyphus-js
Sisyphus customized protobuf and gRPC runtime and code generator for JavaScript/TypeScript
Stars: ✭ 19 (-45.71%)
Mutual labels:  code-generation

FunStripe

An F# library to connect to the Stripe API, including code generators to update the model and requests. Targets .NET Framework 4.7.2, .NET Standard 2.1 and .NET 6.

Latest updates

2022-11-22: version 0.9.2 updates the Stripe API from version 2022-08-01 to 2022-11-15, which contains some breaking changes. See the Stripe API changelog for details. As .NET 5 is out-of-support, this has been removed from the target frameworks.

2022-10-04: version 0.9.0 updates the Stripe API from version 2020-08-27 to 2022-08-01, which contains some breaking changes. See the Stripe API changelog for details.

2022-04-22: a lightweight version of this library without the code generators is now available as FunStripeLite.

2021-07-18: version 0.8.0 updates the Stripe API from version 2020-03-02 to 2020-08-27, which contains some breaking changes. See the Stripe API changelog for details.

Installation

Get the latest version from Nuget

Usage

Open the StripeModel and StripeRequest modules.

Here's an example of how to create a new payment method:

let settings = RestApi.StripeApiSettings.New(apiKey = Config.StripeTestApiKey)

let defaultCard =
    PaymentMethods.CreateCardCardDetailsParams.New(
        cvc = "314",
        expMonth = 10,
        expYear = 2021,
        number = "4242424242424242"
    )

let getNewPaymentMethod () =
    asyncResult {
        return! 
            PaymentMethods.CreateOptions.New(
                card = Choice1Of2 defaultCard,
                type' = PaymentMethods.CreateType.Card
            )
            |> PaymentMethods.Create settings
    }

The result value is an AsyncResult<PaymentMethod,ErrorResponse>, giving you the requested object in case of success or a detailed error response if not.

The general format of API requests is <module>.<method> settings options.

To instantiate the settings you need to pass in your Stripe API key. Having local rather than global settings allows you to use different keys for different Stripe accounts if you need to.

If you don't specify the API key in the settings record, it will look for a default test API key to use, and to keep the keys out of source code, it uses UserSecrets. It is recommended to use UserSecrets during development and web-server configuration settings in production, but if your source code will not be made public you can simply specify the API key as a string, at least for testing purposes. Config.fs contains some notes to help you.

The options can be provided using record notation or if there are many uninitialised properties you can use the static New method to instantiate the record more effiently.

Code Generation

By cloning the source repository, as a developer you can use ModelBuilder.fs and RequestBuilder.fs to generate the code in StripeModel.fs and StripeRequest.fs respectively.

Using Visual Studio Code, you simply select all the text in each document and hit Alt + Enter to send the code to F# Interactive. This will overwrite the contents of the target modules.

The Stripe OpenAPI specification is stored locally as /res/spec3.sdk.json. See the references below for the link to the latest online version.

By replacing the local copy with the latest one from online, you can regenerate the source code and build it to get the latest changes.

You could also customise how the source code is represented by editing the builder code files.

References

Stripe Documentation

Developer Tools

API Reference

Official Stripe .NET Library

Stripe OpenAPI Specification

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].