Searches

Openpay allow filter searches of payouts, charges, customers, transfers, cards, bank accounts, plans, suscriptions, fees, webhooks and stores by the API, in the manner shown in the links.

In addition to this there are two special searches that can be performed based on the identifiers generated by the merchant and associated with openpay platform, these are:

  • search of charges by order_id
  • search of customers by external_id

Both are described below.

Search of charges by order_id

Recall that this attribute was provided by the merchant when he created the charge in openpay, and is a unique value from that merchant. For this example we will look for a charge which is identified as my-oid-0001.

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

$findDataRequest = array(
    'order_id' => 'my-oid-0001'
);

$chargeList = $openpay->charges->getList($findDataRequest);
?>

If the request is correct and find this charge, then a response with a object transaction represented according to the language of the library used will be returned.

Response:

 

[
  {
     "id":"tryqihxac3msedn4yxed",
      "amount":100.00,
      "authorization":"801585",
      "method":"card",
      "operation_type":"in",
      "transaction_type":"charge",
      "card":{
         "type":"debit",
         "brand":"visa",
         "address":null,
         "card_number":"411111XXXXXX1111",
         "holder_name":"Juan Perez Ramirez",
         "expiration_year":"20",
         "expiration_month":"12",
         "allows_charges":true,
         "allows_payouts":true,
         "bank_name":"Banamex",
         "bank_code":"002"
      },
      "status":"completed",
      "currency":"MXN",
      "creation_date":"2014-05-26T14:00:17-05:00",
      "operation_date":"2014-05-26T14:00:17-05:00",
      "description":"Cargo inicial a mi cuenta",
      "error_message":null,
      "order_id":my-oid-0001,
      "customer_id":"ag4nktpdzebjiye1tlze"
  }
]

 

Search of customer by external_id

Recall that this attribute was provided by the merchant when he created the customer in openpay, and is a unique value from that merchant. For this example we will look for a customer which is identified as myBestClient001.

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

$findDataRequest = array(
    'external_id' => 'myBestClient001'
);

$customerList = $openpay->customers->getList($findDataRequest);
?>

If the request is correct and find this customer, then a response with a object customer represented according to the language of the library used will be returned.

Response:

 

[
  {
     "id":"anbnldwgni1way3yp2dw",
     "name":"customer name",
     "last_name":customer last name,
     "email":"customer_email@me.com",
     "phone_number":"44209087654",
     "address":{
        "line1":"Calle 10",
        "line2":"col. san pablo",
        "line3":"entre la calle 1 y la 2",
        "state":"Queretaro",
        "city":"Queretaro",
        "postal_code":"76000",
        "country_code":"MX"
     },
     "store": {
         "reference": "OPENPAY02DQ35YOY7",
         "barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
     },
     "clabe": "646180109400423323",
     "creation_date":"2014-05-20T16:47:47-05:00",
     "external_id":"myBestClient001"
  }
]