Vaibhav
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] woocommerce_rest_cannot_create_order_refundHello Shameem (woo-hc) ,
Thank you for your reply. I am using the same code for refund, what you shared. Below is the sample of it.
//To get order id fromm request const orderId: any = req.body?.OrderId; const refundData = { amount: '1.00', // The amount to be refunded reason: 'Customer requested a refund', // The reason for the refund }; //Verify order ID before calling Refund API if(orderId) { const response = await WooCommerce.post(orders/${orderId}/refunds, refundData); if(response){ res.status(200).json(response.data); //return response.data; } }else { res.status(200).json({ message:Order Id not passed, please verify}); } }Also, I am not looking for code customization, I am checking is any one having same issue in past or not and that will be helpfull.
Thank you for your valuable inputs and throught.
Thank You,
Forum: Plugins
In reply to: [WooCommerce] woocommerce_rest_cannot_create_order_refundHello Shameem (woo-hc);
Thank you for your valuable inputs. I am using same order API of which url you shared, still causing an issue of refund on same order. Will look more in details and post if found anything. Below is sample code of order creation, please have a look and suggest if have any thing suspected in it.
const orderData = { payment_method: 'bacs', // Payment method payment_method_title: 'Direct Bank Transfer', // Payment method title set_paid: true, // Set to true to mark the order as paid billing: { first_name: 'Vaibhav', last_name: 'Bhutkar', address_1: '123 Main Street', city: 'Pune', state: 'Maharashtra', postcode: '411028', country: 'India', email: '', phone: '123-456-7890', }, shipping: { first_name: 'Vaibhav', last_name: 'Bhutkar', address_1: '456 Shipping Street', city: 'Pune', state: 'Maharashtra', postcode: '411028', country: 'India', }, line_items: [ { product_id: 78011, // Replace with the actual product ID quantity: 1, }, // Add more line items as needed ], }; const response = await WooCommerce.post("orders", orderData); if(response){ res.status(200).json(response.data); //return response.data; }Able to place order successfully, however if aply reund on same getting the above error.
Thank you,
Vaibhav Bhutkar
Hello Saif (woo-hc),
Thank you for your response. I am using create order API from WooCommerce. Refer url shared for used API
https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order
Also, Sharing stripe credit card details while creating order through API for payment however; payment link is not visible at WooCoomerce order page. I have used the order creation code as mentioned at API End point (Url Shared Above). Can you please guide me for creation of order using WooCommerce API along with payment.
I am using node Js with typescript to give API calls. Thank you in advance. If you wanted to see my code, I will share as well.
Thank You,
Vaibhav Bhutkar
- This reply was modified 2 years, 9 months ago by Vaibhav.