Skip to content

IVR Remote authorizer

Interactive Voice Response or IVR is a telephony technology that allows customers to interact with the company's service system through configurable voice menus, in real time, using DTMF tones.

In an IVR system, callers are given the ability to enter card data by pressing the keys. Pressing a digit on the telephone keypad sends a DTMF tone to the company's attention system which then selects the appropriate action / response according to the digit pressed.

Now your clients can pay you with a simple phone call.

This is a secure way for your clients to make their payments since they provide their data electronically and directly to Openpay.

IVR charges

Below is the flow to create an IVR charge.

  1. The customer confirms the purchase on the merchant's website, selecting IVR as the means of payment
  2. From the merchant's server a code is created creating a charge in Openpay

Generate IVR charge

To generate a charge for IVR it is necessary to create a charge indicating in the field method the typecard and in the attribute confirm the value ivr as follows:

<?php
$openpay = Openpay::getInstance('mzdtln0bmtms6o3kck8f',
  'sk_e568c42a6c384b7ab02cd47d2e407cab');

$customer = array(
     'name' => $_POST["Juan"],
     'last_name' => $_POST["Urbina"],
     'phone_number' => $_POST["45155352828"],
     'email' => $_POST["juan.test@correo.mx"],);

$chargeData = array(
    'method' => $_POST["card"],
    'confirm' => $_POST["ivr"],
    'order_id' => $_POST["ord-234"],
    'amount' => $_POST["200"], // formato númerico con hasta dos dígitos decimales. 
    'description' => $_POST["CargoIVR"],
    'customer' => $_POST[$customer]
    );

$charge = $openpay->charges->create($chargeData);
?>

When the position is created, a json object will be returned.

Response:

 

{
    "id": "trapsxzfv4rxx8dz3lan",
    "authorization": null,
    "operation_type": "in",
    "transaction_type": "charge",
    "status": "charge_pending",
    "conciliated": false,
    "creation_date": "2020-10-16T23:02:46-05:00",
    "operation_date": "2020-10-16T23:02:46-05:00",
    "description": "Cargo IVR",
    "error_message": null,
    "order_id": "ord-234",
    "payment_method": {
        "type": "ivr",
        "phone_number": "525588969143",
        "ivr_key": 257139,
        "attempts": 0
    },
    "amount": 200.00,
    "currency": "MXN",
    "customer": {
        "name": "Juan",
        "last_name": "Urbina",
        "email": "juan.test@correo.mx",
        "phone_number": "45155352828",
        "address": null,
        "creation_date": "2020-10-16T23:02:46-05:00",
        "external_id": null,
        "clabe": null
    },
    "method": "card"
}

 

With the data of payment_method, your client can make the payment with a phone call.

Purchase Flow

Below is the flow to make the purchase with IVR code.

  1. The customer calls the IVR number assigned to his business and enters his payment code that was previously provided.
  2. The IVR informs the client of the amount of the charge and requests their confirmation to continue.
  3. The customer accepts or rejects the charge. If the customer accepts the charge, the IVR will request, in separate steps, the debit or credit card details.
  4. The IVR processes the charge using the Openpay API.
  5. The Openpay API returns the response to the IVR.
  6. THE IVR informs the client of the result of the charge.

Authorize IVR Charge with payment key

Flow steps

The steps to authorize an IVR payment key through a service exposed by your application are the following:

  1. The customer calls the IVR number assigned to your business and enters their payment key that was previously provided.
  2. The IVR invokes the service exposed by your server to authorize the payment key.
  3. Your server executes the validation of the payment key. If it is valid, return the detail of the charge as the amount, order number and description. Otherwise, it returns the corresponding error code.
  4. The IVR informs the client of the amount of the charge and requests their confirmation to continue.
  5. The customer accepts or rejects the charge. If the customer accepts the charge, the IVR will request, in separate steps, the debit or credit card details.
  6. The IVR processes the charge using the Openpay API.
  7. The Openpay API returns the response to the IVR.
  8. THE IVR informs the client of the result of the charge.

For this Openpay requires that you implement a web service in your application to authorize IVR payments.

Service to authorize IVR payments

The following describes the detail of the request and response that the service exposed by your application must follow to authorize keys IVR payment (Steps 2 and 3).

 Request sent by Openpay IVR

The Openpay IVR will call this service using an HTTP POST method, using HTTP Basic authentication to identify itself. The content of the request will be of type application / json, encoded in UTF-8.

HTTP request example:

 

POST /openpay/authorizer HTTP/1.1
Host: example.com
Authorization: Basic dXNyOnB3ZA==
Content-Type: application/json
Cache-Control: no-cache
{
    "ivr_key": 123456
}

 

Service response

The service should return an HTTP 200 OK response, with a body of type application / json.

Successful response example:

 

{
  "response_code": 0,
  "amount": 200.00,
  "description": "Cargo IVR",
  "order_id": "ord-234"
}

 

Example of failed response:

 

{
  "response_code": 1,
  "description": "Clave de pago inválida"
}

 

In case of an error in your application, a 4XX or 5XX HTTP response must be returned, as the case may be.

Considerations

Communication time between Openpay and the Service

Openpay will wait 5 seconds for a response from your server and once that time has passed Openpay will cancel the operation.

HTTPS communication

Although in the Sandbox environment the service is allowed to be HTTP, do not forget that in the production environment the service is required to be available via HTTPS