CoDi®. payments

The objective of this guide is to explain step by step how to generate payment referrals with CoDi®.

CoDi® is a platform developed by Banco de México to facilitate payment and collection transactions through electronic transfers in a fast, safe and efficient way, through smartphones.

CoDi® uses QR codes, which are free-to-use two-dimensional codes, and push notifications, which are notifications that arrive directly to the recipient's phone, that are easy to implement and read by any smartphone.

For more information see the CoDi® official site.

Dynamic QR charges

Below is the flow to generate charges with dynamic QR codes. Dynamic QR codes allow your customer to record the amount to pay. Your bank account details are fixed and cannot be modified by your client.

 

 

Steps:

  1. The merchant requests the generation of a dynamic QR code to make a payment.
  2. From the Openpay api the QR code is returned.
  3. The store exposes the QR code by the means of its choice (printed, screen at checkout, etc.) so that the buyer can make the payment
  4. The buyer scans the code from his bank's app and records the amount to pay.
  5. The customer confirms the payment from his bank's banking application.
  6. The customer's bank sends the payment notification to Banxico.
  7. Banxico notifies Openpay payment.
  8. Openpay confirms the payment to the merchant.

Generate dynamic QR code for Merchant (Step 1 and 2)

To generate a dynamic QR code it is necessary to create a charge indicating in the method field method the type ​codi and the option codi_options with the attribute mode the value QR_CODE as follows:

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

$chargeData = array(
    'description' => 'Cargo con código QR dinámico',
    'external_id' => 'codi-00051',
    'due_date' => '2020-07-20T13:45:00'
    );

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

At the time the charge is created, a transaction object is returned.

Response:

 

{
    "id": 62,
    "amount": null,
    "due_date": "2020-10-20T17:50:00-05:00",
    "description": "Cargo con código QR dinámico",
    "external_id": "12121212",
    "metadata": "{}",
    "barcode": null,
    "barcode_url": "https://dev-api.openpay.mx/codi/open_codes/62/qr_code",
    "barcode_base64": "iVBORw0KGgoAAAANSUhEUgAAAdEAAAHRCAAAAAAQqNxHAAALk0lEQVR42u3cQY4cOw4EUN//0jP7wbc6gpTS/oOnVdvVlZWpJwNRJOFf/7H+v9YvW0DUImoRtYhaRIlaRC2iFlGLKFGLqEX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oUaJ3RfvnX9ezhuNj1WBVMJRVxet1vbKaJgtao0SJEiVKlCjRr0STa9VdvaqMWE2YBduW6gWHKN2mYVO4ey9RokSJEiVK9IFo3/NL4YLqWZ+Tq2blpnVbdYaHw3TVlwiiRIkSJUqU6FvRinCzY8NsWuXuoEJX9UeHZ3Rz992rRIkSJUqUKNG7olWJqnrqqiQXAFfJcPhBQe2vSrjVvvSdUqJEiRIlSpToZdF0pY8Z1NbSAF11Ioe91erW0ktV02T98xIlSpQoUaJEn4kOw16f5PqcF5TpqnRcFTfTR12XOdOnJEqUKFGiRIl+JZo2TtPu3/nhhhbDK6dbnj5CtS/D2ilRokSJEiVK9I+LDpuLvfydJNwfxXUiTcuhaXbukzBRokSJEiVK9G8THUbktBBXVSnToF1F+PSLQNpGTrN4sJ1EiRIlSpQo0b9ItB/FSlNv/AyziatUOUiaVQt10wb9JOsSJUqUKFGiREf90SDTbZJm+qzVPFtQLQyesm+wVse4KmkSJUqUKFGiRD8QHXbr0vdWqXKzCVUbNEia/djaJncPUjRRokSJEiVK9K6o9S9eRIlaRC2iFlGLKFGLqEXUImoRJWoRtYhaRC2iRC2iFlHr/vovnGhyg64VOfUAAAAASUVORK5CYII="
}

 

With this QR code, your customer can make the payment by scanning it from their bank's mobile app.

Generate dynamic QR code for Customer (Step 1 and 2)

To generate a dynamic QR code it is necessary to create a charge indicating in the method field method the type ​codi and the option codi_options with the attribute mode the value QR_CODE as follows:

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

$chargeData = array(
    'description' => 'Cargo con código QR dinámico',
    'external_id' => 'codi-00051',
    'due_date' => '2020-07-20T13:45:00'
    );

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

At the time the charge is created, a transaction object is returned.

Response:

 

{
    "id": 62,
    "amount": null,
    "due_date": "2020-10-20T17:50:00-05:00",
    "description": "Cargo con código QR dinámico",
    "external_id": "12121212",
    "metadata": "{}",
    "barcode": null,
    "barcode_url": "https://dev-api.openpay.mx/codi/open_codes/62/qr_code",
    "barcode_base64": "iVBORw0KGgoAAAANSUhEUgAAAdEAAAHRCAAAAAAQqNxHAAALk0lEQVR42u3cQY4cOw4EUN//0jP7wbc6gpTS/oOnVdvVlZWpJwNRJOFf/7H+v9YvW0DUImoRtYhaRIlaRC2iFlGLKFGLqEXUImoRJWoRtYha34j++nn9zy+f3/tPlw8+9/zL54v+9jbOd39+4Z8u9dvPPb83eN5KgShRokSJEiX6VjTdu3S3g0c686cXCO7+tzTBlg/P8vCFXoEoUaJEiRIl+kw0SGPpvgdJM31vADfYifCeh6e1OqiVAlGiRIkSJUr0LxINClhpce58Vqo8vQapNn9YVazOFFGiRIkSJUr0XyNaBdT+AudiXwBSvTpsD9/udhIlSpQoUaJE/zbR3rtvWwZcaShMkYK39SNv6yLjX9DxJkqUKFGiRIkWe9x3Sv20+6lKx0SJEiXqJ6J+eiHaT2EFMTLIppv62LqIF2TJ4K6GveS0/ZqgECVKlChRokTvigZ5q6+eBd59QbFKgUGsH9YmN7+SnpD02YgSJUqUKFGil0X7rFu1CoN3DJuV/XFKj3EgcM6rw38M6eWJEiVKlChRom9Fh1Puw80PBqvS0xDsxLfBeHOqqzokUaJEiRIlSvSZaN/Vq2bC+07k+Y/V3VcfHuhVNE/umShRokSJEiX6gWjV3+tjaT9nFdzaudTW72JwiDYpOrjdipUoUaJEiRIlelk0uGrVcAzuvIp4/VBWdeLSi1at0c3R6U4IUaJEiRIlSvSuaGobjJz36TjNfkGBcqMX5OmgJhq0kdOPfNMfJUqUKFGiRIlmWTct06VIVfRNE19qm3YxU7Oq77muYVYXJUqUKFGiRIleFq2KWucMVgW2YEYrnfSqQnB6aqq8nzaKq4Ji8ipRokSJEiVK9K7opnZVtTf7euAwZAad1+ER66/yroNMlChRokSJEn0mWhWrhjWutEbYq1Rd234N03E63pb+MlGiRIkSJUr0U9F1ba1Phl0z8ErFrwrVfdVuePDT7wBEiRIlSpQo0beifW9wWHlLX61ao0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MfTrUFmASJUqUKFGiRF+I9lNiaTirQmbQdUz3OE3Mm8cf1giryuq+CkiUKFGiRIkSHWXdH97380YPK35BTg5GsYIzsBYNHrV/jmE5lChRokSJEiX6h0TTjUm5+lZm+uhBvhxG2iqu9xdI//kQJUqUKFGiRL8SDfazalYGpaxqAOtOYW9Yuku7omlAvRmqiRIlSpQoUaJ3RfvnX9ezhuNj1WBVMJRVxet1vbKaJgtao0SJEiVKlCjRr0STa9VdvaqMWE2YBduW6gWHKN2mYVO4ey9RokSJEiVK9IFo3/NL4YLqWZ+Tq2blpnVbdYaHw3TVlwiiRIkSJUqU6FvRinCzY8NsWuXuoEJX9UeHZ3Rz992rRIkSJUqUKNG7olWJqnrqqiQXAFfJcPhBQe2vSrjVvvSdUqJEiRIlSpToZdF0pY8Z1NbSAF11Ioe91erW0ktV02T98xIlSpQoUaJEn4kOw16f5PqcF5TpqnRcFTfTR12XOdOnJEqUKFGiRIl+JZo2TtPu3/nhhhbDK6dbnj5CtS/D2ilRokSJEiVK9I+LDpuLvfydJNwfxXUiTcuhaXbukzBRokSJEiVK9G8THUbktBBXVSnToF1F+PSLQNpGTrN4sJ1EiRIlSpQo0b9ItB/FSlNv/AyziatUOUiaVQt10wb9JOsSJUqUKFGiREf90SDTbZJm+qzVPFtQLQyesm+wVse4KmkSJUqUKFGiRD8QHXbr0vdWqXKzCVUbNEia/djaJncPUjRRokSJEiVK9K6o9S9eRIlaRC2iFlGLKFGLqEXUImoRJWoRtYhaRC2iRC2iFlHr/vovnGhyg64VOfUAAAAASUVORK5CYII="
}

 

With this QR code, your customer can make the payment by scanning it from their bank's mobile app.

Charges with static QR

To generate a dynamic QR code it is necessary to create a charge indicating in the method field the type codi and the option codi_options with the attribute mode the value QR_CODE as follows:

 

 

Steps:

  1. The store requests the generation of a static QR code to make a payment.
  2. From the Openpay api the QR code is returned.
  3. The store exposes the QR code by the means of its choice (printed, screen at checkout, etc.) so that the buyer can make the payment
  4. The buyer scans the code from their bank's app.
  5. The customer confirms the payment from his bank's banking application.
  6. The customer's bank sends the payment notification to Banxico.
  7. Banxico notifies Openpay payment.
  8. Openpay confirms the payment to the merchant.

Generate static QR code (Step 1 and 2)

To generate a dynamic QR code it is necessary to create a charge indicating in the field method the typecodi and the option codi_options with the attribute mode the value QR_CODE as follows:

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

$chargeData = array(
    'method' => 'codi',
    'amount' => 200.00,
    'description' => 'Cargo con código QR estático',
    'order_id' => 'codi-00051',
    'due_date' => '2020-12-20T13:45:00',
    'codi_options' => {
          'mode': 'qr_code'
      },
    'customer' => {
      'name': 'Ricardo',
      'last_name': 'Martinez',
      'email': 'this.is.a@customer.test',
      'phone_number': '4421217210'
    }
    );

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

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

Response:

 

{
    "id": "tr47lahm4etz1rqz1nbs",
    "authorization": null,
    "operation_type": "in",
    "transaction_type": "charge",
    "status": "charge_pending",
    "conciliated": false,
    "creation_date": "2020-07-15T16:58:16-05:00",
    "operation_date": "2020-07-15T16:58:16-05:00",
    "description": "Cargo con código QR estático",
    "error_message": null,
    "order_id": "codi-929678",
    "due_date": "2020-07-20T13:45:00-05:00",
    "amount": 200.00,
    "customer": {
        "name": "Ricardo",
        "last_name": "Martinez",
        "email": "this.is.a@customer.test",
        "phone_number": "4421217210",
        "address": null,
        "creation_date": "2020-07-15T16:58:15-05:00",
        "external_id": null,
        "clabe": null
    },
    "payment_method": {
        "type": "codi",
        "barcode_url": "https://dev-api.openpay.mx/codi-qrcode/tr47lahm4etz1rqz1nbs",
        "barcode_base64": "iVBORw0KGgoAAAANSUhEUgAAAdEAAAHRCAAAAAAQqNxHAAALsklEQVR42u3c0XLjOBJE0fn/n9593xjLNwFSPbNx8OS2LYrEgSNSVRX913+s/6/1ly0gahG1iFpELaJELaIWUYuoRZSoRdQiahG1iBK1iFpEre+I/vX7+p9f/rvX/t2v/M9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qRtSlcj8Thjuc/EKJEiRIlSpToC6JTvS3ky1rTuxnyqnXImwS+Nz+DfDhT9fMDUaJEiRIlSvRh0akaV4Pd1HV8Zg6sVugeHEILZtMpnLI4UaJEiRIlSvQN0dqODD3EWgCsjxSeMNQrD/lDcj2Mr7UrWpquRIkSJUqUKNFnReuqt3DYiazxetqx0I4M/DcVyf3Z6tAYUaJEiRIlSvQN0Wmue2ozXhfEpgJguPHPcXNK0YdR9fB5rzreRIkSJUqUKNFnu2l79gsBdc+c0yumJ3pwJm0/JvXPgihRokSJEiX6VdGbDDYlzcMEuXUO51xb+6PPUD/zEYMoUaJEiRIl+idFK1co4v34e1MhLpT4porkg63b2nl9sQpIlChRokSJEv1HiP4y7xQdb0Lh3iSd3jzo7Xs1zakRJUqUKFGiRN8VraWs+u6fY2loGk4ZNrxlQK83WS0Opb7S8SZKlChRokSJ/lqxCt3EPZFO97sfogfLbzeZfS8Uhkz8SzomSpQoUaJEiT4rav2LF1GiFlGLqEXUIkrUImoRtYhaRIlaRC2iFlGLKFGLqEXUen79F/Lsh0S2EJI2AAAAAElFTkSuQmCC",
        "mode": "qr_code"
    },
    "currency": "MXN",
    "method": "codi"
}

 

With this QR code, your customer can make the payment by scanning it from their bank's mobile app.

Payment notification

Below is the flow for the generation of charges for payment notification.

 

 

Steps:

  1. The user requests the merchant to make the payment request.
  2. The merchant requests Openpay to make the payment request to Banxico.
  3. Banxico makes the payment request to the corresponding bank.
  4. The bank to which the user's account belongs makes the payment request to the customer and requests confirmation.
  5. The client authorizes or declines the charge requested by the bank.


In this guide we will see steps number 1 and 2.

Payment Notification Sending (Step 1 and 2)

To make a payment notification notification it is necessary to create a charge indicating in the field method the typecodi and the option codi_options with the following attributes mode the value PUSH_NOTIFICATION, use_customer_phone the value false, phone_number the customer phone number, as follows:

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

$chargeData = array(
    'method' => 'codi',
    'amount' => 200.00,
    'description' => 'Cargo por Notificación de Pago',
    'order_id' => 'codi-00051',
    'codi_options' => ''
    'due_date' => '2020-12-20T13:45:00',
    'codi_options' => {
          'mode': 'push_notification',
      'use_customer_phone': false,
      'phone_number' : '4421217210'
      },
    'customer' => {
      'name': 'Ricardo',
      'last_name': 'Martinez',
      'email': 'this.is.a@customer.test',
      'phone_number': '4421217210'
    }
    );

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

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

Response:

 

{
    "id": "trs1clzwqweqwznutfmt",
    "authorization": null,
    "operation_type": "in",
    "transaction_type": "charge",
    "status": "charge_pending",
    "conciliated": false,
    "creation_date": "2020-07-15T16:58:33-05:00",
    "operation_date": "2020-07-15T16:58:33-05:00",
    "description": "Cargo por Notificación de Pago",
    "error_message": null,
    "order_id": "codi-121795",
    "due_date": "2020-07-20T13:45:00-05:00",
    "amount": 200.00,
    "customer": {
        "name": "Ricardo",
        "last_name": "Martinez",
        "email": "this.is.a@customer.test",
        "phone_number": "4421217210",
        "address": null,
        "creation_date": "2020-07-15T16:58:33-05:00",
        "external_id": null,
        "clabe": null
    },
    "payment_method": {
        "type": "codi",
        "mode": "push_notification",
        "phone_number": "4421217210"
    },
    "currency": "MXN",
    "method": "codi"
}

 

With this payment notification, your customer can make the payment from their bank's mobile app.