auths objectreturn or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.async (event, steps) => {}const axios = require('axios');
const crypto = require("crypto");
// IMPORTANTE: Personalizar por el comercio
const key = 'key';
const resource = 'resource';
const secret = 'secret';
// Fin de personalización del comercio
const endpoint = 'https://sandbox.sipay.es/gpay/api/v1/store';
const { paymentMethodData } = event.body;
console.log('XXXXXXXXXXXX')
console.log(event.body);
console.log('XXXXXXXXXXXX')
const body = {
  paymentMethodToken: paymentMethodData.tokenizationData,
}
const response = await axios({
  method: 'POST',
  url: endpoint,
  headers: {
    'Content-Signature': crypto.createHmac('sha256', secret).update(JSON.stringify(body)).digest("hex"),
    'Content-Type': 'application/json'
  },
  data: body,
});
const { data } = response;
console.log('XXXXXXXXXXXX')
console.log(body)
console.log('XXXXXXXXXXXX')
console.log(data);
console.log('XXXXXXXXXXXX')
const endpoint_process = 'https://sandbox.sipay.es/mdwr/v1/authorization';
const body_process = {
  key: key,
  resource: resource,
  nonce: process.hrtime().toString().replace(",", ""),
  mode: "sha256",
  payload: {
    amount: 10,
    currency: 'EUR',
    catcher: {
      type: 'gpay',
      token_gpay: event.body.paymentMethodData.tokenizationData.token
    }
  }
}
console.log('***** BEGIN body_process *****')
console.log(body_process);
console.log('***** END body_process *****')
const response_process = await axios({
  method: 'POST',
  url: endpoint_process,
  headers: {
    'Content-Signature': crypto.createHmac('sha256', secret).update(JSON.stringify(body_process)).digest("hex"),
    'Content-Type': 'application/json'
  },
  data: body_process,
});
console.log('**** BEGIN response_process *****');
console.log(response_process);
console.log('**** END response_process *****');
$checkpoint = response_process.data;auths objectreturn or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.async (event, steps) => {}await $respond({
  status: 200,
  immediate: true,
  body: $checkpoint
})async params => {}$end(params.reason)