     public init(payment:PKPayment)
     {
         self.payment = payment;
-        //self.paymentdataString = String(data:payment.token.paymentData, encoding: .utf8);
         self.token = payment.token
         self.tokenPaymentNetwork = payment.token.paymentMethod.network?.rawValue;
         self.transactionId = payment.token.transactionIdentifier;
         self.tokenInstrumentName = payment.token.paymentMethod.displayName;
         self.billingContact = payment.billingContact;
         self.shippingContact = payment.shippingContact;
-        
-        
-        try {
-         //   self.tokenPaymentNetworkType = payment.token.paymentMethod.type.rawValue;
-            
-            let networkType : BSApplePayNetworkType =payment.token.paymentMethod.type
-        }
+        self.tokenPaymentNetworkType = payment.token.paymentMethod.type.description
     }
 }
 
 extension BSApplePayInfo: DictionaryConvertible
 {
-//    public func toDictionary() -> [String : Any] {
-//        var map = [String:Any]();
-//        map.setValueIfExists(value: self.token, for: "token");
-//        map.setValueIfExists(value: self.tokenInstrumentName, for: "token_instrument_name");
-//        map.setValueIfExists(value: self.tokenPaymentNetwork, for: "token_payment_network");
-//        map.setValueIfExists(value: self.transactionId, for: "transactionIdentifier");
-//        map.setValueIfExists(value: self.billingContact?.toDictionary(), for: "billingContact");
-//        map.setValueIfExists(value: self.shippingContact?.toDictionary(), for: "shippingContact");
-//        return map;
-//    }
 
     public func toDictionary() throws -> [String: Any] {
 
         let desrilaziedToken = try JSONSerialization.jsonObject(with: payment.token.paymentData, options: JSONSerialization.ReadingOptions())
 
         let shippingContactDict = [
+                "familyName": shippingContact?.name?.familyName ?? "",
+                "givenName": shippingContact?.name?.givenName ?? "",
+                /**
+                These are unused by the API and should not be sent, otherwise API call might fail.
+                */
                 //"addressLines": shippingContact?.postalAddress?.description,
                 //"country": shippingContact?.postalAddress?.country,
                 //"countryCode": shippingContact?.postalAddress?.isoCountryCode,
-                "familyName": shippingContact?.name?.familyName ?? "",
-                "givenName": shippingContact?.name?.givenName ?? "",
                 //"locality": shippingContact?.postalAddress?.street,
                 //"emailAddress": shippingContact?.emailAddress,
                 //"phoneNumber": shippingContact?.phoneNumber?.stringValue,

    }
}

extension BSApplePayPaymentNetworkType: CustomStringConvertible {
    public var description: String {
        switch self {
        case .unknown:

            locality = billingContact?.postalAddress?.subLocality
        }
        let billingContactDict = [
                "addressLines": billingAddresLines,
                "country": billingContact?.postalAddress?.country ?? "",
                "countryCode": billingContact?.postalAddress?.isoCountryCode ?? "",
