I'd pay someone $100 if you can just get me to a p...
# general
t
I'd pay someone $100 if you can just get me to a point where my Sales Order will transform into a Cash Sale that appears as a payment event for the Sales Order
s
Whats the payment method your using?
t
I have one called Web Transactions I created
s
Payment method should be selected as Cash
t
Is there any way around this? I am trying to use external credit card as payment method.
@Sai Krishna thank you for that, I did try that and I got this error:
Copy code
"title": "Bad Request",
    "status": 400,
    "o:errorDetails": [
            "detail": "Error while accessing a resource. You have an invalid sales order <id> or the order is already closed.",
            "o:errorCode": "USER_ERROR"
This is what I ran to get that:
Copy code
POST https://<service ID>.suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<order ID>/!transform/cashsale
{
    "customForm": { "id": 100 }, //custom form ID
    "paymentMethod": { "id": 1 }, //cash payment method ID
    "ccApproved": true, //saw to use this online
    "authCode": "TEST123",
    "memo": "Online Order #TEST123"
}
The Sales Order is Approved and Item Fulfilled by this point.
s
What i understand here is your trying your best to set the payment method on the cash sale.
Pls correct me if iam wrong
But the payment method on the sales order should be set to cash then approved then fulfilled.
t
Thanks for your quick response. I think I understand; the order should be like this: 1. The sales order should be entered. the payment method should be set to 1 (for Cash sale) when this is submitted via the REST API. 2. The Sales Order is then approved and subsequently fulfilled. 3. We can then transform the Sales Order into a Cash Sale.
s
Correction
Correct *
t
Got it. Will I be able to set the paymentMethod back to Web Transaction later on the Sales Order/Payment Event? This is very important for me
Okay so I did the steps above. I 1. Create a Sales Order with payment method as 1.
Copy code
{
    "recordType": "salesorder",
    "customForm": { "id": 100 },
    "entity": "<id>",
    "item": {
        "items": [
            {
                "item": { "id": 1000 },
                "location": "2",
                "rate": 3000,
                "quantity": 1
            }
        ]
    },
    "shipAddressList": { "id": <id> },
    "memo": "Online Order #TEST123",
    "externalId": "wcTest1250945",
    "customeridcustom": "<customer ID custom field>",
    "ourwebsite": "<https://www.mysite.com>",
    "paymentMethod": { "id": 1 },
    "ccApproved": true,
    "authCode": "TEST123AUTHCODE",
    "salesrep": <id>
}
1. POST https://id.suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/id/!transform/cashsale
Copy code
{
  "postingperiod": {
    "id": "<id>"
  },
  "trandate": "2025-01-02",
  "customform": {
    "id": "102"
  },
  "customeridcustom": "<id>",
  "entity": {
    "id": "<id>"
  },
  "subsidiary": {
    "id": "1"
  },
  "paymentmethod": {
    "id": "1"
  },
  "location": {
    "id": "2"
  },
  "item": {
    "items": [
      {
        "item": {
          "id": "<id>"
        },
        "quantity": 1,
        "amount": 3000
      }
    ]
  },
  "memo": "Created from API"
}
that returns this:
Copy code
{
  "type": "<https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1>",
  "title": "Bad Request",
  "status": 400,
  "o:errorDetails": [
    {
      "detail": "Error while accessing a resource. That is not a valid record transformation.",
      "o:errorCode": "USER_ERROR"
    }
  ]
}
s
Can you tell me what is the status of the sales order?
t
"Pending Billing"
Do you want me to pull a sanitized rest api salesorder/<id> GET?
s
Yes please
t
One moment.
Copy code
{
    "links": [
        {
            "rel": "self",
            "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id|suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>>"
        }
    ],
    "altShippingCost": 0.0,
    "billAddress": "<name>\n<address1>\n<city> <state> <zipcode>\nUnited States",
    "billAddressList": {
        "links": [],
        "id": "<id>",
        "refName": "<address1>"
    },
    "billingAddress": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/billingAddress|suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/billingAddress>"
            }
        ]
    },
    "billingAddress_text": "<name>\n<address1>\n<city> <state> <zipcode>\nUnited States",
    "canBeUnapproved": false,
    "canHaveStackable": false,
    "createdDate": "2025-01-02T09:33:00Z",
    "currency": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/currency/1|suitetalk.api.netsuite.com/services/rest/record/v1/currency/1>"
            }
        ],
        "id": "1",
        "refName": "1"
    },
    "customcontactid": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/contact/<id|suitetalk.api.netsuite.com/services/rest/record/v1/contact/<id>>"
            }
        ],
        "id": "<id>",
        "refName": "1 <name> <name>"
    },
    "custom4": false,
    "deleted_woo": false,
    "ourwebsite": "<https://www.mysite.com>",
    "wc_completed": false,
    "customForm": {
        "id": "103",
        "refName": "Custom Sales Order Cash Sale"
    },
    "discountTotal": 0.0,
    "email": "<email>",
    "entity": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/customer/<id|suitetalk.api.netsuite.com/services/rest/record/v1/customer/<id>>"
            }
        ],
        "id": "<id>",
        "refName": "<name>"
    },
    "estGrossProfit": 3000.0,
    "estGrossProfitPercent": 100.0,
    "exchangeRate": 1,
    "externalId": "wcTest1250945",
    "id": "<id>",
    "item": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/item|suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/item>"
            }
        ]
    },
    "lastModifiedDate": "2025-01-02T09:33:00Z",
    "location": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/location/2|suitetalk.api.netsuite.com/services/rest/record/v1/location/2>"
            }
        ],
        "id": "2",
        "refName": "<locationname>"
    },
    "memo": "Custom Online Order #TEST123",
    "orderStatus": {
        "id": "F",
        "refName": "Pending Billing"
    },
    "originator": "restWebServices",
    "prevDate": "2025-01-02",
    "prevRep": <id>,
    "salesEffectiveDate": "2025-01-02",
    "salesRep": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/employee/<id|suitetalk.api.netsuite.com/services/rest/record/v1/employee/<id>>"
            }
        ],
        "id": "<id>",
        "refName": "<name>"
    },
    "shipAddress": "<name>\n<address1>\n<city> <state> <zipcode>\nUnited States",
    "shipAddressList": {
        "links": [],
        "id": "<id>",
        "refName": "<address1>"
    },
    "shipComplete": false,
    "shipDate": "2025-01-02",
    "shipIsResidential": true,
    "shipMethod": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/shipitem/<id|suitetalk.api.netsuite.com/services/rest/record/v1/shipitem/<id>>"
            }
        ],
        "id": "<id>",
        "refName": "Download"
    },
    "shipOverride": false,
    "shippingAddress": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/shippingAddress|suitetalk.api.netsuite.com/services/rest/record/v1/salesorder/<id>/shippingAddress>"
            }
        ]
    },
    "shippingAddress_text": "<name>\n<address1>\n<city> <state> <zipcode>\nUnited States",
    "shippingCost": 0.0,
    "shippingCostOverridden": false,
    "source": {
        "id": "REST Web Services",
        "refName": "REST Web Services"
    },
    "status": {
        "id": "F",
        "refName": "Pending Billing"
    },
    "storeOrder": "F",
    "subsidiary": {
        "links": [
            {
                "rel": "self",
                "href": "https://<id>.<http://suitetalk.api.netsuite.com/services/rest/record/v1/subsidiary/1|suitetalk.api.netsuite.com/services/rest/record/v1/subsidiary/1>"
            }
        ],
        "id": "1",
        "refName": "Parent Company"
    },
    "subtotal": 3000.0,
    "toBeEmailed": false,
    "toBeFaxed": false,
    "toBePrinted": false,
    "total": 3000.0,
    "totalCostEstimate": 0.0,
    "tranDate": "2025-01-02",
    "tranId": "35002",
    "webStore": "F"
}
I feel like I'm missing something in the Sales Order info, but idk
I've scoured this but I can't figure out from this alone what I might be missing: https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2024.2/index.html
s
Did you create an item fulfillment?
If yes can you delete the fulfilment and trigger the cash sale request again?
t
How do I delete the fulfillment?
Never mind; I just made another order and set to Approved. Trying cash sale again.
Copy code
{
  "type": "<https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.1>",
  "title": "Bad Request",
  "status": 400,
  "o:errorDetails": [
    {
      "detail": "Error while accessing a resource. You have an invalid sales order 454090 or the order is already closed.",
      "o:errorCode": "USER_ERROR"
    }
  ]
}
Does that give you any more info? Is there anything else I can do?
@Sai Krishna just following up, it is getting pretty late over here. Is there anything else I can do to expedite this? Thank you again for the help you've provided so far. I feel like I'm close to a solution to this
s
Can you give me by eod i am in ist zone?. Will try to replicate what your doing and get back to you if i get a solution.
t
Absolutely, I am sorry if I seemed pushy. My head has the heaviness of sleep deprivation, that's all. Thank you again
a
@Terrific Objects Can you manually create a cash sale on the order in question? My guess is that the order has the wrong form and the form is expecting an invoice, so cash sale is failing. See if you can manually create the cash sale first.
t
You know, I've been wondering about that- I cannot use a manual button in the Sales Order to generate a Cash Sale. I can only see "Bill" and "Create Deposit". Which form should I try to use for this- would any of the standard ones work?
a
It should say something like Sales Order form For Cash Sale
if you can't do it manually, you won't be able to do it via script, so you can stop looking at code
👍 1
get it to be available through the UI and then your script will work
t
Got it. This seems to be the roadblock. Let me try this and get back here when I can do this in the UI.
s
@Terrific Objects If you set the payment method on sales order form it will let you create the Cash sale. If you set the Terms then it will let you create Invoice. Hope this helps