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

OCC-115: Migrate to payment element from card element #236

Merged
merged 96 commits into from
Dec 23, 2022
Merged

Conversation

wAsnk
Copy link
Contributor

@wAsnk wAsnk commented Dec 11, 2022

OCC-115
Followed docs https://stripe.com/docs/payments/payment-element/migration. Had to made some changed in the workflow of how the payment intent is created and handled also did some refactoring in the logic.
Automatically listing payment methods in the payment intent element now.
Using the recommended webhook events instead of depending on the return url.

Supported payment methods by this PR:

  • Card
  • iDeal
  • Google pay
  • giropay
  • Bancontact
  • EPS
  • Alipay
  • Przelewy24
  • Link
  • Apple Pay most possibly is working (uses the same procedure as Google pay), but needs extra steps on the Stripe dashboard and a file upload on a live site exposed to the internet

Stripe webhook local test:

  1. Install the Stripe CLI and log in to authenticate your account.
  2. Set listening endpoint stripe listen --forward-to https://localhost:[port]/stripe-webhook
  3. Checkout and pay.

@OrchardCMS OrchardCMS deleted a comment from github-actions bot Dec 21, 2022
@sarahelsaig
Copy link
Contributor

I set up the local stripe CLI but it keeps looping for me on the "Confirming payment." page. The payment intent status is "succeeded" but the order status is still "pending".

image

image

@wAsnk
Copy link
Contributor Author

wAsnk commented Dec 22, 2022

I set up the local stripe CLI but it keeps looping for me on the "Confirming payment." page. The payment intent status is "succeeded" but the order status is still "pending".

image

image

Could you write me down the repro steps because it works on a fresh clone for me. What I do:

  1. Enable OCC features.
  2. Set default currencies to EUR.
  3. Set API pubkey and secret key to the publicly available keys (You don't need to set the webhook key for local testing BCS that's the default)
  4. Run OC Product recipes
  5. Set TestProduct currency to EUR
  6. Run stripe listen --forward-to https://localhost:5001/stripe-webhook.
  7. When you add the product to the cart then you checkout you should already see these:
    image
    When you select a bank redirect method (e.g. iDeal) you should get this:
    image
    When the payment succeeds you should get these two:
    image

@sarahelsaig
Copy link
Contributor

sarahelsaig commented Dec 23, 2022

  1. Nothing shows up in my console when I click checkout. EDIT: the logs start to appear once I use the publishable and secret keys from the my stripe dev account (here). However the HTTP statuses are 400 instead of 200. The dev workflow is still not clear, please elaborate the documentation.
    image

  2. Is switching to EUR actually necessary? If yes, please explain why in the readme. Also I please update the Stripe setup instructions there.

  3. I did a new setup and then after the first try I keep getting this error. It seems to generate the same payment intent over and over, even after I clear my cart or change the shipping and billing address.
    image

// This is a default test Stripe CLI webhook secret for testing your endpoint locally. It can be shown, as this is
// the same always for testing in Stripe.
private const string LocalEndPointSecret =
"whsec_453d1046fc31377b7a93e82b839c9e6e065d7117b6e02422e55eac99da087463";
Copy link
Contributor

@sarahelsaig sarahelsaig Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this secret come from? I can't find it anywhere in the documentations and when I run stripe it shows a different secret. Please include a source link in the comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so it might have been a generated local test key for me as well. It's coming from here:
https://dashboard.stripe.com/test/webhooks/create?endpoint_location=local

@sarahelsaig
Copy link
Contributor

Since your latest changes, now checkout doesn't get stuck any more. 👍

@sarahelsaig sarahelsaig merged commit 11410c9 into main Dec 23, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants