I can't connect paypal account with Mobile Payment Libraries - ios

I have a little problem with "Mobile Payment Libraries", I can't use paypal SDK because I'm not US developer.
I downloaded the iOS Mobile Payments Library SDK from PayPal. I created a developer account and try example test. This works.
I change "PayPalPayment recipient" for check if sandbox account received money. I run app, Paypal button is correctly appear but when I encode email and password for an other sandbox account, the connection button is disable. And this button stay in disable all time after that. This app was kill and uninstall from device and I download again "iOS Mobile Payments Library SDK" and run again, the connection button is already disable with no modification on paypal code.
Why the button is already disable?
Sorry for my english.
This is code call buy Button Paypal with my modification. But I don't things that this is the problem
- (void)simplePayment {
[PayPal getPayPalInst].shippingEnabled = TRUE;
[PayPal getPayPalInst].dynamicAmountUpdateEnabled = TRUE;
[PayPal getPayPalInst].feePayer = FEEPAYER_EACHRECEIVER;
PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];
payment.recipient = user.paypalAccount; //Sandbox account Email - Type:BUSINESS - Contry:US
payment.paymentCurrency = #"EUR";
payment.description = description;
payment.merchantName = user.name;
payment.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:#"%f",(price * nb)]];
payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];
payment.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:#"%.2f€",type * nb]];
payment.invoiceData.invoiceItems = [NSMutableArray array];
PayPalInvoiceItem *item = [[[PayPalInvoiceItem alloc] init] autorelease];
item.totalPrice = payment.subTotal;
item.name = app.currentTicket.title;
[payment.invoiceData.invoiceItems addObject:item];
[[PayPal getPayPalInst] checkoutWithPayment:payment];
}

Check in your log, maybe you have this message:
PayPalPayment not processable: At this time, 'USD' is the only currency code allowed.
At the moment you can't use EUR as currency, I have the same problem.

Have the same issue. It is not active while you are pasting email/password. When you are typing it handly - it works for me.

Related

How to integrate Citrus payment gateway without asking for login to user in ios?

Hope you are doing well.
I am trying to integrate CitrusPay SDK to my iPhone application. How can i integrate CitrusPay Direct payment without asking user to login to citrus pay.
I want to give options to user like :
Pay using Citrus Wallet
Pay using Creditcard/Debit Card
Pay using Net banking
If user would like to pay using Citrus Wallet then i will ask user to login to citrus using their credentials. If they will go with 2nd or 3rd option like pay using Credit Card/Debit Card or net banking then they don't need to login.
I want to implement this function in my app using CitrusPay SDK. Can you point out me for the code of this?
I already have a demo of the Citrus pay and i already checked it.
https://github.com/citruspay/citruspay-ios-sdk
I downloaded the demo from the above link.
Please help me out for this.
[CitrusPaymentSDK enableDEBUGLogs];
CTSKeyStore *keyStore = [[CTSKeyStore alloc] init];
keyStore.signinId = SignInId;
keyStore.signinSecret = SignInSecretKey;
keyStore.signUpId = SubscriptionId;
keyStore.signUpSecret = SubscriptionSecretKey;
keyStore.vanity = VanityUrl;
[CitrusPaymentSDK initializeWithKeyStore:keyStore environment:CTSEnvSandbox];
[CitrusPaymentSDK enableDEBUGLogs];
//CC, DC payments
CTSElectronicCardUpdate *creditCard = [[CTSElectronicCardUpdate alloc] initCreditCard]; //for debit card use > initDebitCard
creditCard.number = #"";
creditCard.expiryDate = #"XX/XX"; //only mm/yyyy format
creditCard.scheme = [CTSUtility fetchCardSchemeForCardNumber:creditCard.number]; //fetch card scheme
creditCard.ownerName = #"XXXXXXXX"; // no special characters here
creditCard.cvv = #"XXX";
CTSPaymentLayer *paymentLayer = [CitrusPaymentSDK fetchSharedPaymentLayer];
CTSPaymentDetailUpdate *paymentInfo = [[CTSPaymentDetailUpdate alloc] init];
[paymentInfo addCard:creditCard];
CTSContactUpdate* contactInfo;
CTSUserAddress* addressInfo;
contactInfo = [[CTSContactUpdate alloc] init];
contactInfo.firstName = #"";
contactInfo.lastName = #"";
contactInfo.email = #"";
contactInfo.mobile = #"";
addressInfo = [[CTSUserAddress alloc] init];
addressInfo.city = TEST_CITY;
addressInfo.country = TEST_COUNTRY;
addressInfo.state = TEST_STATE;
addressInfo.street1 = TEST_STREET1;
addressInfo.street2 = TEST_STREET2;
addressInfo.zip = TEST_ZIP;
[CTSUtility requestBillAmount:#"X" billURL:BillUrl callback: ^(CTSBill *bill , NSError *error){
if(error){
dispatch_async(dispatch_get_main_queue(), ^{
});
[UIUtility toastMessageOnScreen:error.localizedDescription];
}
else {
[paymentLayer requestDirectChargePayment:paymentInfo withContact:contactInfo withAddress:addressInfo bill:bill returnViewController:self withCompletionHandler:^(CTSCitrusCashRes *citrusCashResponse, NSError *error){
dispatch_async(dispatch_get_main_queue(), ^{
// [self.indicatorView stopAnimating];
// self.indicatorView.hidden = TRUE;
});
if(error){
[UIUtility toastMessageOnScreen:error.localizedDescription];
}
else {
[UIUtility toastMessageOnScreen:[NSString stringWithFormat:#"Payment Status %#",[citrusCashResponse.responseDict valueForKey:#"TxStatus"] ]];
// [self resetUI];
}
}];
}
}];

iOS Touch ID no password button wanted

Touch ID presents two buttons in its view, “Enter Password” and “Cancel” and I can’t find documentation on how to ask for fingerprints only, apps like Withings can successfully do it, asking only for fingerprints without the password button (just the cancel one).
How they can make it?
Simply set the myContext.localizedFallbackTitle to an empty string
LAContext *myContext = [[LAContext alloc] init];
myContext.localizedFallbackTitle = #"";
NSError *authError = nil;
NSString *myReasonString = #"Authentication required";

Facebook iOS - not able to post OpenGraph on Share Dialog

On the following code, when I try to share OG story via Share Dialog, and when I get to the share dialog, the "Post" button isn't enabled (even after I enter text).
I had "something went wrong..." in the FB app, but now I don't have it at all
The rest of the post seems OK.
Another important thing:
Almost a similar variant of this code, but with user generated photo works perfectly, but here the photo is a URL and is not user_generated
The code:
NSString *FacebookAppNamespace = #"my_fb_namespace";
id<FBGraphObject> object = [FBGraphObject openGraphObjectForPost];
FBOpenGraphActionParams *params = [[FBOpenGraphActionParams alloc] init];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
NSString *previewPropertyName;
url = [NSString stringWithFormat:#"%#/facebook.html?al_applink_data=type%%3Drecipe%%26id%%3D%#",APPLINKS_LINK,self.recipeID];
name = self.recipeTitle;
image = self.recipeImage;
description = self.recipeTitle;
object[#"title"] = name;
object[#"type"] = [NSString stringWithFormat:#"%#:recipe",FacebookAppNamespace];
object[#"description"] = description;
object[#"image"] = #[#{#"url": image}]; //NOTE: tried a lot of variants here, thinking this is the cause
object[#"url"] = url;
[action setObject:object forKey:#"recipe"];
params.action = action;
params.actionType = [NSString stringWithFormat:#"%#:cook",FacebookAppNamespace];
previewPropertyName = #"recipe";
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) {
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:params.actionType
previewPropertyName:previewPropertyName
handler:dialogAppErrorHandler];
}
It is confirmed by Facebook that indeed this is a bug in SDK 3.19.
Actually digging deeper says that this is a bug in Facebook app 15.0 so no need to change SDK
I get a similar behavior (it allows me to post, but then i get "oops, something went wrong".
Somehow, when i tagged a friend in the share dialog, suddenly the entire story appeared (two-to-one), and then the posting/sharing works!
Try it!
(I still don't know how to make it work without it :( so it's still unacceptable)

Not able to communicate with PayPal server

Update: hideCreditCardButton has no role in this issue, it was just a coincident that when I tried it w/o credit card it worked for me but thats not the case anymore.I does work but only 20-30% of the time.
I am using PayPal iOS SDK 1.4.6. if I use paymentViewController.hideCreditCardButton = YES; it works fine but if I set this to paymentViewController.hideCreditCardButton = NO; I get the server error (ref. to image).
here's my code:
- (void)paypalPayment {
// Create a PayPalPayment
float paypalPrice =[youPay floatValue];
NSString* currencyCode = appDelegate.countryCurrency;
if ([currencyCode isEqual: #"INR"]) {
float new = [[[ExchangeRate sharedManager]getExchangeRate:#"INR" toCurrency:#"USD"]
floatValue];
paypalPrice = paypalPrice*new;
}
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:
[NSString stringWithFormat:#"%.2f",paypalPrice]];
payment.currencyCode = #"USD";
payment.shortDescription = #"Total Order";
[PayPalPaymentViewController setEnvironment:PayPalEnvironmentProduction];
// Provide a payerId that uniquely identifies a user within the scope of your system,
// such as an email address or user ID.
NSString *aPayerId = #"abc#msronline.in";
PayPalPaymentViewController *paymentViewController;
paymentViewController = [[PayPalPaymentViewController alloc]
initWithClientId:kPayPalClientId
receiverEmail:kPayPalReceiverEmail
payerId:aPayerId
payment:payment
delegate:self];
paymentViewController.languageOrLocale = #"en";
paymentViewController.hideCreditCardButton = NO;
[self presentViewController:paymentViewController animated:YES completion:nil];
}
Dave from PayPal here.
That's indeed weird. You're getting this as soon as you present the viewcontroller? Is it still happening today?
From your screenshot, it looks like the SDK is still trying to get an initial connection with the PayPal server. At this early stage, the setting of hideCreditCardButton shouldn't yet affect anything.
You are using the Client ID that's designated for Production (as opposed to the Client ID designated for Sandbox), right?
Do you see anything helpful in the console log?
I have same issue and solved by change kPayPalReceiverEmail.
If you use same email as kPayPalReceiverEmail to login in paypal to send payment than this error comes.
I just change kPayPalReceiverEmail email to another one and I get successful response from paypal server.
It may help you

get or simulate NSLocale for current user

I want my App to be used from few iTunes stores. I read NSLocale Class Reference and they are talking about "current user". So, who is "current user"? Is it user which has downloaded app?
1) is it possible to get NSLocale depending on current appleID country or iTunes store country from which my App was downloaded?
2) is it possible to simulate NSLocale to test my App?
In iOS, there is no such thing as a "current user". The reference to "current user" in the NSLocale docs is probably a hold over from the OS X docs.
In iOS, run the Settings app and go to General, then International. The "Region Format" and the "Language" settings define what you get back in iOS for [NSLocale currentLocale].
There is no way, in iOS, for a third party app to obtain any sort of appleID or information about a specific iTunes store.
To directly answer your two questions:
1) No, you have no access to this information
2) Yes, run the Settings app and change the Language and/or Region Format settings. This will affect the NSLocale you obtain in your app.
Mates, i found a solution to get user's (Apple ID, iTunes store) locale! You can get locale from SKProduct.
if([SKPaymentQueue canMakePayments])
{
[self requestProductData];
}
#pragma mark -
#pragma mark In-App Purchase Delegate Methods
- (void)requestProductData
{
NSLog(#"IN-APP:requestProductData");
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:<your in-app identifier>]];
request.delegate = self;
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProduct = [[NSArray alloc]initWithArray:response.products];
if ([myProduct count]>0)
{
SKProduct *product = [myProduct objectAtIndex:0];
NSLog(#"Price: %.2f",product.price.floatValue);
NSLog(#"Price Locale: %#",product.priceLocale.localeIdentifier);
NSLog(#"Product Identifier: %#",product.productIdentifier);
NSLog(#"IN-APP:array count: %i", [myProduct count]);
[request autorelease];
}
[myProduct release];
myProduct = nil;
}

Resources