[#601] Confirm booking after taking payment externally via API

Migrated from Redmine #601 | Author: Veer Manhas
Status: Feedback | Priority: High, I’m very impatient | Created: 2020-11-08


Hi there,

I started integrating this system on our site for people to book a service.

  1. Get service details
  2. get user details
  3. get slots and show
  4. call book method to create their booking
  5. Taking payment on Paypal on our site

Two questions:

  • On step 4, if I do not confirm payment the booking should be cancelled, it doesn’t.
  • After step 5, which method to call to confirm the booking permanently?

Dmytro Bondarev wrote:

Hi, please pass ‘handle_invoice’ => true to $additional. It will make order for you and will cancel it by timeout in case no payment.
and then use admin API to confirm order after you receive payment - API documentation | SimplyBook.me Online Scheduling or API documentation | SimplyBook.me Online Scheduling

Veer Manhas wrote:

Dmitry Bondarev wrote:

Hi, please pass ‘handle_invoice’ => true to $additional. It will make order for you and will cancel it by timeout in case no payment.
and then use admin API to confirm order after you receive payment - API documentation | SimplyBook.me Online Scheduling or API documentation | SimplyBook.me Online Scheduling

Okay, will try that. Thanks so much.
In confirmInvoice ($id, $paymentSystem)
Confirms invoice by id

@param integer $id
@param string $paymentSystem
@return array
@throws Api_Entity_Exception

Can paymentSystem be any string for reference or it require particular format of string like additionalField requires ids and all?

Dmytro Bondarev wrote:

It can be any string

Veer Manhas wrote:

Dmitry Bondarev wrote:

It can be any string

Thanks that helps.

But when I am calling it with Admin token.
POST CALL
{
status: 200,
statusText: ‘OK’,
headers: {
server: ‘nginx’,
date: ‘Mon, 09 Nov 2020 15:06:22 GMT’,
‘content-type’: ‘application/json; charset=UTF-8’,
‘content-length’: ‘121’,
connection: ‘close’,
‘access-control-allow-origin’: ‘*’,
‘access-control-allow-methods’: ‘POST, GET, OPTIONS’,
‘access-control-allow-headers’: ‘content-type, x-company-login, x-application-token, x-user-token, x-token, x-requested-with’,
‘x-xss-protection’: ‘1; mode=block’
},
config: {
url: ‘https://user-api.simplybook.me/’,
method: ‘post’,
data: ‘{“jsonrpc”:“2.0”,“method”:“confirmInvoice”,“params”:[39,“PayPal”],“id”:“87e0cd92-7a66-4e69-b93e-739790ba3435”}’,
headers: {
Accept: ‘application/json, text/plain, /’,
‘Content-Type’: ‘application/json’,
‘X-Company-Login’: ‘classes’,
‘X-User-Token’: ‘something’,
‘User-Agent’: ‘axios/0.20.0’,
‘Content-Length’: 110
},

Result:
data: {
error: { code: -32600, message: ‘Access denied’, data: },
id: ‘87e0cd92-7a66-4e69-b93e-739790ba3435’,
jsonrpc: ‘2.0’
}

Veer Manhas wrote:

Never mind, I got it. I needed to use /admin path

Thanks :smiley: