react-native-moyasar-sdk
Version:
Official React Native Moyasar SDK - Integrate Credit Cards, Apple Pay, Samsung Pay, and STC Pay with simple interfaces for a seamless payment experience in your React Native app
44 lines (43 loc) • 1.37 kB
JavaScript
"use strict";
/**
* Constructs a TokenRequest object for creating a token for a Credit Card.
* @param {string} name - Card holder’s name on the Credit Card.
* @param {string} number - Credit Card number without any separators.
* @param {string} cvc - Credit Card's security code.
* @param {string} month - Two digit number representing the Credit Card's expiration month.
* @param {string} year - Two or four digit number representing the Credit Card's expiration year.
* @param {string} callbackUrl - The URL to be redirected to after a 3D secure transaction (e.g., https://sdk.moyasar.com/return).
* @param {Record<string, string | number | boolean> | null} [metadata] - Adds searchable key/value pairs to the payment. For example `{"size": "xl"}`.
*/
export class TokenRequest {
constructor({
name,
number,
cvc,
month,
year,
callbackUrl,
metadata
}) {
this.name = name;
this.number = number;
this.cvc = cvc;
this.month = month;
this.year = year;
this.callbackUrl = callbackUrl;
this.metadata = metadata;
}
toJson() {
return {
name: this.name,
number: this.number,
cvc: this.cvc,
month: this.month,
year: this.year,
save_only: true,
callback_url: this.callbackUrl,
metadata: this.metadata
};
}
}
//# sourceMappingURL=token_request.js.map