Object that that was previously initialized with init Kushki method
Object with subscriptionId and optional amount or currency
options.publicCredentialId into kushkiInstance is not valid or the request fails then throw ERRORS.E003options.subscriptionId into body is not found or the request fails then throw ERRORS.E016import { init, IKushki } from "@kushki/js-sdk";
import { requestDeviceToken, DeviceTokenRequest, TokenResponse } from "@kushki/js-sdk/Card";
const onRequestDeviceToken = async () => {
try {
const kushkiInstance: IKushki = await init({
inTest: true,
publicCredentialId: "merchantId"
});
const body: DeviceTokenRequest={
subscriptionId: "subscriptionId"
amount:{ //amount and currency optionals, but required for 3DS transactions
subtotalIva: 20,
subtotalIva0: 0,
iva: 10,
},
currency: "USD",
}
const response: TokenResponse = await requestDeviceToken(kushkiInstance, body);
// On Success, can get device token for one-click payment, ex. {"token":"31674e78f88b41ffaf47998151fb465d"}
console.log(response);
} catch (error: any) {
// On Error, catch response, ex. {code:"E017", message: "Error en solicitud de Token de subscripción bajo demanda"}
console.error(error.message);
}
};
Generated using TypeDoc
Function to get device token for one-click payment or subscription on-demand