Cash Collection

📘

The steps in this guide are following to the essential steps mentioned in the payment API flow guide, so please check it before proceeding to this guide.

Pay Request:

Now that you have obtained the payment key, you will be able to create a cash payment.

URL: https://accept.paymob.com/api/acceptance/payments/pay

method: POST

source: Merchant's server

recipient: Accept's server

content-type: JSON

example request data:

{
  "source": {
    "identifier": "cash", 
    "subtype": "CASH" 
  },
  "payment_token": "ZXlKMGVYQWlULjRi2T2..."  // token obtained in step 3
}

example response data:

Scenario 1: Scheduling successful ==> "pending": "true"

Scenario 2: Scheduling failed ==> "pending": "false"

{
    "id": 234,
    "pending": "true",
    "amount_cents": 1000,
    "success": "false",
    "is_auth": "false",
    "is_capture": "false",
    "is_standalone_payment": "true",
    "is_voided": "false",
    "is_refunded": "false",
    "is_3d_secure": "false",
    "integration_id": 1,
    "profile_id": 1,
    "has_parent_transaction": "false",
    "order": 433,
    "created_at": "2018-03-01T11:09:36.531434",
    "currency": "EGP",
    "api_source": "OTHER",
    "is_void": "false",
    "is_refund": "false",
    "error_occured": "false",
    "refunded_amount_cents": 0,
    "captured_amount": 0,
    "merchant_staff_tag": "",
    "owner": 1,
    "parent_transaction": "",
    "data.message": "Docket created successfully",
    "source_data.type": "cash",
    "source_data.pan": "",
    "source_data.sub_type": "CASH",
    "hmac": "df022245f4791a1f07f53c5e7b0c0ed0a6ae13afbf8fb5c69a349f843ad5c4ac6092a800dff7d7b50664914898aa99d912cd31901b0a7cc7f543ccbb861976cc",
    "merchant_order_id": "null",
    "use_redirection": "false",
    "redirection_url": "ok",
    "merchant_response": "Not found\n",
    "bypass_step_six": false
}

Delivery Status Endpoint "server-side"

This endpoint will be invoked every time Accept's server needs to notify your server about a DELIVERY_STATUS.

URL: https://your_chosen_delivery_callback_url.com?hmac=value_of_hmac

method: POST

source: Accept's server

recipient: Merchant's server

content-type: JSON

example body:

{
    "type": "DELIVERY_STATUS",
    "obj": {
        "order_id": 5530,
        "order_delivery_status": "Scheduled", 
        "merchant_id": 455,
        "merchant_name": "Test Merchant", 
        "updated_at": "2017-01-24T13:29:40" //iso format datetime
    } 
}
StatusDescription
ScheduledSuccessfully placed a new delivery on the courier’s system.
Contacting MerchantThe courier agent is in touch with your administration through provided contact info to pick up the package to be delivered.
Picking UpCourier agent is headed towards your pick up address to receive the package.
Courier ReceivedThe courier agent picked up the package.
At WarehouseThe package is placed at the courier’s storage, pending client’s scheduling
Agent OutCourier agent is out with your customer added on their list (not necessarily headed towards your client first).
On RouteThe courier agent is currently headed towards your client.
At CustomerThe courier agent arrived at the customer’s address.
DeliveredCourier completed their task successfully.
CanceledCustomer / Merchant canceled courier’s delivery.
Delivery FailedCourier agent was not able to fulfill their task. For example, the customer was not at home, the customer refused to pay or did not have enough money, package was malformed.
Return ScheduledCourier is set to return the package back to you for exchange or a canceled delivery.
Package ReturnedCourier returned the package to you successfully.

👍

That's it, you've successfully finalized your Cash payments integration with Accept :tada:.
Now, prepare endpoints to receive payment notifications from Accept's server, to learn more about the transactions webhooks, please check this guide.