This small application demonstrates how you might set up a web server using Ruby and Sinatra with RESTful routes to accept your Recurly.js form submissions and use the tokens to create and update customer billing information without having to handle credit card data.
This example makes use of the official Recurly Ruby client library for API v3.
Note that it is not necessary to use the Sinatra framework. In this example it is used to organize various API actions into distinct application routes, but one could just as easily implement these API actions within Rails or any other application framework.
POST
/api/subscriptions/newPOST
/api/purchases/newPOST
/api/accounts/newPUT
/api/accounts/:account_code
-
If you haven't already, install docker.
-
Update the values in docker.env at the (root of the repo)[https://github.com/recurly/recurly-integration-examples/blob/main/docker.env]
-
Run
docker-compose up --build
- Start the server
$ bundle
$ ruby app.rb