creditCard method
Future
creditCard(
{ - String? description,
- required double amount,
- required String publishableKey,
- required String cardHolderName,
- required String cardNumber,
- required int cvv,
- required int expiryManth,
- required int expiryYear,
- required String callbackUrl,
})
Credit Card
- All parameters are
amount
, publishable_key
, cardHolderName
, cardNumber
, cvv
, expiryDate_manth
,expiryDate_yar
and callback_url
must be non-null.
description
An arbitrary string which you can attach to a payment object. Payment description is only for your reference and it is NOT displayed to users.
amount
Total purchase amount in Saudi riyals
publishableKey
Moyasar offer its clients a unique API keys to authenticates their API request.
cardHolderName
Card holder’s name.
cardNumber
The card number, as a string without any separators.
cvv
Card security code. CVV or CVC
expiryManth
Two digit number representing the card’s expiration month.
expiryYear
Two or Four digit number representing the card’s expiration year.
callbackUrl
URL of customer’s website page to be redirected to when using payment form method or after 3-D secure transaction (e.g., https://example.com/orders)
Implementation
Future creditCard({
String? description,
required double amount,
required String publishableKey,
required String cardHolderName,
required String cardNumber,
required int cvv,
required int expiryManth,
required int expiryYear,
required String callbackUrl,
}) async {
var source = {
'type': 'creditcard',
'name': cardHolderName,
'number': cardNumber,
'cvc': cvv,
'month': expiryManth,
'year': expiryYear
};
return _pay(
description: description,
amount: amount,
publishableKey: publishableKey,
source: source,
callbackUrl: callbackUrl);
}