2017-05-13 2 views
0

일부 브라우저에서는 분명히 제공되는 결제 요청 API를보고 있었지만 궁금한 점은 지불금을 송금 할 계정을 설정하는 방법입니다. 성공시 지불금을받을 계좌를 지정하는 코드는 어디에도 없습니다 :결제 요청 API : 수취인 계정이란 무엇입니까?

function onBuyClicked() { 
    if (!window.PaymentRequest) { 
    // PaymentRequest API is not available. Forwarding to 
    // legacy form based experience. 
    location.href = '/checkout'; 
    return; 
    } 

    // Supported payment methods 
    var supportedInstruments = [{ 
     supportedMethods: ['basic-card'] 
     data: { 
     supportedNetworks: [ 
      'visa', 'mastercard', 'amex', 'discover', 
      'diners', 'jcb', 'unionpay' 
     ] 
     } 
    }]; 

    // Checkout details 
    var details = { 
    displayItems: [{ 
     label: 'Original donation amount', 
     amount: { currency: 'USD', value: '65.00' } 
    }, { 
     label: 'Friends and family discount', 
     amount: { currency: 'USD', value: '-10.00' } 
    }], 
    total: { 
     label: 'Total due', 
     amount: { currency: 'USD', value : '55.00' } 
    } 
    }; 

    // 1. Create a `PaymentRequest` instance 
    var request = new PaymentRequest(supportedInstruments, details); 

    // 2. Show the native UI with `.show()` 
    request.show() 
    // 3. Process the payment 
    .then(result => { 
    // POST the payment information to the server 
    return fetch('/pay', { 
     method: 'POST', 
     credentials: 'include', 
     headers: { 
     'Content-Type': 'application/json' 
     }, 
     body: JSON.stringify(result.toJSON()) 
    }).then(response => { 
     // 4. Display payment results 
     if (response.status === 200) { 
     // Payment successful 
     return result.complete('success'); 
     } else { 
     // Payment failure 
     return result.complete('fail'); 
     } 
    }).catch(() => { 
     return result.complete('fail'); 
    }); 
    }); 
} 

document.querySelector('#start').addEventListener('click', onBuyClicked); 

Ref. https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/deep-dive-into-payment-request

Ref. https://www.w3.org/TR/payment-request/

답변

1

짧은 이야기 : 당신은하지 않습니다.

결제 요청 API는 이 아니며 결제 프로세서를 대신합니다. 브라우저 자체는 귀하의 계정으로 자금 이체를 처리 할 수단이 없으므로 심지어 제공된 지불 방법이 유효한지 여부도 검증 할 수 없습니다 (Android Pay에서 가능).

...

브라우저는 다음 지불 방법을 선택하고 거래를 승인 사용자에게 지불 UI를 제공합니다 : Introducing the Payment Request API 문서 (강조 광산) 당

. 결제 수단은 브라우저에 이미 저장되어있는 신용 카드처럼 간단하거나 으로 작성된 제 3 자 응용 프로그램으로는 밀접한 결제 수단이 될 수 있습니다 (이 기능은 곧 이됩니다). 사용자가 거래를 승인하면 모든 지불 세부 정보가 사이트로 바로 전송됩니다. 예를 들어, 신용 카드 결제의 경우 사이트는 카드 번호, 카드 소유자 이름, 만료 날짜 및 CVC을 다시받습니다. 즉

...

는 지불 요청 API는 당신이 지불을 처리하는 데 필요한 사용자의 카드 번호 및 기타 정보를 수집하기위한 단지 쉽고 안전한 방법입니다. 이 정보를 받으면 사용자가 일반 양식을 통해 제출 한 것과 거의 같습니다. 실제로 트랜잭션을 작성하려면 지불 프로세서 (또는 이와 유사한)가 필요합니다.