blinkSDK.requestPayment()
Request payment for an article.
Usage
let paymentRequest = {
amount: 600000, // 60c in USD currency units
currencyIsoCode: "usd",
offerId: "984534",
merchantPublicKey: "f9b05c8cb3cdba230ef3580e721c7fcceec5b58e6fc9a5b9265d8fc46fc7b601",
paymentInfoSignature: "F7E1107AD25A3B19655F6B30598D5966C97C03C0CABDF3FD001B42BB26CBD9F718AFC252D63BB6437EE38A780D9D33602B527B6805171B640C67FC055031DC0C"
};
blinkSDK.requestPayment(
paymentRequest,
(response) => {
// Successfully paid for the article, hide the paywall
},
(error) => {
// Payment was not succefull, Blink paywall got updated
// Here you can do additional error handling
});
Signature
blinkSDK.requestPayment(payment, callback, [errorCallback])
Parameters
| parameter | type | required | description |
|---|---|---|---|
payment | object | ☑ | Payment request object |
callback | function | ☐ | Called in case of success, will receive a response object |
errorCallback | function | ☐ | Called in case of error, will receive an error object containing the error details |
Returns
void
Objects definitions
Payment request
{
"amount" : // amount specified in currency units
"currencyIsoCode" : // currency iso code
"offerId" : // can be used to specify a context for this purchase
"comment" : // can be used to add any extra info on the purchase
"merchantPublicKey" : // Ed25519 public key used
"paymentInfoSignature" : // Ed25519 signature
}
| name | type | required | description |
|---|---|---|---|
amount | Number | ☑ | amount specified in currency units (1 USD = 1 000 000) |
currencyCode | String | ☑ | currency ISO 4217 code (i.e. USD/GBP/EUR) |
offerId | String | ☐ | can be used to specify a context for this purchase |
comment | Object | ☐ | can be used to add any extra info on the purchase |
merchantPublicKey | hex String | ☐ | Ed25519 public key used for signing the payment info |
paymentInfoSignature | hex String | ☐ | Ed25519 signature proofing the payment info (amount, currencyIsoCode, offerId, comment) |