Channel: 2

Provider: SafetyPay

Payment Method: APM

Available Currencies

NameCodeCountry
Chilean PesosCLPChile
Peruvian SolPENPeru
US DollarUSDPeru, Ecuador
Mexican pesoMXNMexico
Brazilian realBRLBrazil

Request example

curl --request POST \
  --url http://paymentscert.alps.cl/justpay/check-out/SecurePayment \
  --data public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks \
  --data time=2022-10-13T14:39:09 \
  --data channel=2 \
  --data amount=100 \
  --data currency=CLP \
  --data trans_id=1 \
  --data time_expired=120 \
  --data url_ok=https://bit.ly/3S4I7iR \
  --data url_error=https://bit.ly/3S5aOwc \
  --data signature=9bddd509e1173b8f36615cc0e28490187eb0d14030377289c8920ddcd1c7acdb
  --data 'shopper_information={"name_shopper": "Jon","last_name_Shopper": "Snow","type_doc_identi": "DNI","Num_doc_identi": "92738009","email": "[email protected]","country_code": "+56","Phone": "999763655"}'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "http://paymentscert.alps.cl/justpay/check-out/SecurePayment",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks&time=2022-10-13T14%3A39%3A09&channel=2&amount=100&currency=CLP&trans_id=1&time_expired=120&url_ok=https%3A%2F%2Fbit.ly%2F3S4I7iR&url_error=https%3A%2F%2Fbit.ly%2F3S5aOwc&signature=9bddd509e1173b8f36615cc0e28490187eb0d14030377289c8920ddcd1c7acdb&shopper_information=%7B%22name_shopper%22%3A%20%22Jon%22%2C%22last_name_Shopper%22%3A%20%22Snow%22%2C%22type_doc_identi%22%3A%20%22DNI%22%2C%22Num_doc_identi%22%3A%20%2292738009%22%2C%22email%22%3A%20%22no-reply%40alps.cl%22%2C%20%22country_code%22%3A%20%22%2B56%22%2C%20%22Phone%22%3A%20%22999763655%22%7D",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "http://paymentscert.alps.cl/justpay/check-out/SecurePayment"

payload = "public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks&time=2022-10-13T14%3A39%3A09&channel=2&amount=100&currency=CLP&trans_id=1&time_expired=120&url_ok=https%3A%2F%2Fbit.ly%2F3S4I7iR&url_error=https%3A%2F%2Fbit.ly%2F3S5aOwc&signature=9bddd509e1173b8f36615cc0e28490187eb0d14030377289c8920ddcd1c7acdb&shopper_information=%7B%22name_shopper%22%3A%20%22Jon%22%2C%22last_name_Shopper%22%3A%20%22Snow%22%2C%22type_doc_identi%22%3A%20%22DNI%22%2C%22Num_doc_identi%22%3A%20%2292738009%22%2C%22email%22%3A%20%22no-reply%40alps.cl%22%2C%20%22country_code%22%3A%20%22%2B51%22%2C%20%22Phone%22%3A%20%22999763655%22%7D"
response = requests.request("POST", url, data=payload)

print(response.text)
const qs = require("querystring");
const http = require("http");

const options = {
  "method": "POST",
  "hostname": "paymentscert.alps.cl",
  "port": null,
  "path": "/justpay/check-out/SecurePayment",
  "headers": {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(qs.stringify({
  public_key: 'zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks',
  time: '2022-10-13T14:39:09',
  channel: '2',
  amount: '100',
  currency: 'CLP',
  trans_id: '1',
  time_expired: '120',
  url_ok: 'https://bit.ly/3S4I7iR',
  url_error: 'https://bit.ly/3S5aOwc',
  signature: '9bddd509e1173b8f36615cc0e28490187eb0d14030377289c8920ddcd1c7acdb',
  shopper_information:'{"name_shopper": "Jon","last_name_Shopper": "Snow","type_doc_identi": "DNI","Num_doc_identi": "92738009","email": "[email protected]","country_code": "+56","Phone": "999763655"}'
}));
req.end();

Mandatory Data

AttributeMandatoryData typeDescription
public_keyTrueString (255)Public key, unique value that identifies the commerce
timeTrueDatetimeRequest data time
channelTrueIntegerPayment Channel
amountTrueDoubleThe amount of the transaction. Use 2 decimals.
currencyTrueString (3)Transaction currency code
trans_idTrueString (255)Transaction id
time_expiredTrueString (255)Time in minutes to expire the token. Value given in minutes. Minimum Suggested: Online: 30 minutes Cash: 2 hours For Brazil: Online: 2 hours Cash 24 hrs
url_okTrueString (255)URL where shopper will be redirected from the online banking if payment was successful (Must be Https)
url_errorTrueString (255)URL where shopper will be redirected from the online banking if payment was wrong.(Must be Https)
signatureTrueString (255)Signature hash256: Review signature calculation
direct_integrationFalseBooleanMake direct integration to respond JSON format
shopper_informationTrueJSON StringJSON String Data: Review JSON index & format

shopper_information JSON format

📘

Field shopper_information must be send in string format (JSON encode).

'{"name_shopper": "Jon", "last_name_Shopper": "Snow", "type_doc_identi": "DNI", "Num_doc_identi": "92738009", "email": "[email protected]","country_code": "+56","Phone": "999763655"}'

The shopper_information field is a column corresponding to a json with the next keys:

ParameterMandatoryData TypeDescription
name_shopperTrueString (255)Shopper's name
last_name_ShopperTrueString (255)Shopper's last name
type_doc_identiTrueString (255)Identification document [RUT,DNI,CI, ID etc.]
Num_doc_identiTrueString (255)Identification document number
emailTrueString (255)Shopper's e-mail
country_codeTrueString (4)Country's phone code (Ex. +57)
PhoneTrueString (20)Shopper's phone number
countryFalseString (3)Country ISO code ['CHL', 'MEX', 'PER', 'ECU']

For channel 1 and 2 you can filter the bank using the filter_by field.

The list of banks is available at the following link: https://payments.alps.cl/justpay/api/banks

The value to send is list of bank IDs separated by commas. For example: 8216, 8066, 8014, 8015.

Direct integration

You have the option to create a direct checkout, for this integration you'll receive a JSON Object instead of the checkout url.

Aditional fields for direct integration

AttributeMandatoryData typeDescription
direct_integrationTrueIntegerSend 1 for direct integration
countryTrueString(3)ISO Country code: [MEX, PER, BRA, CHL, ECU]
user_bank_codeTrueIntegerbank id from https://payments.alps.cl/justpay/api/banks/safetypay

Available country codes:

  • Chile: CHL
  • Peru: PER
  • Ecuador: ECU
  • Mexico: MEX
  • Brazil: BRA

Safetypay banks request

AttributeMandatoryData typeDescription
channelTrueInteger2 for cash payments
countryTrueString(3)Country ISO code
public_keyTrueIntegerYour public key
curl --request GET \
  --url 'http://paymentscert.alps.cl/justpay/api/banks/safetypay?channel=2&country=PER&public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "http://paymentscert.alps.cl/justpay/api/banks/safetypay?channel=2&country=PER&public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "http://paymentscert.alps.cl/justpay/api/banks/safetypay"

querystring = {"channel":"2","country":"PER","public_key":"zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks"}

response = requests.request("GET", url, params=querystring)

print(response.text)
const http = require("http");

const options = {
  "method": "GET",
  "hostname": "paymentscert.alps.cl",
  "port": null,
  "path": "/justpay/api/banks/safetypay?channel=2&country=PER&public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks",
  "headers": {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

Request example for direct integration

curl --request POST \
  --url http://localhost/justpay/check-out/SecurePayment \
  --data public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks \
  --data time=2022-10-13T14:39:09 \
  --data channel=2 \
  --data amount=30 \
  --data currency=CLP \
  --data trans_id=1 \
  --data time_expired=120 \
  --data url_ok=http://bit.ly/3S4I7iR \
  --data url_error=https://bit.ly/3S5aOwc \
  --data signature=3c8e8d6b03d4639e1ffc06741eb52579354a03171d3d05dba0c113e1bbf975cd \
  --data 'shopper_information={"name_shopper": "Jon","last_name_Shopper": "Snow","type_doc_identi": "DNI","Num_doc_identi": "92738009","email": "[email protected]", "Phone": "999763655"}' \
  --data direct_integration=1 \
  --data country_code=PER \
  --data user_bank_code=1002
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "http://localhost/justpay/check-out/SecurePayment",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks&time=2022-10-13T14%3A39%3A09&channel=2&amount=30&currency=CLP&trans_id=1&time_expired=120&url_ok=http%3A%2F%2Fbit.ly%2F3S4I7iR&url_error=https%3A%2F%2Fbit.ly%2F3S5aOwc&signature=3c8e8d6b03d4639e1ffc06741eb52579354a03171d3d05dba0c113e1bbf975cd&shopper_information=%7B%22name_shopper%22%3A%20%22Jon%22%2C%22last_name_Shopper%22%3A%20%22Snow%22%2C%22type_doc_identi%22%3A%20%22DNI%22%2C%22Num_doc_identi%22%3A%20%2292738009%22%2C%22email%22%3A%20%22no-reply%40alps.cl%22%2C%20%22Phone%22%3A%20%22999763655%22%7D&direct_integration=1&country_code=PER&user_bank_code=1002",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "http://localhost/justpay/check-out/SecurePayment"

payload = "public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks&time=2022-10-13T14%3A39%3A09&channel=2&amount=30&currency=CLP&trans_id=1&time_expired=120&url_ok=http%3A%2F%2Fbit.ly%2F3S4I7iR&url_error=https%3A%2F%2Fbit.ly%2F3S5aOwc&signature=3c8e8d6b03d4639e1ffc06741eb52579354a03171d3d05dba0c113e1bbf975cd&shopper_information=%7B%22name_shopper%22%3A%20%22Jon%22%2C%22last_name_Shopper%22%3A%20%22Snow%22%2C%22type_doc_identi%22%3A%20%22DNI%22%2C%22Num_doc_identi%22%3A%20%2292738009%22%2C%22email%22%3A%20%22no-reply%40alps.cl%22%2C%20%22Phone%22%3A%20%22999763655%22%7D&direct_integration=1&country_code=PER&user_bank_code=1002"
response = requests.request("POST", url, data=payload)

print(response.text)
const qs = require("querystring");
const http = require("http");

const options = {
  "method": "POST",
  "hostname": "localhost",
  "port": null,
  "path": "/justpay/check-out/SecurePayment",
  "headers": {}
};

const req = http.request(options, function (res) {
  const chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    const body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(qs.stringify({
  public_key: 'zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks',
  time: '2022-10-13T14:39:09',
  channel: '2',
  amount: '30',
  currency: 'CLP',
  trans_id: '1',
  time_expired: '120',
  url_ok: 'http://bit.ly/3S4I7iR',
  url_error: 'https://bit.ly/3S5aOwc',
  signature: '3c8e8d6b03d4639e1ffc06741eb52579354a03171d3d05dba0c113e1bbf975cd',
  shopper_information: '{"name_shopper": "Jon","last_name_Shopper": "Snow","type_doc_identi": "DNI","Num_doc_identi": "92738009","email": "[email protected]", "Phone": "999763655"}',
  direct_integration: '1',
  country_code: 'PER',
  user_bank_code: 1002
}));
req.end();

Response for direct integration

{
  "request_id": "prdcpr_028c7d5e-e791-491b-b8d1-1bda9e4e4c69",
  "response_datetime": "2023-01-24T16:34:16",
  "operation_id": "0123024337013713",
  "transaction_id": "337013",
  "payment_expiration_datetime": "terça-feira 24 de janeiro  03:34pm (Brasilia)",
  "payment_expiration_datetime_utc": "2023-01-24T18:34:17",
  "payable_amounts": [
    {
      "amount": {
        "value": 6,
        "currency_code": "BRL"
      },
      "additional_info": null
    }
  ],
  "payment_locations": [
    {
      "location_url": "http://www.caixa.gov.br/atendimento/Paginas/encontre-a-caixa.aspx",
      "location_id": "8176",
      "location_name": "Lotéricas",
      "bank_subsidiary_code": "8176_CASH",
      "payment_instructions": [
        {
          "name": "TransactionID",
          "value": "337013",
          "display_label": "Identificador do cliente"
        },
        {
          "name": "PaymentReference",
          "value": "337013",
          "display_label": ""
        },
        {
          "name": "AgreementCode",
          "value": "30911745",
          "display_label": "Número do Convenio PEC"
        }
      ],
      "howto_pay_steps": [
        {
          "step_number": 1,
          "step_instruction": "Dirija-se a uma Casa Lotérica ou Agência da CAIXA Econômica Federal. Informe o [Convênio PEC SafetyPay Brasil 30911745]"
        },
        {
          "step_number": 2,
          "step_instruction": "Forneça o identificador do cliente [337013]"
        },
        {
          "step_number": 3,
          "step_instruction": "Finalmente, confirme o valor do pagamento [R$ 6.00]"
        },
        {
          "step_number": 4,
          "step_instruction": "IMPORTANTE: Os Pagamentos acima de R$ 2.000,00 só podem ser feitos nas agências da Caixa Econômica Federal"
        }
      ],
      "status": 1
    },
    {
      "location_url": "http://www.caixa.gov.br/atendimento/Paginas/encontre-a-caixa.aspx",
      "location_id": "8176",
      "location_name": "Lotéricas",
      "bank_subsidiary_code": "8176_CASH_B2B",
      "payment_instructions": [
        {
          "name": "TransactionID",
          "value": "337013",
          "display_label": "Identificador do cliente"
        },
        {
          "name": "PaymentReference",
          "value": "337013",
          "display_label": ""
        },
        {
          "name": "AgreementCode",
          "value": "30911745",
          "display_label": "Número do Convenio PEC"
        }
      ],
      "howto_pay_steps": [
        {
          "step_number": 1,
          "step_instruction": "Dirija-se a uma Casa Lotérica ou Agência da CAIXA Econômica Federal. Informe o [Convênio PEC SafetyPay Brasil 30911745]"
        },
        {
          "step_number": 2,
          "step_instruction": "Forneça o identificador do cliente [337013]"
        },
        {
          "step_number": 3,
          "step_instruction": "Finalmente, confirme o valor do pagamento [R$ 6.00]"
        },
        {
          "step_number": 4,
          "step_instruction": "IMPORTANTE: Os Pagamentos acima de R$ 2.000,00 só podem ser feitos nas agências da Caixa Econômica Federal"
        }
      ],
      "status": 1
    },
    {
      "location_url": "https://banco.bradesco/html/classic/atendimento/rede-de-atendimento/index.shtm#",
      "location_id": "8326",
      "location_name": "Bradesco Pague Facil",
      "bank_subsidiary_code": "8326_CASH",
      "payment_instructions": [
        {
          "name": "TransactionID",
          "value": "00337013",
          "display_label": "Código de Transação"
        },
        {
          "name": "PaymentReference",
          "value": "00337013",
          "display_label": ""
        },
        {
          "name": "AgreementCode",
          "value": "SafetyPay Brasil",
          "display_label": "Convênio Pague Fácil"
        }
      ],
      "howto_pay_steps": [
        {
          "step_number": 1,
          "step_instruction": "Dirija-se um Bradesco Expresso ou Terminais de Autoatendimento Bradesco Dia & Noite (BDN), localize o correspondente bancário mais próximo em https://www.safetypay.com/pt/bradesco-cash/"
        },
        {
          "step_number": 2,
          "step_instruction": "Indique que você fará um pagamento Pague Fácil Bradesco a Empresa [SafetyPay Brasil]"
        },
        {
          "step_number": 3,
          "step_instruction": "Mencionar o Código de Transação [00337013]"
        },
        {
          "step_number": 4,
          "step_instruction": "Confirme o valor do pagamento [R$ 6,00]"
        }
      ],
      "status": 1
    },
    {
      "location_url": "https://banco.bradesco/html/classic/atendimento/rede-de-atendimento/index.shtm#",
      "location_id": "8326",
      "location_name": "Bradesco Pague Facil",
      "bank_subsidiary_code": "8326_CASH_B2B",
      "payment_instructions": [
        {
          "name": "TransactionID",
          "value": "00337013",
          "display_label": "Código de Transação"
        },
        {
          "name": "PaymentReference",
          "value": "00337013",
          "display_label": ""
        },
        {
          "name": "AgreementCode",
          "value": "SafetyPay Brasil",
          "display_label": "Convênio Pague Fácil"
        }
      ],
      "howto_pay_steps": [
        {
          "step_number": 1,
          "step_instruction": "Dirija-se um Bradesco Expresso ou Terminais de Autoatendimento Bradesco Dia & Noite (BDN), localize o correspondente bancário mais próximo em https://www.safetypay.com/pt/bradesco-cash/"
        },
        {
          "step_number": 2,
          "step_instruction": "Indique que você fará um pagamento Pague Fácil Bradesco a Empresa [SafetyPay Brasil]"
        },
        {
          "step_number": 3,
          "step_instruction": "Mencionar o Código de Transação emphasize"
        },
        {
          "step_number": 4,
          "step_instruction": "Confirme o valor do pagamento [R$ 6,00]"
        }
      ],
      "status": 1
    }
  ],
  "digest_check": "0857315E9A7391F0AE59C4ADC6AE6F5D71A7A779026AFACA5C45C333E2687114",
  "error": null,
  "custom_data": null
}

📘

All values between [] must be replace on the merchant site to emphasize this information. For example: [337013] must be replace by 337013 on your HTML code.


Filters

Using the parameter filter_by you may filter to show only the desire banks. You may use a comma separated files with bank ids.

Get Bank ids

Create a GET request to /api/banks/safetypay to obtain all available bank ids by country

ParameterMandatoryData TypeDescription
channelTrueIntegerChannel number [1, 2]
countryTrueString (3)[CHL, PER, BRA, ECU, MEX]
public_keyTrueString (255)Public key, unique value that identifies the commerce

Request example

curl --request GET \
  --url 'https://paymentscert.alps.cl/justpay/api/banks/safetypay?channel=2&country=CHL&public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://paymentscert.alps.cl/justpay/api/banks/safetypay?channel=2&country=CHL&public_key=zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://paymentscert.alps.cl/justpay/api/banks/safetypay"

querystring = {"channel":"2","country":"CHL","public_key":"zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks"}

response = requests.request("GET", url, params=querystring)

print(response.text)
const request = require('request');

const options = {
  method: 'GET',
  url: 'https://paymentscert.alps.cl/justpay/api/banks/safetypay',
  qs: {
    channel: '2',
    country: 'CHL',
    public_key: 'zyssglikvtltbd2se2hudwl50jjomil2uytp7tpvjtxyfdw469jagk8yvnex9jks'
  }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});


Test Transactions

Simulate Payment

Once the notification URL is configured, please follow the steps below to begin the tests.

  1. Create a Transaction: The first thing you need to do is create a transaction, you will be redirected to SafetyPay.

  2. Log In: Enter the following credential and then log in:

  3. Select currency, and enter Transaction ID and amount. Where Transaction ID is the Código Identificador from step 1

  4. Click confirm to mark the transaction as paid

  5. The transaction will be marked as paid and will receive the success webhook notification

Errors

This payment integration only sends notifications for successfully completed transactions. This means that error messages will not be generated for failed transactions.