Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 199 forks source link

Apple Pay in test mode does not create any order #999

Closed dlpigpen closed 4 years ago

dlpigpen commented 5 years ago

Everything goes well but there is no order created in the admin webpage. I've tried to get the payment detail i got an error like this:

print("Payment created, fetching status...") self.fetchCompletedPayment(payment.id.rawValue) { paymentViewModel in completion(paymentViewModel) }

` func fetchCompletedPayment(_ id: String, completion: @escaping (PaymentViewModel?) -> Void) {

    let retry = Graph.RetryHandler<Storefront.QueryRoot>(endurance: .finite(30)) { response, error -> Bool in
        error.debugPrint()

        if let payment = response?.node as? Storefront.Payment {
            print("Payment not ready yet, retrying...")
            return !payment.ready
        } else {
            return false
        }
    }

    let query = ClientQuery.queryForPayment(id)
    let task  = self.client.queryGraphWith(query, retryHandler: retry) { query, error in

        if let payment = query?.node as? Storefront.Payment {
            print("Payment error: \(payment.errorMessage ?? "none")")
            completion(payment.viewModel)
        } else {
            completion(nil)
        }
    }

    task.resume()
}

`

<Payment: ["errorMessage": There was an error processing your payment. Please try again., "id": Z2lkOi8vc2hvcGlmeS9QYXltZW50Lzc4Nzc2MTg1NjU5Nz9jaGVja291dD0yYjI1ZWU2MzViMTNjMGU5YjE4NTBjOWQ0MjhkZWEzMyZrZXk9ZmMyYjY4Y2QyZDNkNmFlZjg5MTVkOTc0YTEwZmU1OTg=, "test": 0, "amount": 22.67, "creditCard": <null>, "ready": 1, "__typename": Payment, "checkout": { appliedGiftCards = ( ); currencyCode = USD; discountApplications = { edges = ( ); }; email = "John-Appleseed@mac.com";

My shopify is using Stripe in test mode. Apple pay has been configured. Web checkout works fine.

zackshapiro commented 5 years ago

I'm also experiencing this. I get the same error without TestMode also

@dbart01 any idea what's happening here?

zackshapiro commented 5 years ago

There's nothing online related to this string "There was an issue processing your payment. Try again or use a different payment method." So this must be a Shopify-specific thing, but nothing in the readme or code that points to why.

I'd love to get this working, I'm not sure why I'm having such difficulty.

brianminor commented 5 years ago

I am having similar issue. My logs go like this:

Payment not ready yet, retrying... Payment not ready yet, retrying... Payment error: There was an issue processing your payment. Try again or use a different payment method. Checkout completed successfully. Completion status : success

So it acts like it completes, but no order has been placed. I have been testing on device with a real card.

From my knowledge our Store is using Shopify Payments and not Stripe

dbart01 commented 5 years ago

One suggestion I have is to double-check / recreate the certificate you uploaded to the private app for use with Apple Pay. A failing payment that far into the flow is indicative of a configuration issue. Although I'm unable to shed more light on the exact problem, regenerating the certificate may be what you're looking for.

brianminor commented 5 years ago

One suggestion I have is to double-check / recreate the certificate you uploaded to the private app for use with Apple Pay. A failing payment that far into the flow is indicative of a configuration issue. Although I'm unable to shed more light on the exact problem, regenerating the certificate may be what you're looking for.

That lead me to my issue I had 2 Apple Pay Certificates in Apple's Developer portal the one for Shopify wasn't active. Once I activated it is now working great. Thanks @dbart01

tristan-potter commented 4 years ago

It looks like @dbart01 suggestion fixed this, please re-open if any of you are still seeing this problem.

dlpigpen commented 4 years ago

Thanks for your update.

unathi-dev commented 2 years ago

I am getting the same issue. Replace the apple pay certificate but didn't work. Is anyone experiencing this issue?

GhostCoder7 commented 1 year ago

Yep, same issue.

ashleydee1999 commented 1 year ago

I'm currently stuck on the same thing, I've redone the whole certificate upload process on both Apple and Shopify's sides, however, I'm stuck on the same problem. The certificate is marked as "Active" on Apple's side and the iOS Buy SDK is green ticked on Shopify's side

ashleydee1999 commented 1 year ago

Hi @GhostCoder7 , did you ever manage to resolve the issue?

GhostCoder7 commented 1 year ago

@ashleydee1999 I did, but to be honest it was so much trial and error I don't recall what actually resolved it.