recurly / recurly-integration-examples

Examples to get you integrated with Recurly in any language.
https://developers.recurly.com/
MIT License
68 stars 61 forks source link
payment-form payments recurly recurly-js

Recurly integration examples

This repository contains a set of example implementations of recurly.js using html, css, and JavaScript, and a set of API usage examples to demonstrate a few common use-cases for integrating with Recurly.

Please note that these examples are not meant to be set onto a web server and forgotten. They are intended to act as a suggestion, wherein your custom needs may fill in any implementaiton gaps.

Payment form examples

API usage examples

Configuring the examples

Each API example will pull configuration values from environment variables. You may set them to quickly configure the example to connect to your Recurly site.

Environment variable description
RECURLY_SUBDOMAIN The subdomain of your recurly site
RECURLY_API_KEY Your private API key
RECURLY_PUBLIC_KEY Your public API key
SUCCESS_URL A URL to redirect to when an action suceeds
ERROR_URL A URL to redirect to when an error occurs

How to run

Each example can be run either locally or through Docker, allowing you to easily experiment with modifications and get running quickly.

You should adjust the code to fit your specific redirection and error handling needs, but the example applications are designed to perform essential API functions on first boot.

Note: These examples are purely for demonstration purposes and we do not recommend using them as the foundation of a production system.

Docker

Each example includes a Dockerfile and a docker-compose.yml file to allow them to be run through Docker.

To run any of the examples through Docker, clone this repository, update the docker.env file at the root of level of the project with values corresponding to your Recurly site, and run docker-compose up inside the directory of any of the examples.

Local

To run locally, simply clone this repository, read through the simple application code to familiarize yourself, and follow the startup instructions in one of the API token usage examples above.

Deploy Immediately to Cloud Services

This repository can be deployed immediately to Heroku or Google Cloud using the included Ruby example. If you choose to do this, feel free to delete the other language backends from your clone.

Deploy

Run on Google Cloud

Deploy to Netlify

Looking for React?

If you plan to use React on your frontend, check out our react-recurly library. We maintain an example integration of react-recurly in the documentation for that library. Be sure to read through the documentation as you explore the examples.

Contributing

See CONTRIBUTING file.

License

MIT