var summ = (this.state.formData.summ_str != '')? this.state.formData.summ_str*1 : this.state.formData.summ*1;
const {payment, name, email, subscribe} = this.state.formData;
const data = { name, email, subscribe: subscribe === "on" };
this.generateIdempotenceKey();
let save_payment_method = false;
if ( payment === "Month") {
save_payment_method = true;
}
superagent.post(`${api.root}/${api.endpoints.donaters}/create`)
.query({email, name})
.end((error, response) => {
if (!error && response.statusCode === 200) {
ajax.post({
url: `${api.root}/${api.endpoints.donaters}/yandex_payment`,
data: {
'idempotence_key': this.state.idempotence_key,
'summ' : summ,
'email': this.state.formData.email,
'name': this.state.formData.name,
'save_payment_method': save_payment_method
},
}).then((response) => {
if(response){
window.location.replace(response.confirmation.confirmation_url);
}
});
}
});
}
ну вроде так не делают :))
а почему нельзя это же и использовать?
Обсуждают сегодня