Я использую полосу в своем приложении. Мне нужно сохранить информацию о кредитной карте пользователя. Можно ли каким-либо образом сохранить такие значения, как номер карты, срок действия и cv c?
Вот html код
<div *ngIf="checkoutData.form.payment_method =='stripe'" class="stripe-payment">
<form action="/charge" method="post" id="payment-form">
<div class="form-row">
<div id="card-element">
<!-- A Stripe Element will be inserted here. -->
</div>
<!-- Used to display form errors. -->
<div id="card-errors" class="card-error" role="alert"></div>
</div>
</form>
</div>
Вот функция onclick
async onClickStripeSubmit() {
var ownerInfo = {
owner: {
name: this.checkoutData.form.billing_first_name + ' ' + this.checkoutData.form.billing_last_name,
address: {
line1: this.checkoutData.form.billing_address_1,
city: this.checkoutData.form.billing_city,
postal_code: this.checkoutData.form.billing_postcode,
country: 'US',
},
email: this.checkoutData.form.billing_email
},
};
if (!this.checkoutData.form.shipping) {
this.checkoutData.form.shipping_first_name = this.checkoutData.form.billing_first_name;
this.checkoutData.form.shipping_last_name = this.checkoutData.form.billing_last_name;
this.checkoutData.form.shipping_company = this.checkoutData.form.billing_company;
this.checkoutData.form.shipping_address_1 = this.checkoutData.form.billing_address_1;
this.checkoutData.form.shipping_address_2 = this.checkoutData.form.billing_address_2;
this.checkoutData.form.shipping_city = this.checkoutData.form.billing_city;
this.checkoutData.form.shipping_country = this.checkoutData.form.billing_country;
this.checkoutData.form.shipping_state = this.checkoutData.form.billing_state;
this.checkoutData.form.shipping_postcode = this.checkoutData.form.billing_postcode;
}
this.buttonSubmit = true;
this.PlaceOrder = "Placing Order";
this.loading = await this.loadingController.create({
message: 'Loading...',
translucent: true,
animated: true,
backdropDismiss: true
});
await this.loading.present();
console.log(this.cardElement);
this.stripe.createSource(this.cardElement, ownerInfo).then((result) => {
console.log(ownerInfo);
console.log(this.cardElement);
console.log(result);
if (result.error) {
this.loading.dismiss();
// Inform the user if there was an error
var errorElement = document.getElementById('card-errors');
errorElement.textContent = result.error.message;
} else {
this.checkoutData.form.stripe_source = result.source.id;
console.log(this.checkoutData.form.stripe_source);
this.stripNewPayment();
}
});
}
Мне нужно согласовать значение, чтобы я мог сохранить результат полосы, ответ только давая только последние 4 di git карты и дату. Мне нужно взломать это, я не знаю как, но мне нужно сохранить эти данные