[#399] Process to make a book and make the payment confirm

Migrated from Redmine #399 | Author: Arthur Lima
Status: Feedback | Priority: Immediate, there is BUG! | Created: 2019-07-05


I’ve already done the entire booking process, and now I need to make the payment process and I’m having trouble understanding about how is the flow.
I need some help x…x

Dmytro Bondarev wrote:

Hello! Unfortunately we do not have confirmation payment in API currently.

Arthur Lima wrote:

Dmitry Bondarev wrote:

Hello! Unfortunately we do not have confirmation payment in API currently.

So I can’t use the extra feature “Accept payments” while using the API?

Dmytro Bondarev wrote:

Unfortunately currently it is not possible.

Arthur Lima wrote:

But what about the methods confirmBookingPayment, isPaymentRequired, validatePayment and getPaymentProcessorConfig?

Dmytro Bondarev wrote:

These methods were deprecated and they do not work with new payment system in simplybook.

Dmytro Bondarev wrote:

Hello, Arthur!
Good news, now you can accept payment via admin API. please use confirmInvoice method: API documentation | SimplyBook.me Online Scheduling
Note that you need to pass handle_invoice => true to additional info for book method. for example:
@$client->book(1, 1, ‘2019-07-30’, ‘14:00:00’, [‘name’ => ‘Client name’, ‘email’ => ‘clientname@gmail.com’, ‘phone’ => ‘999999999999’], [‘handle_invoice’ => true]);@

Vitor Albano wrote:

Hi Dmitry!

Can i add this attribute, ‘handle_invoice’ to the admin book call?
Is it works as the public book call?

Thanks in advance

Dmitry Bondarev wrote:

Hello, Arthur!
Good news, now you can accept payment via admin API. please use confirmInvoice method: API documentation | SimplyBook.me Online Scheduling
Note that you need to pass handle_invoice => true to additional info for book method. for example:
@$client->book(1, 1, ‘2019-07-30’, ‘14:00:00’, [‘name’ => ‘Client name’, ‘email’ => ‘clientname@gmail.com’, ‘phone’ => ‘999999999999’], [‘handle_invoice’ => true]);@

Dmytro Bondarev wrote:

Hi Vitor!

Can i add this attribute, ‘handle_invoice’ to the admin book call?
This attribute is allowed only for public API. If you need to make invoice when you are calling admin API you can pass @‘make_invoice’ => true, ‘payment_processor’ => ‘your_payment_processor_name’@, however it will instantly confirm payment, because it is admin API.

Is it works as the public book call?
Yes it works for public API.

Vitor Albano wrote:

Thanks Dmitry.. So, i have another doubt.

We are using the address https://user-api.enterpriseappointments.com/admin for admin calls, what is the address for public calls?

I’ve tried the address without ‘/admin’, but a had a response with the message ‘Client authorization required’

Dmitry Bondarev wrote:

Hi Vitor!

Can i add this attribute, ‘handle_invoice’ to the admin book call?
This attribute is allowed only for public API. If you need to make invoice when you are calling admin API you can pass @‘make_invoice’ => true, ‘payment_processor’ => ‘your_payment_processor_name’@, however it will instantly confirm payment, because it is admin API.

Is it works as the public book call?
Yes it works for public API.

Redmine Admin wrote:

Hi, please use https://user-api.enterpriseappointments.com/ for public calls. It has slightly different auth method API documentation | SimplyBook.me Online Scheduling (Client API (Company public service) authorization section)

Vitor Albano wrote:

Hi, I followed these steps and received the token successfully, but when I try to call the book method with the returned token, I receive this message ‘Client authorization required’.

Using, of course, the public book method signature API documentation | SimplyBook.me Online Scheduling

We tried to call this method with a Free Trial account and it worked.

Redmine Admin wrote:

Hi, please use https://user-api.enterpriseappointments.com/ for public calls. It has slightly different auth method API documentation | SimplyBook.me Online Scheduling (Client API (Company public service) authorization section)

Redmine Admin wrote:

it must be some error in your call, please provide raw http request for investigation

Vitor Albano wrote:

This is our code

@
$loginClient = new JsonRpcClient($apiUrlBase . ‘/login/’);
$token = $loginClient->getToken($companyLogin, $apiKey);

$header = array(
‘headers’ => array(
'X-Company-Login: ’ . $companyLogin,
'X-Token: ’ . $token,
)
);

// At this point the token is available

$publicClient = new JsonRpcClient($apiUrlBase.‘/’, $header);

$book = $publicClient->book(
1,
1,
‘2019-08-09’,
‘15:00:00’,
array(
‘name’ => ‘Username’,
‘email’ => ‘email@email.com’,
‘phone’ => ‘12345678’
),
array(‘handle_invoice’ => true)
);
@

Redmine Admin wrote:

it must be some error in your call, please provide raw http request for investigation

Redmine Admin wrote:

it seems you enabled client login additional feature and need to handle this properly in book call:
please just pass client_id and client_sign or client_login and client_password information as clientData.
Do not pass any other client data.
Make sure that you already have this client.

Redmine Admin wrote:

Where client_sign is md5(clilentId . clientHash . yourSecretKey);

Vitor Albano wrote:

Nice!
Works like a charm.

Thanks

Redmine Admin wrote:

Where client_sign is md5(clilentId . clientHash . yourSecretKey);