Skip to content

Instantly share code, notes, and snippets.

@leofischer
Last active February 16, 2018 02:22
Show Gist options
  • Save leofischer/5b779f42ebd932b70097eaaf7efc8233 to your computer and use it in GitHub Desktop.
Save leofischer/5b779f42ebd932b70097eaaf7efc8233 to your computer and use it in GitHub Desktop.
Oxxo One Time Payments

#Curl

curl --request POST \
  --url https://api.conekta.io/orders \
  --header 'accept: application/vnd.conekta-v2.0.0+json' \
  -u key_eYvWV7gSDkNYXsmr: \
  --header 'content-type: application/json' \
  --data '{
    "line_items": [{
        "name": "Tacos",
        "unit_price": 1000,
        "quantity": 12
    }],
    "currency": "MXN",
    "customer_info": {
        "name": "Fulanito Pérez",
        "email": "[email protected]",
        "phone": "+5218181818181"
      },
      "charges":[{
          "payment_method": {
              "type": "oxxo_cash"
          }
      }]
  }'

#JSON Response

{
  "livemode": false,
  "amount": 12000,
  "currency": "MXN",
  "payment_status": "pending_payment",
  "amount_refunded": 0,
  "customer_info": {
    "email": "[email protected]",
    "phone": "+5218181818181",
    "name": "Fulanito Pérez",
    "object": "customer_info"
  },
  "object": "order",
  "id": "ord_2i5d3e3idDLufA3GS",
  "metadata": {},
  "created_at": 1518744711,
  "updated_at": 1518744711,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "name": "Tacos",
      "unit_price": 1000,
      "quantity": 12,
      "object": "line_item",
      "id": "line_item_2i5d3e3idDLufA3GQ",
      "parent_id": "ord_2i5d3e3idDLufA3GS",
      "metadata": {},
      "antifraud_info": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "5a863487edbb6e6b34a3b0d3",
      "livemode": false,
      "created_at": 1518744711,
      "currency": "MXN",
      "payment_method": {
        "service_name": "OxxoPay",
        "object": "cash_payment",
        "type": "oxxo",
        "expires_at": 1521158400,
        "store_name": "OXXO",
        "reference": "85345678901234"
      },
      "object": "charge",
      "description": "Payment from order",
      "status": "pending_payment",
      "amount": 12000,
      "fee": 487,
      "customer_id": "",
      "order_id": "ord_2i5d3e3idDLufA3GS"
    }]
  }
}

#Paid Event Notification

{
  "action": "charge.paid",
  "data": {
    "object": {
      "id": "5a863487edbb6e6b34a3b0d3",
      "livemode": false,
      "created_at": 1518744711,
      "currency": "MXN",
      "payment_method": {
        "service_name": "OxxoPay",
        "object": "cash_payment",
        "type": "oxxo",
        "expires_at": 1521158400,
        "store_name": "OXXO",
        "reference": "85345678901234"
      },
      "object": "charge",
      "description": "Payment from order",
      "status": "paid",
      "amount": 12000,
      "paid_at": 1518744743,
      "fee": 487,
      "order_id": "ord_2i5d3e3idDLufA3GS"
    }
  },
  "previous_attributes": {
    "status": "pending_payment"
  },
  "livemode": false,
  "webhook_status": "pending",
  "id": "5511d4ce2412294cf6000084",
  "object": "event",
  "type": "charge.created",
  "created_at": 1427231950,
  "webhook_logs": [
    {
      "id": "webhl_nPzGMBeQmMUu7aQ",
      "url": "http://requestb.in/1em0jsx1",
      "failed_attempts": 0,
      "last_http_response_status": -1,
      "object": "webhook_log",
      "last_attempted_at": 0
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment