Duplicate Site Membership to External API

Good afternoon all,
I am seeking information on how to code my site to automatically register my site members to my external loyalty program through API. Any and all information would be appreciated.

Thank in advance,
Brittani

Make use of Wix Fetch or Wix HTTP Functions.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api

https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions

@givemeawhisky Thank you so much for the links. I am literally stuck on this portion of the site and will, hopefully, be complete once this feature is all set! I do have one question though, I am getting an error message that reads:

status:
“failure”

message:
“no public key”

I will post my page and backend code below.

Backend Code

import {fetch} from 'wix-fetch';  
import {wixData} from 'wix-data';


export function postLoyalty() {
 let options ={
 "headers": {        
 "Content-Type": "application/json"
        }
  }
 const url = 'https://whisqr.com/api/v1.2/user/customer/';
 const key = '<pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76>';
     console.log("Url: ");

 return fetch(url, {method: 'post'})
    .then(response => {
 return response.json();
    })
    .then((data) => {
      console.log(data);
 return data;
    });
}

Page Code

import {postLoyalty} from 'backend/Loyalty.jsw';
import {wixData} from 'wix-data';
import wixLocation from "wix-location";
import {myFunction} from 'public/core.js';
import wixUsers from 'wix-users';


$w.onReady(function () {
 let publickey = 'pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76';
    myFunction(publickey)
    .then( (response) => {
        console.log(response); //your base64 encoded string
    })});

export function page1_viewportEnter(event) {
 //Add your code for this event here: 
 let email = wixUsers.currentUser.getEmail();
postLoyalty(email)
        .then(LoyaltyInfo => {
            console.log(LoyaltyInfo)
            $w("#text1").text = LoyaltyInfo.Results.Value;
        })
}


@givemeawhisky