Created
September 13, 2017 22:32
-
-
Save ozcanzaferayan/6c364329a76e9ef37627cd083ecd541a to your computer and use it in GitHub Desktop.
Payment Request API Usage Turkish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button onClick="satinAl()">Satın al</button> | |
<script> | |
const desteklenenOdemeYontemleri = [{ | |
supportedMethods: ['basic-card'] | |
}]; | |
const odemeDetaylari = { | |
total: { | |
label: 'Toplam', | |
amount: { | |
currency: 'TRY', | |
value: 100 | |
} | |
} | |
}; | |
const request = new PaymentRequest(desteklenenOdemeYontemleri, odemeDetaylari); | |
async function satinAl() { | |
// Ödeme ekranını göster ve ilgili ödeme bilgilerinin doldurulmasını bekle | |
const paymentResponse = await request.show(); | |
// Ödemeyi tamamla | |
await paymentResponse.complete(); | |
// Ödeme bilgilerini bankaya ilet | |
console.log(paymentResponse.details); // CC #, ad, güvenlik kodu, son kullanım tarihi vb. | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment