Skip to content

Crossmint Embedded Checkout #437

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

Merged
merged 25 commits into from
Oct 4, 2024

Conversation

XDapps
Copy link
Contributor

@XDapps XDapps commented Sep 30, 2024

Ticket

Updated keysale checkout page to allow users to pay with a credit card using crossmint.

Added variables to the config file for crossmint projectId & collectionId. These need to be updated with production values.

Testing, deployed to Sepolia develop and tested by confirming successful transactions using the test credit card credentials.

Update: Needs PR#443 merged in to this before this is merged.

@@ -31,6 +31,8 @@ export let config = {
"subgraphEndpoint": "https://subgraph.satsuma-prod.com/f37507ea64fb/xai/sentry/api",
"publicRPC": "https://arb1.arbitrum.io/rpc",
"alchemyApiKey": "oD4X3JXvJclnt36mDkqnp9CO2sZkNhYT",
"crossmintProjectId": "", //TODO Add Production Values
Copy link
Contributor Author

@XDapps XDapps Sep 30, 2024

Choose a reason for hiding this comment

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

I created a chore to add these production values once determined.

@XDapps XDapps marked this pull request as ready for review September 30, 2024 15:57
@@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a env file for web-connect ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've now added a sample.env for reference.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It does not make sense to have VITE_APP_ENV in an .env file. We need to set it on build time, web-connect is statically build, so there is no runtime making use of the .env file. Then, if its in a file we would have to write that file in the build pipeline but we would rather just incejt the environment variable at build step.

Please let me know if that makes sense, then remove the sample.env please.

It would make sense to write a readme that explains why and when this env variable is important to be added and what its used for.

Copy link
Contributor Author

@XDapps XDapps Oct 2, 2024

Choose a reason for hiding this comment

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

Thank you for the feedback.

How should this below work in a local development environment for the app to know if it is in production or staging?

const environment = process.env.VITE_APP_ENV === 'development' ? 'staging' : 'production';

I was going off our previous Slack convo where you gave me this variable name to use for this purpose.

Vite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per our Slack conversation. .env file added for local development.

ReadMe updated to inform devs.


const projectId = config.crossmintProjectId;
const collectionId = config.crossmintCollectionId;
const environment = process.env.VITE_APP_ENV === 'production' ? 'production' : 'staging';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make it so its production by default and staging only when the env is set to development.
We don't want to have an error in setting the env lead to the production site being on crossmint staging this could have terrible consequences.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

case "payment:process.succeeded":
setOrderIdentifier(event.payload.orderIdentifier);
break;
default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need the default here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, thank you for the guidance!

case "transaction:fulfillment.failed":
setStatus("failure");
break;
default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets not have empty defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, thank you for the guidance!

<a
target="_blank"
className="block bg-[#81feab] rounded-lg mt-3 p-3 text-black"
href={`https://staging.crossmint.com/user/collection/polygon-amoy:${result?.contractAddress}:${result?.tokenIds[0]}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this link the right one ?
polygon-amoy: seems to be some other testnet ?

Copy link
Contributor Author

@XDapps XDapps Oct 1, 2024

Choose a reason for hiding this comment

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

This has been corrected, thank you! Also, just FYI, when I tested before the change, that link did still open up the crossmint website and the key was visible in the wallet.

pnpm-lock.yaml Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

You will want to get the one from fb-tiny-keys, then reinstall your new package and then push the new lock file. Do not merge the lock files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@XDapps XDapps requested a review from CryptITAustria October 1, 2024 21:48
@@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
.env
Copy link
Collaborator

Choose a reason for hiding this comment

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

It does not make sense to have VITE_APP_ENV in an .env file. We need to set it on build time, web-connect is statically build, so there is no runtime making use of the .env file. Then, if its in a file we would have to write that file in the build pipeline but we would rather just incejt the environment variable at build step.

Please let me know if that makes sense, then remove the sample.env please.

It would make sense to write a readme that explains why and when this env variable is important to be added and what its used for.

<a
target="_blank"
className="block bg-[#81feab] rounded-lg mt-3 p-3 text-black"
href={`https://staging.crossmint.com/user/collection/arbitrum-sepolia:${result?.contractAddress}:${result?.tokenIds[0]}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can't be arbitrum-sepolia in production right ?
If its does not make any difference, then lets make it arbitrum for all environments or make that part conditional depending on the APP_ENV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been updated to use the env var to determine the network to use.

@XDapps XDapps requested a review from CryptITAustria October 3, 2024 19:13
@XDapps XDapps marked this pull request as draft October 4, 2024 02:30
@XDapps XDapps marked this pull request as ready for review October 4, 2024 02:35

## ENV

To run locally with development configs, a .env file is required. See sample.env for an example.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a line about what environment and why its needed. Or add it to the sample.env

Copy link
Collaborator

@CryptITAustria CryptITAustria left a comment

Choose a reason for hiding this comment

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

I need this to be merged so I will approve, @XDapps still has to make sure the react fix for putting the crossmint status into a useEffect works properly.

@CryptITAustria CryptITAustria merged commit 22a3e6c into fb-tiny-keys Oct 4, 2024
6 checks passed
@CryptITAustria CryptITAustria deleted the feat/jh/tk/crossmint-embedded-checkout branch October 4, 2024 15:52
Copy link
Contributor

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants