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

docs: snowpack example #6

Merged
merged 1 commit into from
May 20, 2021
Merged

docs: snowpack example #6

merged 1 commit into from
May 20, 2021

Conversation

maxbeatty
Copy link
Contributor

adds a simple card payment example using snowpack

@maxbeatty maxbeatty added the documentation Improvements or additions to documentation label Mar 25, 2021
@maxbeatty maxbeatty requested a review from a team as a code owner March 25, 2021 03:46

async function start() {
const payments = await Square.payments(applicationId, locationId);
const card = await payments.card();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some sort of error handling for the await statements. I think it is very important that we add it for the tokenize call.

const locationId = 'LKYXSPGPXK05M';

async function start() {
const payments = await Square.payments(applicationId, locationId);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Square.payments is not asyc.

Choose a reason for hiding this comment

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

Keep in mind this is web-sdk, the WebPaySDK wrapper, not the underlying SDK itself. But maybe it's a little confusing that the method names are the same, but the signatures are not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's some disconnect because of how we're handling loading on behalf of the developer. perhaps examples would be clearer using an import like import { payments } but still unclear how much overlap there'll be in audiences.

Copy link
Contributor

Choose a reason for hiding this comment

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

I missed this conversation, and see that we are doing this as Square.payments here actually loads the script. I will give some thought into how we can possibly rectify the web-sdk package vs the underlying SDK, but this should be fine for right now.

const payments = await Square.payments(applicationId, locationId);
const card = await payments.card();

card.attach('#card');
Copy link
Contributor

Choose a reason for hiding this comment

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

however attach is async.

@maxbeatty maxbeatty merged commit 39fd900 into beta May 20, 2021
@maxbeatty maxbeatty deleted the example-snowpack branch May 20, 2021 19:13
@github-actions
Copy link

github-actions bot commented Jun 4, 2021

🎉 This PR is included in version 1.0.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

maxbeatty pushed a commit that referenced this pull request Jun 16, 2021
* beta:
  feat(payments): upgrade Web Payments SDK to v1 (#10)
  chore(deps): bump @babel/preset-typescript from 7.12.17 to 7.14.5 (#16)
  chore(deps): bump @types/jest from 26.0.20 to 26.0.23 (#15)
  chore(deps): bump @babel/core from 7.12.17 to 7.14.5 (#12)
  ci: add @codecov (#9)
  chore(deps): add @dependabot (#8)
  ci: add code scanning action (#7)
  feat: add typings, and ability to import typings, to package (#11)
  docs: snowpack example (#6)
  docs: release process + script to automate (#5)
@github-actions
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation released on @beta released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants