adding credit card option function in smart contract for minting NFT - solidity

I'm looking into adding a function to allow payments by cc during mint. Has anyone done this successfully and is willing to share how you went about it? Thanks!

The only way for doing this is after user paying you need to make the minting from your server and transfer it to the user or mint it directly to the user wallet

Related

Can I send cash tips in React Native using Stripe

I have a React Native app that has 2 types of end users. I would like User-A to be able to send cash tips to User-B. I also want the business to be able to retain a % of each tip as a convenience fee.
What is the best way to implement this?
I have Stripe in mind but I don't want to inconvenience User-A by having him make 2 transactions. I would prefer the tip go to the business account first, then from there, my preference is to have the code automatically and programmatically send the relevant funds to User-B. If not, then have User-B manually withdraw his tips. But I have no idea how to go about this. Is Stripe is even the best solution?
Any ideas are much appreciated.
PS: This must be a common use case. Why is it so hard?
This is a use-case for Stripe Connect. In order for User B to receive funds, they'll need a Stripe Connect Account. For someone to receive payment, their identity will need to be verified, so that is why they'll need a Connect account. The flow you are describing is a Destination Charge, which works with Express and Custom Connect account types. This shouldn't affect your React Native code much. The main difference, as you can see from the Destination Charge link I provided, is that you'll need to specify transfer_data[destination] when you create the Payment Intent on your server.

How do I modify my smart contract code so I'm the only one who can sell tokens? Everyone else send their tokens to me to exchange for either ETH, etc

So I have a token that has about 103 users. What I need to do is restrict the ability to sell those tokens to just myself the developer, so the other users can redeem their tokens for ETH or MATIC by sending to me. The alternative would be to just write a new smart contract, including this function and moving all users to the new platform. How would I write that new contract?
The first, you can't change code of deployed contract in Ethereum.
The second, look at ERC-20 and ERC-721 (NFT) standarts, its already have functionality you need.

Verify user is owner of an NFT via MetaMask connection? Make sure connected users public eth address is the same as of the NFT?

I need to verify on my own domain/server the user which has connected his MetaMask wallet is the owner of a specific NFT in order to allow him special functions? Basically, I want to give the user access to an area that only the owner of this NFS would have.
My original NFT is sold in opensea but I can't use the opensea hidden-area option to just give the user a hidden password since the next owner (after reselling) and the old owner would have the same password and old owners could still access like this. But I need that only the current owner has access.
My user/visiter can already connect with MetaMask at my own domain and I get the public ETH address of the active account but since this is only javascript and my backend is PHP I can't just post the MetaMask info to my PHP backend since this would be easy to trick/hack.
How can I make sure the current connected MetaMask Account is the same as the NFT owner (which I know) and allow to access a URL only for this user?
My current state is that the user connects his MetaMask and I use opensea API to check who is currently the owner of the NFT. I can compare both eth addresses but the flaw in this is obviously that I use ajax to send the MetaMask public address to my backend which is only for testing since this is of course zero save!
Thank you in advance for any idea, help, tip I can get.
PS: My backend is PHP
After hours and days of researching, I found a solution that works for me.
Here are the needed steps.
Use the MetaMask API to let the user connect with your site. This is pretty easy and good explained in the MetaMask API.
Once you want to verify the MetaMask owner is the legit owner of an NFT you need first query OpenSea (or another place) the current owner of the NFT. In my case, I use the OpenSea API for my specific NFTs. Once you got the owner you are ready to verify.
On your site you need to ask the user to sign a custom message with MetaMask. There are different options to do that. More about this here: MetaMask Signing. I send for example a short text message with a unique code that I first created in my PHP Backend. Doing that I also save the code and custom message into my MySQL.
Once the user has signed you get the signing code which you can send back to your PHP backend via ajax etc. without a problem. Only the owner of the Account which you requested in the signing code is able to sign with the correct account.
Once you got the signing code in your PHP Backend you can use Fast Elliptic Curve Cryptography in PHP and php-ecrecover to check the code against the unique code you created before and the message the user signed. As a response, you get the Signer Account ETH Address and you are ready to compare. If the Signers ETH Address is the same as the NFT owner you are ready to go and you can consider the signer the owner of the NFT.
I believe this is safe to use but I am not an expert on that. In my case, this only authorize an NFT owner for a certain closed area in my community page and there are not really high risks involved but maybe somebody raises some security thoughts on that. However, I found that other NFT pages and even Opensea work similarly.
I hope this points someone in the right direction, I lost quite some time figuring this out because most solutions are Node.js etc. but not with PHP backends.

PayPal MassPay API

I just bought a script with the Masspay API needed to make an authorized payment at a specific time the "deal" ends.
With that said I am unclear why mass pay would need to be enabled for this feature.
If someone could please explain what Masspay is? And I have been reading that masspay is no longer availabe and I would have to contact paypal directly? Is this true for the sandbox accounts also?
If anyone has any information on this subject I am more than thankful.
Thanks.
If I understand your correctly,
Mass Payment is used for sending money.
If you are the merchant with record (you ship items and charge customers), then PayPal Express Checkout is what you want. You can DoAuthorization to hold the fund before you ship the item, and then DoCapture to collect payment after you shipped.
In you are part of the service provider, say you and another merchant both provide the service and own the payment from customer, then Adaptive Payment is what you need. You need call Pay after you shipped.
In simple terms Masspay allows you to make multiple payments to multiple people in a single shot using xls or csv files.
No, paypal is not sun-setting Masspay. This feature is still available and will be supported by Paypal.

PayPal. Charge a security deposit

I was wondering If I could charge a "security deposit" using PayPal ?
On my site, user can pay for an item (service). But I have no idea, how to charge a security deposit, because it is NOT guaranteed that user will pay using his PayPal account - That way I could simply use MassPay API to refund the deposit back to the user (payer_email).
But, PayPal allows to pay even without creating an account. Although, user has to specify his email address, I'm not sure that sending back money to this email address would put the money on related credit/debit card.
Is there some API for doing this ? Because charging price for the item + security deposit doesn't feel right for me.
I know that, for example, airbnb.com has some similair functionality for that one, but I don't know how it works
I would be very grateful if someone helped me with that one.
Thank you!
It sounds like your primary issue is that users can checkout without a PayPal account. If that's the case, this can easily be solved by disabling the "PayPal Account Optional" feature in your PayPal profile under Website Payment Preferences. This will causes users to either sign in to PayPal or create an account to pay.
If you'd rather leave that option enabled there are plenty of ways to handle security deposits and returning money, each with their own advantages and disadvantages. I won't get into all those details yet, though, if simply disabling that option solves your issue.
Let me know if you want more info on the other options.