Error while charging
NijaahnandhRV opened this issue · 2 comments
NijaahnandhRV commented
Code :
@IBAction func charge(sender: UIButton) {
// cardParams already fetched from our view or assembled by you
let cardParams = PSTCKCardParams.init();
cardParams.number = "2963781976222"
cardParams.cvc = "289"
cardParams.expYear = 2018
cardParams.expMonth = 9
let transactionParams = PSTCKTransactionParams.init();
// building new Paystack Transaction
transactionParams.amount = 1390;
let custom_filters: NSMutableDictionary = [
"recurring": true
];
let items: NSMutableArray = [
"Bag","Glasses"
];
do {
try transactionParams.setCustomFieldValue("iOS SDK", displayedAs: "Paid Via");
try transactionParams.setCustomFieldValue("Paystack hats", displayedAs: "To Buy");
try transactionParams.setMetadataValue("iOS SDK", forKey: "paid_via");
try transactionParams.setMetadataValueDict(custom_filters, forKey: "custom_filters");
try transactionParams.setMetadataValueArray(items, forKey: "items");
} catch {
print(error);
}
transactionParams.email = "e@ma.il";
// check https://developers.paystack.co/docs/split-payments-overview for details on how these work
transactionParams.subaccount = "ACCT_80d907euhish8d";
transactionParams.bearer = "subaccount";
transactionParams.transaction_charge = 280;
// if a reference is not supplied, we will give one
transactionParams.reference = "ChargedFromiOSSDK@"
PSTCKAPIClient.shared().chargeCard(cardParams, forTransaction: transactionParams, on: self,
didEndWithError: { (error, reference) -> Void in
print(error)
}, didRequestValidation: { (reference) -> Void in
print("an OTP was requested, transaction has not yet succeeded")
}, didTransactionSuccess: { (reference) -> Void in
print("transaction may have succeeded, please verify on backend")
})
}
Error :
Error Domain=com.paystack.lib Code=80 "There was an error processing your card -- try again in a few seconds" UserInfo={NSLocalizedDescription=There was an error processing your card -- try again in a few seconds, com.paystack.lib:ErrorMessageKey=Invalid Subaccount}```
NijaahnandhRV commented
No response so closing.
steveamaza commented
Hi @NijaahnandhRV. Sincere apologies for the late response. What is the error you are getting on charging?