Question:
My question is how do I know if completing a tokenized payment for an Apple Pay payment was a success or failure after polling for payment.ready == true?
What I’m doing:
First I complete the checkout using the mutation checkoutCompleteWithTokenizedPaymentV3. To confirm this mutation was successful I check the following:
- Success block is fired
- checkoutUserErrors.count == 0
- Payment object is created and not nil (which signifies the async operation of payment has begun).
Second, I then poll on the payment object created for payment.ready == true.
From my understanding payment.ready == true doesn’t signify a successful payment, it only signifies the async operation of the payment processing has finished.
From here how do I know if the payment was a success or failure once payment.ready == true?
Is it safe to do the following check to confirm if payment was successful or not?:
if payment.errorMessage == nil {
//payment success
} else {
/// payment failure
}
The sample app seems to fall short here and marks a success regardless of the error message given. The sample app has:
let retry = Graph.RetryHandler
But what if there was an error? Why does it completely disregard the errorMessage?