{"id":3437,"date":"2021-03-09T18:53:14","date_gmt":"2021-03-09T18:53:14","guid":{"rendered":"https:\/\/documents.openpay.mx\/?p=3437"},"modified":"2024-01-29T15:01:24","modified_gmt":"2024-01-29T15:01:24","slug":"charge-store","status":"publish","type":"post","link":"https:\/\/documents-mx-dev.opdevhm.com\/en\/docs\/charge-store.html","title":{"rendered":"Payment via a store"},"content":{"rendered":"

This tutorial will guide you step by step to generate store payment references, in order to receive payments through convenience stores.<\/p>\n

Note:<\/strong> You can get notifications<\/strong> minutes after your customer makes the payment.<\/em><\/p>\n

Process to make store charges<\/h3>\n

\"Process<\/center>Steps:<\/p>\n
    \n
  1. Customer completes the buying by selecting store charge as payment method<\/li>\n
  2. Send a bank charge request to Openpay<\/li>\n
  3. Create a payment order for your customer with the returned information<\/li>\n
  4. Customer goes to store and pays for the order<\/li>\n
  5. Openpay receives and validates the payment<\/li>\n
  6. Openpay notifies the payment to your server<\/li>\n<\/ol>\n

    This tutorial you can see steps 2 and 3, for step 6 details please check notifications section<\/a><\/p>\n

    Create a charge (Step 2)<\/h2>\n

    To receive a payment in a store you need to generate a barcode with the reference with which your customer can pay at the store.<\/p>\n

    To do this you must make a request to our API as follows:<\/p>\n

    \n
    \r\n    $openpay = Openpay::getInstance('mzdtln0bmtms6o3kck8f',\r\n      'sk_e568c42a6c384b7ab02cd47d2e407cab');\r\n    $chargeData = array(\r\n        'method' => 'store',\r\n        'amount' => 100.00,\r\n        'description' => 'Cargo a tienda');\r\n    $charge = $openpay->charges->create($chargeData);<\/code><\/pre>\n<\/figure>\n

    Note:<\/strong> The maximum amount allowed for such charges is $ 9,999.99 MXN<\/em><\/p>\n

    If the request is successful you will receive an answer with the reference number generated and the barcode URL so you can create your receipt.<\/p>\n

    Response:<\/strong><\/p>\n

    \n
    {\r\n  \"id\" : \"t6utz9dywve6zipnppys\",\r\n  \"description\" : \"Cargo con tienda\",\r\n  \"error_message\" : null<\/strong>,\r\n  \"authorization\" : null<\/strong>,\r\n  \"amount\" : 100,\r\n  \"operation_type\" : \"in\",\r\n  \"payment_method\" : {\r\n    \"type\" : \"store\",\r\n    \"reference\" : \"123456ABCDEFGHIJLKMNOPQRSTVW010000\",\r\n    \"barcode_url\" : \"https:\/\/sandbox-api.openpay.mx\/barcode\/123456ABCDEFGHIJLKMNOPQRSTVW010000?width=1&height=45\"\r\n  },\r\n  \"order_id\" : \"oid-00052\",\r\n  \"transaction_type\" : \"charge\",\r\n  \"creation_date\" : \"2013-12-05T17:50:09-06:00\",\r\n  \"currency\" : \"MXN\",\r\n  \"status\" : \"in_progress\",\r\n  \"method\" : \"store\"\r\n}<\/code><\/pre>\n<\/figure>\n

    Sandbox:<\/strong> You can simulate the payment from the dashboard, so you can get a payment notification on your system via a Webhook<\/a>.<\/em><\/p>\n

    Production<\/strong> The payment notification is done in real time, that is when your customer makes the payment at the store you will receive a Webhook<\/a> and the balance in your account will be increased.<\/em><\/p>\n

    For more information see the charges reference<\/a><\/p>\n

    Create a payment receipt (Step 3)<\/h2>\n

    Basically you can create your receipt with any design and colors, but it should include:<\/p>\n

    \n
    {DASHBOARD_PATH}\/paynet-pdf\/{MERCHANT_ID}\/{REFERENCE}<\/code><\/pre>\n<\/figure>\n

    Sandbox:<\/strong> {DASHBOARD_PATH}<\/code> = https:\/\/sandbox-dashboard.openpay.mx<\/em><\/p>\n

    Production<\/strong> {DASHBOARD_PATH}<\/code> = https:\/\/dashboard.openpay.mx<\/em><\/p>\n

    {MERCHANT_ID}<\/code> = your merchant id<\/p>\n

    {TRANSACTION_ID}<\/code> = field value payment_method.reference<\/code> of the transaction object returned when the charge was created<\/p>\n

    Example:<\/p>\n

    https:\/\/sandbox-dashboard.openpay.mx\/paynet-pdf\/mzdtln0bmtms6o3kck8f\/000020TRT3PGJAWHQHPERTJOQJ0005006<\/a><\/p>\n

    Create Custom Payment Receipt (Optional Step 3.1)<\/h2>\n

    If you decide not to use the receipt offered by Openpay you can generate it yourself, basically you can create it with any design and colors, but it must include:<\/p>\n