Ionic是否可以控制条纹卡字段的值

问题描述 投票:0回答:1

我在我的应用程序中使用数据条,我需要保存用户信用卡信息,是否可以通过任何方式来控制诸如cardnumber,exp date和cvc之类的值?

这里是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位数字和日期。我需要破解这个,我不知道如何,但是我需要保存这些输入

angular ionic-framework stripe-payments ionic4
1个回答
0
投票

出于安全原因和PCI compliance,这是不能做的。 Elements不允许您访问原始卡的详细信息。它是为满足PCI合规性要求而构建的,访问原始卡的详细信息将使您处于更大的范围。

您永远不需要客户的原始卡信息。您可以将卡保存在Stripe帐户中的“客户”上,以便将来可以再次向他们收费,而无需再次询问其卡详细信息。这在此处有更多详细记录:https://stripe.com/docs/payments/save-during-payment

© www.soinside.com 2019 - 2024. All rights reserved.