2017-10-21 6 views
2

스트라이프 v3을 사용하여 결제하려고합니다. 가이드는 여기에 있습니다 https://stripe.com/docs/elements스트라이프로 우편 번호를 수집하지 마십시오.

우편 번호를 수집하고 싶지 않습니다. 그러나 나는 어떻게 알아낼 수 없다.

<form> 
    <label> 
    <div id="card-element" class="field is-empty"></div> 
    <span><span>Credit or debit card</span></span> 
    </label> 
    <button type="submit">Pay</button> 
    <div class="outcome"> 
    <div class="error" role="alert"></div> 
    <div class="success"> 
     Success! Your Stripe token is <span class="token"></span> 
    </div> 
    </div> 
</form> 

그리고 자바 스크립트는 다음과 같습니다 : 내 HTML은

var card = elements.create('card', { 
    style: { 
    hidePostalCode: true, 
    base: { 
     iconColor: '#666EE8', 
     color: '#31325F', 
     lineHeight: '40px', 
     fontWeight: 300, 
     fontFamily: '"Helvetica Neue", Helvetica, sans-serif', 
     fontSize: '15px', 

     '::placeholder': { 
     color: '#CFD7E0', 
     }, 
    }, 
    } 
}); 

card.mount('#card-element'); 

그러나 그것은 항상 우편 번호 요청 : 여기에 요소 태그 https://stripe.com/docs/stripe.js#element-types에 대한 안내가 있습니다

enter image description here

. 그러나 나는 어디에서 카드 번호, CVC 및 카드 만료를 수집 할 수 있는지 알 수는 없지만 우편 번호는 아닙니다 ...

+0

코드는 괜찮습니다. – Zico

답변

1

고맙게도, 이것은 꽤 간단한 수정이어야합니다! hidePostalCode: true은 여기 style 아래에 중첩되어 있지 않고 options의 최상위 속성이어야합니다.

https://stripe.com/docs/stripe.js#element-options

var card = elements.create('card', { 
hidePostalCode: true, 
style: { 
base: { 
    iconColor: '#666EE8', 
    color: '#31325F', 
    lineHeight: '40px', 
    fontWeight: 300, 
    fontFamily: '"Helvetica Neue", Helvetica, sans-serif', 
    fontSize: '15px', 

    '::placeholder': { 
    color: '#CFD7E0', 
    }, 
    }, 
} 
}); 

card.mount('#card-element'); 
관련 문제