WooCommerce Bookings - make a booking via API - node.js

I'm creating a headless WooCommerce application and I need to create a booking for a bookable product via an API request in Node.
Woo bookings shows this on their docs - essentially it says don't use - then I raised a ticket with the Store API team here - the answer appears to suggest we add the data ourselves, that's not good as we're then running a custom version of Woo.
Does anyone know how I can make a booking in WooCommerce via an API endpoint? It must have SOME kind of API or the frontend wouldn't work?!? It's handy to have because it means the customer runs what they've always run and get all the nice stuff like reminder texts and emails for their customers.

Related

How Can I fetch my customers data from my CRM and show on Twilio frontline app

I hope you are well. Thank you for Mail. I was quite busy on these days. That's why, I can't able to reach out you.
Actually, I have some questions regarding some issues. I'm working to build a system in which I can fetch the customers data from my CRM to Twilio frontline app. The half of the job is done. Like I make the okta developer account and ready for user access to Twilio frontline app. But the main issue is that I'm not able that How I can fetch the Customers Data from my CRM(Pipedrive) to Twilio frontline app to contact with customers over the app. Let me show you How I actually work on it. I'm currently working according to your blog for Twilio frontline app:
https://www.twilio.com/docs/frontline
And I'm now on this URL:
https://www.twilio.com/docs/frontline/nodejs-demo-quickstart
I'm also using Ngork and Yarn as Local Host but I'm stuck over here.
Now, I need to complete this and go forward to get customers data. I'm confused here. So, I need your help.
Now, the Questions is that How I can make a Node.js script or any other script that can fetch my CRM(Pipedrive) data and show on Twilio frontline app. I need the exact script. OR Is there is any other option that I can easily fetch the customer data.
Thank you!
Regards,
Ehtisham
I want customers data(PHone number, Whatsapp number, Email) from my CRM(Pipedrive) into frontlineapp to contact with the customers. And Also I need a feature that When I text to someone from frontline app it will also save the chat to the person's timeline.

Automatically updating Shopify inventory item quantity

I have a Shopify store with rental products. Since Shopify doesn't handle return flows, the shop is connected to an external service, were the order is sent via an API to that service, which handles finalizing the rental and tracking it.
Now here is the problem, since the procedure is finalized outside of Shopify, the products are removed when rented, but not added when returned. this makes updating the shop manual. I am currently using Pipedream to handle my Web-hooks and requests, and it provides a service to change Inventory Level, but no direct way to update Shopify inventory. I know that the only way to update quantity in by getting InventoryItemID, and the only way to get that is by using ProductVarientID. I was able to acheive that using GraphQL, but I'd have to manually quary the InventoryItemID by using the ProductVarientIDs of my return orders from an API, and then use a mutation that does bulk inventory update to get the job done, but you can see, this is hardly automated.
Any thoughts and ideas are much appreciated.
If there is a way to do it using Pipedream, that's super.

Stripe API testing automation

Background
I am integrating stripe API into my site to take one off payments. My site will be API first on server side with a separate web and mobile front end. I am working on the API server side code. I will eventually use stripe payment pages to take credit card payments. I am trying to automate the testing of my APIs and am bamboozled by the documentation (which are thorough) as I just can't see what steps to take next.
My server side initiates a call with stripe using stripe sdk to create a stripe Session object - this contains a URL to redirect to checkout.stripe.com/pay/..., a success URL when payment is successful and a cancel URL (these I set to handle the callback).
Problem
I can automate in Postman all my API calls from Browse Products, Select Product, Place Order but the next step I am stuck. After Placing Order I get back the stripe session but how can I mimick making the payment with stripe for the session and then call my Success URL ?
When the site is complete I will redirect the UI to stripe to take payments but I am testing and completing the back end flow first.
I have copied and pasted the session URL which is returned by the stripe Session object to bring up the page in a browser and used Dev tools on Chrome to inspect Network to see which APIs are being called by stripe in an attempt to reproduce and I can see a POST to stripe.com/api/payment_methods and I can see the posted values but I can't reproduce this in Postman. Also, the documentation (https://stripe.com/docs/api/payment_methods/create) says
"Instead of creating a PaymentMethod directly, we recommend using the
PaymentsIntents API to accept a payment immediately"
Question
Which stripe APIs do I need to call to automate the flow from a stripe Session object to make a payment and then check that it was successful? Payment Methods? Make a Charge? Payments Intents? ...and how. Happy to be pointed to the documentation if you can help me understand the flow.
TIA
Checkout is a Stripe product that looks like a "box" and you can't know (and shouldn't need to know) what happens inside. It is created for the purpose that merchants won't have to think about what's being done under the hood.
Speaking from an automation perspective, you can try to reproduce the whole process but there's no guarantee it won't change in the future, and it could leave you with more problems later.
For options to reproduce:
The closest way is simulating browser filling and submission, using automated browser tools (ie Selenium). But it's not as straightforward as PostMan. Generally you would want to simulate every browser action that a human could do.
Or you can try to accomplish the same with the logs and events you receive on Stripe's Dashboard, when you test a Checkout Session by yourself. From now there are 3 requests.
And your goal is to receive the same 5 events in Webhook:
TBH I recommend to reconsider the need of this test, to see if it worth your efforts.

Prismic Integration Field: Not possible to receive Shopify product metafields

I cannot fetch Shopify product metafields using Prismic Integration field via GraphQL API.
What I did:
Created a document with Integration field https://prnt.sc/11dima8
Tried to fetch the product data via GraphQL API, but product metafields are missed https://prnt.sc/11dinv1
What did I check:
The metafields can be found via Shopify GraohQL https://prnt.sc/11akxvp
Data is synced https://prnt.sc/11diq30
How can I retrieve product metafields from Shopify using Prismic Integration field? Does somebody have the same scenario? Probably some extra configurations should be done, but I'm not aware about them.
Thanks in advance!
I don't think that question is relevant anymore as only Prismic team knows about this issue, here is the topic on Prismic forum: https://community.prismic.io/t/integration-field-not-possible-to-receive-shopify-product-metafields/
Well, in fact, fetching Metadata from Shopify requires making an extra call to Shopify API that makes their API time out on the response size.
One temporary solution that we can provide for the moment is to add a link to your metadata, and you fetch them after on your side.
Having a micro-service to fetch all the data works as well, but you have to use a queue system so that if any item fails to sync due to a timeout, for example, you try several times to get it.
Also, you need to manage the authentication with Shopify API on your own.

Creating new payment method for Bigcommerce

I would like to know if this is possible to add new payment method for Bigcommerce. I tried to contact their support without any luck. If anyone is familiar with bigcommerce and know if this is possible, i would appreciate any advice.
I already read their API docs and didn't found anything useful - only method to obtain list of available payment methods.
I already tried to signup for their partner. Without any luck.
We've done this before for a couple stores to allow clients to process payments through their own processor. The way we achieved this, is essentially through the following high-level steps:
Allow payments by Check (or similar offline method). We are going to replace this with the custom processor.
You'll notice that if you attempt to checkout via Check, that BigCommerce automatically creates the order for you, but sets the order status to Awaiting Payment. Upon submission the user is automatically sent to a 'Thank You' Order Confirmation page that contains both the Order ID and some payment instructions (such as where to send the check to).
Here's the trick -- Modify this 'Order Thank You' page to prompt the user for her or his credit card information. A simple HTML form will suffice here, performing the actual request via JavaScript.
Once you have the user's credit card data, you can then POST it to your own external server, where you would connect to and send data to whichever processor you are using. Additionally, you should make sure to send the Order ID to this program, so that you can connect to the BigCommerce API to load billing information, and then subsequently adjust the order status to either approved or declined depending on the response from your processor. Finally, you should send back some sort of response to the client to inform of the result of the charge attempt.
That's pretty much it in a nutshell. The way you integrate with the payment processor (step 4) is unique to whichever processor you are using. I hope this makes sense.
Although opinion based, I'm a huge fan of serverless technologies, and would suggest looking into AWS Lambda + AWS API Gateway. The benefit here is that you don't need to worry about creating an infrastructure or the associated concerns of security and scale. Rather, AWS Lambda allows you to simply upload your software, and allows it to be executed via an HTTP request to some defined endpoint set through the API Gateway. Lambda will scale automatically for you, and you don't need to worry about system level security concerns - only security at the application level. It's truly a set and forget setup, and a bleeding edge technology. Not to mention dirt cheap!
Implementing a new payment method is unsupported and requires hacky workarounds since we implement payment gateways via the core app. You can do this on blueprint by using an offline payment method and then using the API to update payment statuses, etc. I'd recommend using ActiveMerchant if you do wish to go down this path.

Resources