[#1192] Help with promo codes

Migrated from Redmine #1192 | Author: Guilherme Bueno
Status: Feedback | Priority: High, I’m very impatient | Created: 2024-03-11


On the rest API it says you can only apply the promo codes to either a pending or new order.

I assume with order the documentation means an invoice. When a new booking is created as a confirmed booking, would that no longer be a pending order and if so, would it be considered a new one? I seem to be getting 403 errors, but since I am also using SB to fetch the booking to which the invoice belongs to, I assume having access to the booking/invoice is not the issue.

Request URL:
https://user-api-v2.simplybook.me/admin/invoices/17728/apply-promo-code?code=PSB20241
Method: “PUT”

Request Headers:


"headers" => [
    "X-Token" => "7db1db712818e1b8d0c2c6f17ddd38cae59cbb80ad16e19c6337ef2704354b89"
    "X-Company-Login" => "santemedic1"
    "Content-type" => "application/json; charset=utf-8"
  ]

Request body is empty, passing promo code as GET param on URL

Guilherme Bueno wrote:

Hi, any news on this?

Dmytro Bondarev wrote:

Hi,

  1. You should use PUT method
  2. You should send it in request body
{
    'code': 'YOUR_CODE'
}

Dmytro Bondarev wrote:

Also can be passed as GET parameter, but in any case it must be PUT method

Guilherme Bueno wrote:

It is PUT method as I outlined in the question

" Method: “PUT” "

Dmytro Bondarev wrote:

Hi,
Please make sure you making request to correct URL.
As far as i see your company is not on .me domain.

Guilherme Bueno wrote:

I corrected it to be using the .plus domain, but now I’m getting a different 403 “You can not edit this invoice”

URL: PUT https://user-api-v2.simplybook.plus/admin/invoices/17795/apply-promo-code?code=PSB20241

Headers:

“headers” => [
“X-Token” => “05c4d7d0ff331f4fa36c0ff8e14b9c4202c605c29c5b6d5340bcde22b652ae60”
“X-Company-Login” => “santemedic1”
“Content-type” => “application/json; charset=utf-8”
]

Guilherme Bueno wrote:

Hi, just checking in on this

Guilherme Bueno wrote:

Is there still someone available to advise?

Dmytro Bondarev wrote:

It means that you are not able to change it anymore.
It can be because your order already paid/refunded or your customer selected not delay payment processor.

We do not allow to change paid/refunded invoices.
We do not allow to all to change pending order if payment processor is not delay to prevent order changes when user trying to pay.