Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Pay - Processing Payment - Not Completed #177

Closed
robert-stevens opened this issue Jul 3, 2020 · 9 comments
Closed

Apple Pay - Processing Payment - Not Completed #177

robert-stevens opened this issue Jul 3, 2020 · 9 comments

Comments

@robert-stevens
Copy link

Hi Guys,

I wanted to know how to get Apple Pay to work, I have followed this guide and created a merchant ID and added it to XCode:

https://stripe.com/docs/apple-pay

And had a look at the example app.

When the user hits the checkout screen I create a Payment Intent via our API which returns back a PaymentIntent response. And store the response in the state.

    "id": "PAYMENT_INTENT_ID",
    "object": "payment_intent",
    "amount": 100,
    "amount_capturable": 0,
    "amount_received": 0,
    "application": null,
    "application_fee_amount": null,
    "canceled_at": null,
    "cancellation_reason": null,
    "capture_method": "automatic",
    "charges": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/charges?payment_intent=PAYMENT_INTENT_ID"
    },
    "client_secret": "SOME_SECRET",
    "confirmation_method": "automatic",
    "created": 1593777290,
    "currency": "gbp",
    "customer": null,
    "description": null,
    "invoice": null,
    "last_payment_error": null,
    "livemode": false,
    "metadata": [],
    "next_action": null,
    "on_behalf_of": null,
    "payment_method": null,
    "payment_method_options": {
        "card": {
            "installments": null,
            "network": null,
            "request_three_d_secure": "automatic"
        }
    },
    "payment_method_types": [
        "card"
    ],
    "receipt_email": null,
    "review": null,
    "setup_future_usage": null,
    "shipping": null,
    "source": null,
    "statement_descriptor": null,
    "statement_descriptor_suffix": null,
    "status": "requires_payment_method",
    "transfer_data": null,
    "transfer_group": null
}```


I then launch apple pay via:


                      StripePayment.paymentRequestWithNativePay(
                        androidPayOptions: AndroidPayPaymentRequest(
                          totalPrice: '${widget.membershipOption.price}',
                          currencyCode: "GBP",
                        ),
                        applePayOptions: ApplePayPaymentOptions(
                          countryCode: 'GB',
                          currencyCode: 'GBP',
                          items: [
                            ApplePayItem(
                              label: widget.membershipOption.title,
                              amount: 100,
                            )
                          ],
                        ),
                      ).then((token) {
                        setState(() {
                          _scaffoldKey.currentState.showSnackBar(SnackBar(
                              content: Text('Received ${token.tokenId}')));
                          _paymentToken = token;
                        });
                      }).catchError(setError);```

Processing responses:

Screenshot 2020-07-03 at 14 18 07

Screenshot 2020-07-03 at 14 18 17

I have tried on a real device using real cards and the same happens.

What am I missing?

@RahulDevCodiant
Copy link

I am also facing the similar issue!!!

Please help!!!

@macmatrix
Copy link

Check out this guide.
It's working for me

@robert-stevens
Copy link
Author

@macmatrix tx, had a quick look and doesn't seem that the guide is using Apple Pay?

I will give it a go though, perhaps it will help.

@DevRahul123
Copy link

Hi @robert-stevens

My issue got resolved when i've used "await StripePayment.completeNativePayRequest();" in the first line of ".then(token)" method, like this :

.then((token) async {
await StripePayment.completeNativePayRequest();
//do anything with token
})

I found this solution here : tipsi/tipsi-stripe#562

@robert-stevens
Copy link
Author

@DevRahul123 thank you, I will give that a try.

@macmatrix
Copy link

macmatrix commented Jul 10, 2020

@macmatrix tx, had a quick look and doesn't seem that the guide is using Apple Pay?

I will give it a go though, perhaps it will help.

@robert-stevens It does use Apple pay, G pay & standard credit card form! Have a look at it

@robert-stevens
Copy link
Author

@macmatrix thanks will take time to go through it in detail.

@robert-stevens
Copy link
Author

Hi @robert-stevens

My issue got resolved when i've used "await StripePayment.completeNativePayRequest();" in the first line of ".then(token)" method, like this :

.then((token) async {
await StripePayment.completeNativePayRequest();
//do anything with token
})

I found this solution here : tipsi/tipsi-stripe#562

This worked for me. Thank you @DevRahul123

@haifzhan
Copy link

haifzhan commented Apr 4, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants