It's need to make JS request to api, get the data and put it into the field.

Zamknięty Opublikowano 4 lat temu Płatność przy odbiorze
Zamknięty Płatność przy odbiorze

Its need to make JS code to get the user points data via api and send it to the user chat.

The JS code example is here:

[login to view URL]

In our case the parameters will be:

- email;

- number.

And here is the PHP code for api request to get user points data:

global $current_user;

$pointsUrl = '[login to view URL]';

$pointsToken = -------token-------;

$phone = get_user_meta($current_user->id, 'billing_phone', true);

$phone = str_replace('+', '', $phone);

$response = wp_remote_get($pointsUrl . 'customers/search'

. '?access-token=' . $pointsToken

. '&telephone=' . $phone

. '&expand=points'

);

if (!wp_remote_retrieve_response_code($response) == 200) {

return;

}

$customers = json_decode($response['body']);

if (count($customers) == 0) {

return;

}

if (isset($customers[0]->points)) {

foreach ($customers[0]->points as $point) {

$response = wp_remote_get($pointsUrl . 'partnerships/' . $point->partnershipId

. '?access-token=' . $pointsToken

);

$partnership = json_decode($response['body']);

printf(

__( '<p>%3$s: %2$d баллов</p>', 'loyalty-info' ),

$point->partnershipId,

$point->points,

esc_html($partnership->name)

);

}

JavaScript HTML PHP

Numer ID Projektu: #21345822

O projekcie

10 ofert Zdalny projekt Aktywny 4 lat temu

10 freelancerów złożyło ofertę za $25 w tym projekcie

sherazm

I can do this task. i have worked on many projects like this. ping me for more details and also check out my reviews. thanks

$30 USD w ciągu 1 dnia
(68 Oceny)
6.4
harshakns

Hi, what your code describes is get the phone number from the current_user and replace the "+" by "" check if there any customers with that phone number. if there are any customers with that phone number, get their par Więcej

$40 USD w ciągu 7 dni
(10 Oceny)
4.8
gouravdangayach

Hi..!! Greetings of the day..!! I am an Experienced Developer having much experience in this field. I can do it as well as can start work on it immediately. Kindly check your PMB for more details. Thanks Regards Więcej

$20 USD w ciągu 3 dni
(33 Oceny)
4.5
AndreiAngelica

Hello, I'm a full stack web developer and I know PHP & Javascriot very well. Contact me for more informations about your project.

$10 USD w ciągu 1 dnia
(18 Oceny)
4.0
trivediasha

Hello Sir Hope you are doing great. ============================================ I am a senior web developer and have very good experience in wordpress( 5+ years). I have read your project description. I can do yo Więcej

$15 USD w ciągu 1 dnia
(14 Oceny)
3.7
NavilPolyakov

Hi I've read your need and I understood the requirement. I have good skills in web design and web development. If you hire me I'll do my best. I can start now immediately and I'll give you perfect result. Navil ------- Więcej

$20 USD w ciągu 7 dni
(17 Oceny)
5.3
bireshwargoswami

Hello Sir, Hope you are doing well. I have 6+ years of working experience in UI and frontend framework and also worked with lots of international clients. So, I think I can help you out with this work. It can be done Więcej

$25 USD w ciągu 2 dni
(7 Oceny)
3.5