Discussing APIs and development related to customers, discounts, and order management.
Hi,
Please help me to review issue paid by customer: $0.00 as summarized below:
- Created private app on store Shopify
- Follow by API create order on Shopify ,
- Call API to create order
curl -X POST 'https://{app_key}:{password}@{store}.myshopify.com/admin/api/2020-07/orders.json' \
-H 'Content-Type: application/json' \
-d '{
"order": {
"line_items": [
{
"variant_id": 123,
"quantity": 1
}
],
"customer": {
"email":"customer_email"
},
"financial_status": "paid"
}
}'
- Created order. Login to store and view order detail. But I see Paid by customer: $0.00
I don't know this reason.
Please help me to review it.
Thanks for your advice!
VinhLe
Hi,
I research and find reason for Paid by customer: $0.00. Create order must add transaction value. Example
curl -X POST 'https://{app_key}:{password}@{store}.myshopify.com/admin/api/2020-07/orders.json' \
-H 'Content-Type: application/json' \
-d '{
"order": {
"line_items": [
{
"variant_id": 123,
"quantity": 1
}
],
"customer": {
"email":"customer_email"
},
"financial_status": "paid",
"transactions": [
{
"kind": "capture",
"status": "success",
"currency": "USD",
"gateway": "manual",
"amount": 13.00
}
]
}
}'
transactions -> amount for total_price of order.
If we don't total_price for order to add in transactions.
We can created order without transactions. After order created. Call api to add transaction to order by API:
Example:
"transactions": {
"kind": "capture",
"status": "success",
"currency": "USD",
"gateway": "manual",
"amount": 13.00,
"source": "external"
}
Required: "source": "external" to fixed issue: transaction invalid. You can find issue on url
Thanks!
It doesn't work for me.
Are missing something else?