Not able to post some fields using createDraftListing API - php

We have implemented the createDraftListing API using this documentation to create new listing on etsy.
But we are not able to post below field using above API because in documentation request parameter this field are not present.
Also we have added the item weight, item length, item width and item height in request feed and posting this value to above api call but still showing blank on products.
Request feed:
{
"title": "this is my title",
"description": "this is my description",
"quantity": "100",
"state": "active",
"price": 44.55,
"who_made": "collective",
"when_made": "2020_2022",
"listing_type": "physical",
"shipping_profile_id": 12345678,
"processing_min": 1,
"processing_max": 1,
"item_weight": "0.71",
"item_weight_unit": "lb",
"item_length": 5.5,
"item_width": "7.5",
"item_height": 0.75,
"item_dimensions_unit": "in",
"has_variations": false,
"language": "en-US",
"is_taxable": true,
"should_auto_renew": true,
"is_customizable": true,
"is_personalizable": true,
"personalization_is_required": true,
"personalization_char_count_max": 1,
"personalization_instructions": "",
"taxonomy_id": 2279
}
So please let us know any api to post above fields to etsy?
Thanks.

first you can get id shipping profile id in get shipping profile api. I try and success

Related

woocommerce_rest_cart_invalid_key : Cart item does not exist

I'm implementing WooCommerce on App through StoreApi https://developer.woocommerce.com/2022/03/25/store-api-is-now-considered-stable/. I can easily access Cart against logged in user through JWT. I believe there is some issue with /wp-json/wc/store/v1/cart/update-item where I'm using the item key from "items": [ { "key": "b5d5251068629b801eb58fcc745120db", "id": 55774, "quantity": 2, "quantity_limits": { "minimum": 1, "maximum": 45, "multiple_of": 1, "editable": true }] which is response got from /wp-json/wc/store/v1/cart/. but I'm receiving cart item does not exist which in fact exist. from Browser I can update item with no issue.

Not able to post some fields value using createDraftListing API

We have implemented the createDraftListing API using this documentation to create new listing on etsy.
But we are not able to post below field using above API because in documentation request parameter this field are not present.
Also we have added the item weight, item length, item width and item height in request feed and posting this
value to above api call but still showing blank on products.
Product link
Request feed:
{
"title": "ArttoFrames Rustic Custom Picture Poster Frame 1 Wide 1343",
"description": "In a beautiful turqoise, this barnwood frame is the perfect accent to transform a room into a unique decorative space. Hang a few to create an edgy gallery wall or give it to a loved one as a housewarming or baby shower gift. Perfect in a children's room or in an airy living space.",
"quantity": "100",
"state": "active",
"price": 44.55,
"who_made": "collective",
"when_made": "2020_2022",
"listing_type": "physical",
"shipping_profile_id": 165973438594,
"processing_min": 1,
"processing_max": 1,
"item_weight": "0.71",
"item_weight_unit": "lb",
"item_length": 5.5,
"item_width": "7.5",
"item_height": 0.75,
"item_dimensions_unit": "in",
"has_variations": false,
"language": "en-US",
"is_taxable": true,
"should_auto_renew": true,
"is_customizable": true,
"is_personalizable": true,
"personalization_is_required": true,
"personalization_char_count_max": 1,
"personalization_instructions": "",
"taxonomy_id": 2279
}
How to post above fields to etsy?

Woocommerce Rest API issue with stock quantity

I create Woocommerce products in my ionic app. I would like also to push the stock quantity when I create the product. However, the stock always is with NULL stored in my MYSQL DB. Here is the JSON feed
{
"product": {
"title": "test stock",
"stock_quantity": "35",
"images": [],
"post_author": 88,
"type": "simple",
"categories": []
}
}:
And here the piece of code from the app
var productInfo = {
title: this.productName,
regular_price: this.productPrice,
sale_price: this.productDiscount,
stock_quantity: this.productStock,
description: this.productDesc,
images: new Array<any>(),
post_author: this.userService.id,
type: this.productType,
categories: new Array<any>()
};
I tried different tags for stock_quantity like only "stock" and tried to push the variable with "" and without it. But I'm facing still the same issue.
Your JSON syntax is correct. Also, you are passing the correct parameter for the stock as stock_quantity and as I reviewed your JSON request you have not passed the manage_stock parameter as true by default that considers as false. so, you need to pass that parameter also.
You can try the following code.
{
"product": {
"title": "test stock",
"stock_quantity": "35",
"manage_stock": true,
"images": [],
"post_author": 88,
"type": "simple",
"categories": []
}
}:
you can refere the WooCommerce REST API Product Properties for create products

Not able to place the order using paypal in magento 2 rest

I am developing an e-commerce mobiloe application using magento 2 rest apis only.This is the flow for making the REST API calls for order placement.
1.Create a cart
api -->{{url}}/index.php/rest/V1/carts/mine
This api will return a unique cart id
2.Add products to cart
api --> {{url}}/index.php/rest/V1/carts/mine/items
body ->
{
"cart_item": {
"quote_id": cartId,
"sku": skuName,
"qty": 1
}
}
3. Estimate Shipping Methods
url --> {{url}}/index.php/rest/V1/carts/mine/estimate-shipping-methods
body ->
{
"address": {
"region": "Trivandrum",
"region_id": 12,
"region_code": "CA",
"country_id": "IN",
"street": [
"Amstor house",
"Eramam"
],
"telephone": "5656565454",
"postcode": "670390",
"city": "Kazhakuttam",
"firstname": "Peter",
"lastname": "K",
"same_as_billing": 0,
"save_in_address_book": 0
}
}
This will return all possible shipping methods based on shipping address.In my case the result is
[
{
"carrier_code": "freeshipping",
"method_code": "freeshipping",
"carrier_title": "Free Shipping",
"method_title": "Free",
"amount": 0,
"base_amount": 0,
"available": true,
"error_message": "",
"price_excl_tax": 0,
"price_incl_tax": 0
}
]
4)Save shipping information
url --> {{url}}/index.php/rest/V1/carts/mine/shipping-information
body data ->
{
"addressInformation": {
"shipping_address": {
"region": "Trivandrum",
"region_id": 12,
"region_code": "CA",
"country_id": "IN",
"street": [
"Amstor house",
"Eramam"
],
"telephone": "5656565454",
"postcode": "670390",
"city": "Kazhakuttam",
"firstname": "Peter",
"lastname": "K",
},
"billing_address": {
"region": "Trivandrum",
"region_id": 12,
"region_code": "CA",
"country_id": "IN",
"street": [
"Amstor house",
"Eramam"
],
"telephone": "5656565454",
"postcode": "670390",
"city": "Kazhakuttam",
"firstname": "Peter",
"lastname": "K",
},
"shipping_method_code": "freeshipping",
"shipping_carrier_code": "freeshipping"
}
}
This will return all possible payment methods. Here i am using paypal_express for payment.
5. Payment using paypal plugin
Here i will pay the amount using paypal cordova plugin.Also configured the IPN [{{url}}/paypal/ipn/]in paypal account
This api will return the following data,
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.14.4",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2016-11-19T05:25:46Z",
"id": "PAY-5VS11410F5341972MLAX6ETA",
"intent": "sale",
"state": "approved"
},
"response_type": "payment"
}
5.Save payment and place order
url --> {{url}}/index.php/rest/V1/carts/mine/payment-information
data ->
{
"cartId": 3,
"billingAddress‌​": {
"region": "Trivandrum",
"region_id": 12,
"region_code": "CA",
"country_id": "IN",
"street": [
"Amstor house",
"Eramam"
],
"telephone": "5656565454",
"postcode": "670390",
"city": "Kazhakuttam",
"firstname": "Peter",
"lastname": "K"
},
"paymentMethod": {
"method": "paypal_express"
}
}
But this api will returning
{
"message": "PayPal gateway has rejected request. Invalid token (#10410: Invalid token)."
}
Is there any api missing in the above flow for capturing payments.Please help me.
Paypal Express payment method doesn't support online capturing. There is no way to get a full order creation flow like on Checkout via Magento API interface. It is impossible to change the order state and process payments. As a workaround try the following:
Create a custom payment method
Enable for REST API only(Not on website checkout page)
While making payment using rest api use this method (after successful payment using you android/ios SDK)
After placing the order make send transaction id(PAY-xxxxx) return by paypal sdk payment to save trasaction.(tell your server side tio implement this call).
I am writting a complete atrticle regarding this step by step. I will let you know when it is done.
Place Order by PayPal Rest API
For the Place order by the Paypal rest API, you need an active cart with shipping and billing address
By default, we need to follow the few setups for placing the order
• Step 1. Create an empty cart
• Step 2. Add products to the cart
• Step 3. Set the shipping address
• Step 4. Set billing address
• Step 5. Set the delivery method
• Step 6. Apply a coupon (if you have)
• Step 7. Set the payment method
• Step 8. Place order
After steps 6 follow below APIs
We need to call the below APIs one by one for placing the order with Paypal
Create Paypal Express Token
URL : {you website
url}/rest/default/V1/paypalapi/createpaypalexpresstoken
Method: POST
Set Bearer Token in the Hearer (if customer ) for the guest user no need to set it
Content-type : JSON
Body For guest users:
{
"cart_id":"5QWFYZdyccucvgD2QMLDCp5fhjmaH2xg",
"cancel_url":"cancel_url",
"return_url":"return_url"
}
Body For Customer user:
{
"cart_id": 22,
"cancel_url": "cancel_url",
"return_url": "return_url"
}
You will get the response like this :
[
{
"code": 200,
"token": "EC-4MD50688YD296870K",
"paypal_urls":{
"start": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4MD50688YD296870K&useraction=commit",
"edit": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=continue&token=EC-4MD50688YD296870K"
}
}]
Explanation
you need to redirect the customer to the {start URL } and after making the payment, PayPal will redirect the user with two params in the redirect URL "payer_id" and "token" Both values you need to call in the below API
Set Payment Method On Cart
URL : {you website
url}/rest/default/V1/paypalapi/setpaymentmethodoncart
Method: POST
Set Bearer Token in the Hearer (if customer ) for the guest user no
need to set it
Content-type : JSON
Body For guest users:
{
"cart_id": "5QWFYZdyccucvgD2QMLDCp5fhjmaH2xg",
"payer_id": "9T3GV67ZSL378",
"token": "EC-4MD50688YD296870K",
"payment_method": "paypal_express"
}
Body For Customer user:
{
"cart_id": 22,
"payer_id": "9T3GV67ZSL378",
"token": "EC-4MD50688YD296870K",
"payment_method": "paypal_express",
"customer_id": 141
}
You will get the response like this :
[
{
"code": 200,
"selected_payment_method": {
"code": "paypal_express",
"title": "PayPal Express Checkout"
}
}
]
Place Order
URL : {you website url}/rest/default/V1/paypalapi/placeorder
Method: POST
Set Bearer Token in the Hearer (if customer ) for the guest user no
need to set it
Content-type : JSON
Body For guest users:
{ "cart_id": "5QWFYZdyccucvgD2QMLDCp5fhjmaH2xg" }
Body For Customer user:
{ "cart_id": 22, "customer_id": 141 }
You will get the response like this :
[ { "code": 200, "order_number": 000000142 } ]
Here is the link to the Paypal Rest API module
https://github.com/santosh-gaggle/paypal-rest-api
In case someone still looking the solution.
In the time I'm answering this, You will need to create a Magento 2 module to process the payment ID.
After you receive the response from in example Paypal android SDK.
Below is the JSON format that you can send to Magento endpoint :
for logged user : PUT /V1/carts/mine/order
for guest : PUT /V1/guest-carts/:cartId/order
Referrence : http://devdocs.magento.com/swagger
The "paypal_express_payment_payload" is just a custom attribute to hold the paypal payment response previously from android SDK.
{
"paymentMethod": {
"method": "paypal_express",
"additional_data": {
"paypal_express_payment_payload": "{\"create_time\":\"2017-06-15T23:13:52Z\",\"id\":\"PAY-2LB41725NU654612TLFBRIUQ\",\"intent\":\"sale\",\"state\":\"approved\"}"
}
}
}
To process the "paypal_express_payment_payload" data, you can implement a Interceptor in your Magento 2 module :
di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Paypal\Model\Express">
<plugin name="mymodule_magento_paypal_model_express_plugin"
type="Mycompanyorpersonal\Mymodule\Plugin\Paypal\Model\Express"
sortOrder="99999"
disabled="false" />
</type>
</config>
Mycompanyorpersonal\Mymodule\Plugin\Paypal\Model\Express.php
You can find the full PHP codes in my following gist : https://gist.github.com/feelinc/de817030e00adc7ff7001de1807c1835
If you use the below to run a post query replace runPostQuery with your curl request. this will pass a token that already has been successful to magento 2.
$payment['paymentMethod'] = ['method' =>'paypal_express',
'additional_data' => array (
'paypal_express_checkout_token' => $request->query->get('token'),
'paypal_express_checkout_redirect_required' => false,
'paypal_express_checkout_payer_id' => $request->query->get('PayerID')
)];
$completedPayment = $this->runPostQuery('carts/mine/payment-information', $headers, json_encode($payment));
You will need to create a plugin to add the last transaction id to the payment see the above comment, but the above payload to payment-information will allow you to get past _placeOrder function in Paypal\Model\Express.php
The paypal_express_checkout_token is the token passed back to the browser from paypal same as PayerId this allows to check the payment, which will return successful and not require a redirect, but is not the payment reference just the action token.

Docusign not displaying tabLabels but names instead

I'm using Docusign's REST API for creating template and sending it to the customer to sign it - everything works fine but the template doesn't display the labels of the tabs (textTabs), there are their names showed only
I'm sending everything in an evelope, an item looks like this:
"textTabs": [
{
"anchorString": "app_contractbundle_contract_masterAgreement_salesforceId",
"anchorUnits": "pixels",
"anchorXOffset": 105,
"anchorYOffset": -3,
"documentId": 1,
"name": "masterAgreement_salesforceId", - this is displayed in the template
"pageNumber": null,
"xPosition": 0,
"yPosition": 0,
"tabLabel": "Salesforce ID", - this should be displayed
"value": null,
"fontSize": null,
"locked": true,
"required": true
},
Thanks!
It's not documented well in the API docs but the name property is what's used for the help tip on tabs, not the tabLabel. Either switch your values or just set the name to the same thing as your tabLabel.

Categories