I am using paypal ios sdk for payment. I tried to pay with credit card in sandbox mode. I am getting State=pending.It accepts my creditcard details but When I click on charge credit card It procees for that and then I got response from paypal :
{
client = {
environment = sandbox;
"paypal_sdk_version" = "1.3.3";
platform = iOS;
"product_name" = "PayPal iOS SDK";
};
payment = {
amount = "122.00";
"currency_code" = USD;
"short_description" = "Paying to MYAPP";
};
"proof_of_payment" = {
"rest_api" = {
"payment_id" = "PAY-6SB360568W1073911KLY6KAI";
state = pending;
};
};
}
It was working fine in NoNetwork/mockmode. Paypal login is also working in sandbox mode. Does I am missing some thing with credit card?
You most likely have Payment Review enabled for the receiving account. To disable this, click the profile link under the account in your sandbox account list and turn off payment review on the settings tab.
Related
I've been using Stripe. When checkout X will create a Payment Intent every time a customer arrives on the checkout. This will result into an "Incomplete" payment.
I integrete STRIPE in my .Net Core application. Here the code below :
public void Pay(CardInfo cardInfo, double amount)
{
StripeConfiguration.ApiKey = _paramList["secretKey"];
State = PaymentState.Pending;
try
{
var options = new SessionCreateOptions
{
Mode = "payment",
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
Customer = cardInfo.Owner,
CustomerEmail = cardInfo.ParamList["email"],
PaymentMethodTypes = new List<string>
{
"card",
},
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
Amount = Convert.ToInt64(amount.ToString().Replace(",","")),
Currency = "eur",
Quantity = 1,
Name = _paramList["account"]
},
},
};
var service = new SessionService();
service.Create(options);
State = PaymentState.Accepted;
}
catch (StripeException error)
{
State = PaymentState.Error;
PaymentReturn = error.Message;
Logger.Write(string.Format("Error STRIPE payment status {0} : ",PaymentReturn));
}
}
In my form payment, I'm not using stripe form but I've created one and I retrieve all information that I need (Card Number, CVV, Expiration, Email and Amount)
When using Stripe Checkout, a PaymentIntent is created under the hood to support the SCA compliant payment. If the session is not completed, the PaymentIntent will remain in state incomplete. This. part is entirely normal.
Integrating with Stripe using a checkout session, but not redirecting to the Stripe hosted Checkout is not a supported integration. If you would like to support handling the card fields yourself, then an integration using Stripe.js and Elements is the best way forward [1]. If you would like to continue using Stripe Checkout as it offers so much functionality out of the box, then once the session is created, you should use redirectToCheckout() from Stripe.js [2] to send the user to Stripe Checkout.
[1] https://stripe.com/docs/payments/accept-a-payment?integration=elements
[2] https://stripe.com/docs/payments/accept-a-payment#redirect-customers
I am new to paypal integration with objective c.
Created the sanbox (buyer account) which have balance approx 100$
Had download code from : https://github.com/paypal/PayPal-iOS-SDK/tree/master/SampleApp/PayPal-iOS-SDK-Sample-App
ZZAppDelegate.m
[PayPalMobile initializeWithClientIdsForEnvironments:#{ PayPalEnvironmentSandbox : #"XXXXXXX"}];
Execute the project and able to login with buyer account credential.
Click buy button. console show paid successful :
Here is your proof of payment:
{
client =
{
environment = mock;
"paypal_sdk_version" = "2.16.3";
platform = iOS;
"product_name" = "PayPal iOS SDK";
};
response = {
"create_time" = "2017-04-05T05:49:16Z";
id = "PAY-NONETWORKPAYIDEXAMPLE123";
intent = sale;
state = approved;
};
"response_type" = payment;
}
But the problem is : I am not able to see this activity in my sandbox account on browser.
Do we need to add project APPID in sandbox account if yes ? Where do we need to do it?**
APPID :- means apple id (apple bundle identifier) ?
Or there is some different APPID ?
Please help me if there is any steps need to be integrated
If you have added PalPalSDK in application. You have to choose between Sandbox or Production. You have to create AppID for Palpal. You can check there it has sample code also available.
If Payment get successful it has delegate method where we can view with Payment successful.
- (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
// TODO: Send completedPayment.confirmation to server
NSLog(#"Here is your proof of payment:\n\n%#\n\nSend this to your server for confirmation and fulfillment.", completedPayment.confirmation);
}
here you can get all the data after paypal payment
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment
{
NSLog(#"PayPal Payment Success!");
self.resultText = [completedPayment description];
[self sendCompletedPaymentToServer:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
}
The didCompletePayment delegate method confirms the state of my payment is approved:
CurrencyCode: USD
Amount: 1.95
Short Description: avocado
Intent: sale
Processable: Already processed
Display: $1.95
Confirmation: {
client = {
environment = mock;
"paypal_sdk_version" = "2.8.3";
platform = iOS;
"product_name" = "PayPal iOS SDK";
};
response = {
"create_time" = "2015-02-10T16:17:43Z";
id = "PAY-NONETWORKPAYIDEXAMPLE123";
intent = sale;
state = approved;
};
"response_type" = payment;
}
Details: (null)
Shipping Address: (null)
Invoice Number: (null)
Custom: (null)
Soft Descriptor: (null)
BN code: (null)
However, when I go my Dashboard on Developer.PayPal.com, nothing shows up on my transactions page.
Any thoughts on what I could be missing or doing wrong? Is the payment completely verified at this point or do I have to do more logic on the server to verify it? I am already getting the bearer access token before I create the payment and get its info in the delegate callback, but am not sure what I am supposed to do with this token.
Thanks,
Okay, I realized what I was doing wrong.
I was previously using:
PayPalMobile.preconnectWithEnvironment(PayPalEnvironmentNoNetwork)
But needed to be using:
PayPalMobile.preconnectWithEnvironment(PayPalEnvironmentSandbox)
Hope this helps someone else using PayPal SDK for iOS.
I am trying to sync ios in app purchase with woocommerce purchase(web). So when user purchases something in apple store(product lists are same on both side) i would like to view it in woocommerce that item was purchased by that user. FYI, I have a json api plugin that i am using to make request between ios app and site. Any idea how i can do this?
This is how i resolved it
global $woocommerce;
$user = get_user_by('id',$shopId);
if ($user){
wp_set_current_user($shopId,$user->user_login);
wp_set_auth_cookie($shopId);
do_action('wp_login',$user->user_login);
}
if (is_user_logged_in()){
$cart = new WC_Cart();
$checkout = new WC_Checkout();
if ($cart->add_to_cart($productId)){
$orderId = $checkout->create_order(intval($shopId));
}
if (!empty($orderId)){
$order = new WC_Order($orderId);
if (!empty($order)){
$order->update_status("completed","ios app purchase");//I HAD TO SET IT TO COMPLETE SINCE USER BOUGHT IT FROM IOS IN APP PURCHASE
}
//
}
else{
$order = array('fail');
}
}
else{
$order = array();
}
return array($order);
I am developing web application on ASP.NET. In application users can purchase article for money.
For work with PayPal I using PayPal Merchant SDK for .NET package. Application work good with sandbox but with live display error: "This transaction is invalid". Please return to the recipient's website to complete your transaction using their regular checkout flow."
When user click on purchase button I execute code:
// only for live
var paypalConfig = new Dictionary<string, string> {
{"account1.applicationId", "<APP-LIVEID>"},
{"account1.apiUsername", "<username>"},
{"account1.apiPassword", "<pass>"},
{"account1.apiSignature", "<signature>"},
{"mode", "live"}};
try
{
var currency = CurrencyCodeType.USD;
var paymentItem = new PaymentDetailsItemType
{
Name = "item",
Amount = new BasicAmountType(currency, amount.ToString()),
ItemCategory = ItemCategoryType.DIGITAL,
};
var paymentItems = new List<PaymentDetailsItemType>();
paymentItems.Add(paymentItem);
var paymentDetail = new PaymentDetailsType();
paymentDetail.PaymentDetailsItem = paymentItems;
paymentDetail.PaymentAction = PaymentActionCodeType.SALE;
paymentDetail.OrderTotal = new BasicAmountType(currency, amount.ToString());
paymentDetail.SellerDetails = new SellerDetailsType {
PayPalAccountID= sellerEmail
};
var paymentDetails = new List<PaymentDetailsType>();
paymentDetails.Add(paymentDetail);
var ecDetails = new SetExpressCheckoutRequestDetailsType {
ReturnURL = returnUrl,
CancelURL = cancelUrl,
PaymentDetails = paymentDetails,
};
var request = new SetExpressCheckoutRequestType
{
Version = "104.0",
SetExpressCheckoutRequestDetails = ecDetails,
};
var wrapper = new SetExpressCheckoutReq
{
SetExpressCheckoutRequest = request
};
var service = new PayPalAPIInterfaceServiceService(paypalConfig);
var setECResponse = service.SetExpressCheckout(wrapper);
if (sandbox)
return "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}".FormatWith(setECResponse.Token);
return "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&TOKEN={0}".FormatWith(setECResponse.Token);
}
// # Exception log
catch (System.Exception ex)
{
// Log the exception message
Console.WriteLine("Error Message : " + ex.Message);
}
After all I redirect user to url with received TOKEN.
For my application, registered on PayPal, I set in options only "Adaptive Payments > Basic Payments > Checkout, Send Money or Parallel Payments"
Why live paypal payments can not work? What is the reason?
Removed
ItemCategory = ItemCategoryType.DIGITAL,
and all work
From previous experiences this problem usually comes from having a "null" token because of some mistake in the "setExpressCheckout" request (where, in the express checkout flow, you ask paypal for a transaction token).
Basically, you ask paypal for a token so you can build the redirect URL, but you make some mistake and paypal gives you an error but no token, so you build the URL with no token (or a wrong one).
If you try to redirect the user to the checkout URL ( https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={...}&useraction={...}) with an empty token you will get this error.
Actually I'm trying to know of there can be other causes...