Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

what after getting the stripeToken ? #116

Open
kudsyf opened this issue Jan 18, 2017 · 1 comment
Open

what after getting the stripeToken ? #116

kudsyf opened this issue Jan 18, 2017 · 1 comment

Comments

@kudsyf
Copy link

kudsyf commented Jan 18, 2017

as in the example code

` $scope.handleStripe = function(status, response) {
console.log("STRIPE ", response);
if (response.error) {

            // there was an error. Fix it.
        } else {
            // got stripe token, now charge it or smt
            token = response.id
            console.log("token ", token);


        }
    }`

what the next step ? submiting the token and the user data ? like email , payment amount ? currency ? submit all that to the node.js server where charge is done ? so just use a http$.post ? or what else !!

@mandudeboy
Copy link

kudsyf you need to call whatever backend system you have and pass in the token. Your backend then has to take that token and some amount and send it to Stripe to make the actual payment, and maybe respond with "OK" to your frontend:

} else {
            // got stripe token, now charge it or smt
            token = response.id
            console.log("token ", token);
            amount = 100;
            makeOneTimePayment(amount, token).then(function(result) {
		        		$scope.updatedAccountCredits = result.data;
		        		console.log("Got OK from backend. Account credits updated.");
		        		$scope.showCreditsUpdated = true;
		        	}, function(error) {
		        		console.log("Error occured on backend when charging account. Please contact support");
		        	});

        }

where makeOneTimePayment() is a method you have to write that calls the backend.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants