dashed-slug.net › Forums › General discussion › deposit UI help
Tagged: development, invoice
- This topic has 2 replies, 2 voices, and was last updated 2 years, 10 months ago by alexg.
-
AuthorPosts
-
February 9, 2022 at 12:03 am #11439AnonymousInactive
I just really want to use the qr code if possible.
I have done something like this:
https://pastebin.com/F93AxLs9 (it wouldn’t let me post the code)
is there another way to just get the qr code ?
no matter what we do to do a invoice we cant get the deposit address the one of our “central bank” … coinpayments just sends us a different deposit address, and while it could be the same wallet we are unsure.
we did using php and curl, using their api. NOT your plugin and this is what happens each time. we uploaded a pic so you can see what we mean
so we thought to use your plugin and create our own invoice set up.
Attachments:
You must be logged in to view attached files.February 9, 2022 at 3:18 am #11443AnonymousInactiveso for now I’m using the JavaScript to make some UI changes and having for now just being deposited into the users address. Reason #1 I know at least there is an alert via email thru your plugin
what is best method to check to see when a deposit has actually landed?
Is the only way to do a notification via email? I would also like to do one programmatically so I know that the “invoice” was paid.
the other method allowed me to add a “invoiceID” to check later to see if it was updated. but i dont think i have a option in your plugin to send any extra data so i can ping that DB row looking to see the status.
Im trying to save ppl refreshing page every minute
Attachments:
You must be logged in to view attached files.February 9, 2022 at 8:35 am #11446alexgKeymasterHello,
It looks like you are trying to create a whole plugin from scratch to process invoices. This is not something that the plugin does. I can’t guide your entire development effort for a new plugin. For that you probably need to create a different plugin. That includes doing the analysis and design, and choosing the appropriate technologies and architecture.
I can try to give you some pointers:
The code you posted is kinda wrong because it tries to read data from the wallets plugin via the browser’s DOM. You will likely encounter race conditions, where the data is not there at the time you are reading it. IF you wanted to read the user data, you should be using the
get_coins_info
call from JSON-API. BUT you probably don’t want to do this. You are trying to read addresses that YOUR code has generated, not the addresses that the wallets plugin has assigned to the users. So you must pass the data to the frontend in some other way.To do deposits to CoinPayments independently from the plugin, you must do a call to GetDepositAddress. This will give you back an address that belongs to your CP wallet and that will notify you whenever there is a deposit via IPN.
You must keep track of these addresses that you generate. This will probably be in the DB. It’s up to you how to store it, but don’t use the plugin’s tables. You can create your own custom SQL tables or use Custom Post Types, or even store the addresses in options, user meta, etc depending on your design.
Once you know which addresses you have generated, you can hook into an action such as
init
orparse_request
to listen for incoming IPNs. Since you will only be processing addresses that you know are generated with your plugin, these will not interfere with the existing IPN handler of the wallets plugin. You can then detect invoice payments and notify your users via email or any other way you see fit.The wallets plugin uses the JSON-API (and the upcoming WP-REST API) for communication between frontend and backend. It then uses frontend javascript to create the qr code. Whether your plugin renders your address as a qrcode in the frontend or backend is up to you.
In summary: If you are trying to create invoices, this is a different plugin. The wallets plugin as it is now, cannot be extended to accept invoices. You must create a different plugin from scratch. Think about your requirements, do an analysis, and you will see that it is not appropriate to extend this plugin for your use case.
I’m really sorry for being so negative, but it doesn’t look like I can help you more with this. It really sounds like someone who studied business, not engineering, gave you the task of adapting the plugin for a totally different technical requirement. You should get back to them and tell them that the decision of which software to use to achieve a business requirement, is a technical decision, and must be done by an engineer.
Best of luck with your project.
with regards
-
AuthorPosts
- You must be logged in to reply to this topic.