Skip to content

Instantly share code, notes, and snippets.

What would you like to do? + Stripe Payment Processing
<div ng-controller="StipePayment">
<formio form="form" submission="submission"></formio>
* First create a form with the following fields.
* - Credit Card Number - Key = creditCardNumber
* - CVC - Key = cvc
* - Expiry Month - Key = expMonth
* - Expiry Year - Key = expYear
* - Token - Key = token
.controller('CreditCard', ['$scope', 'Formio', function($scope, Formio) {
// Create the API class.
var formio = new Formio('');
$scope.form = {};
$scope.submission = {data: {}};
// Load the form.
formio.loadForm().then(function(form) {
$scope.form = form;
// Trigger when a submission is made.
$scope.$on('formSubmission', function(event, submission) {
// Because we have not assigned the URL to the <formio> directive, a request is actually
// not made to at this point. We are simply getting a callback on the filled out
// data on the form.
var stripePayload = {
// Make sure to delete the data from the submission object so that the
// data is not sent to = ''; = ''; = ''; = '';
// Make a call to stripe to get the token.
Stripe.card.createToken(stripePayload, function(status, response) {
if (!response.error) {
var token =; = token;
// Now submit the submission to the server which ONLY includes
// the payment token.
formio.saveSubmission(submission).then(function() {
console.log('YAY! You are done!');

This comment has been minimized.

Copy link

@Molnfront Molnfront commented Feb 6, 2017

I am trying to implement with Stripe and found your script. How do you build it in the backend at, so that a form post trigger a call to Stripe with the API key? Or are you using a standalone Ubuntu installation for this? I try to do a serverless setup if it's possible.


This comment has been minimized.

Copy link
Owner Author

@travist travist commented Feb 6, 2017

Right now the best way to do this would be to kick off a Webhook into the Webhook Receiver and then from there, you can implement the Stripe Node.js library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.