Skip to content

Instantly share code, notes, and snippets.

@leofischer
Created February 16, 2018 02:22
Show Gist options
  • Save leofischer/275a3daa2a247acc811e97e75d9bfdf0 to your computer and use it in GitHub Desktop.
Save leofischer/275a3daa2a247acc811e97e75d9bfdf0 to your computer and use it in GitHub Desktop.
SPEI One Time Payment

#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": "spei"
          }
      }]
  }'

#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_2i5d4gdwpZR5Yat6U",
  "metadata": {},
  "created_at": 1518744793,
  "updated_at": 1518744793,
  "line_items": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "name": "Tacos",
      "unit_price": 1000,
      "quantity": 12,
      "object": "line_item",
      "id": "line_item_2i5d4gdwpZR5Yat6S",
      "parent_id": "ord_2i5d4gdwpZR5Yat6U",
      "metadata": {},
      "antifraud_info": {}
    }]
  },
  "charges": {
    "object": "list",
    "has_more": false,
    "total": 1,
    "data": [{
      "id": "5a8634d9ffecf9376e833305",
      "livemode": false,
      "created_at": 1518744793,
      "currency": "MXN",
      "payment_method": {
        "clabe": "646180111812345678",
        "bank": "STP",
        "receiving_account_number": "646180111812345678",
        "receiving_account_bank": "STP",
        "object": "bank_transfer_payment",
        "type": "spei",
        "expires_at": 1526520793
      },
      "object": "charge",
      "description": "Payment from order",
      "status": "pending_payment",
      "amount": 12000,
      "fee": 928,
      "customer_id": "",
      "order_id": "ord_2i5d4gdwpZR5Yat6U"
    }]
  }
}

#Paid Event Notification

{
  "action": "charge.paid",
  "data": {
    "object": {
      "id": "5a8634d9ffecf9376e833305",
      "livemode": false,
      "created_at": 1518744793,
      "currency": "MXN",
      "payment_method": {
        "clabe": "646180111812345678",
        "bank": "STP",
        "receiving_account_number": "646180111812345678",
        "receiving_account_bank": "STP",
        "object": "bank_transfer_payment",
        "type": "spei",
        "expires_at": 1526520793
      },
      "object": "charge",
      "description": "Payment from order",
      "status": "paid",
      "amount": 12000,
      "paid_at": 1518744834,
      "fee": 928,
      "customer_id": "",
      "order_id": "ord_2i5d4gdwpZR5Yat6U"
    }
  },
  "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