API Stripe Charge ( , ..) , ( ),
( ), "", " ". , "" .
-, , "" , , ( , ) .
, (, ), , , , ( , / ..), ( , , api docs)
, , api docs, , .
Dashboard url: https://dashboard.stripe.com/ ( " ", )
API ref:
https://stripe.com/docs/api#create_customer
https://stripe.com/docs/api#create_charge
https://stripe.com/docs/api#create_subscription ( api, )
, NodeJS, php , stripe frontend docs
stripe.customers.create({
description: "NR user twitter: " + req.body.twusername + ", job title being paid for: " + req.body.jobRawTitle,
source: req.body.token,
email: req.body.email
}, function(err, customer) {
if (err) {
console.log("DEBUG payment charge error: " + JSON.stringify(err));
} else {
return stripe.charges.create({
amount: 29900,
currency: "usd",
customer: customer.id,
description: "Jobs 1 month paid for nextreality job titled:" + req.body.jobRawTitle
}, function(err, charge) {
if (err) {
console.log("DEBUG payment charge error: " + JSON.stringify(err) );
console.log("charge: "+ charge);
} else {
return stripe.subscriptions.create({
customer: customer.id,
items: [
{
plan: "jobs_monthly",
},
],
}, function(err, subscription) {
console.log("DEBUG payment subscription error: " + err + ' subs:' + JSON.stringify(subscription) );
return Response(req, res, {});
});
}
});
}
});