Create a Reseller's Payment for topping up the Account balance

The Create Payment method is used for creating a Payment for topping up the balance of an Account of the current Reseller or any of its downstream Resellers.

Access to the current Reseller and downstream Resellers is determined by the Manager's token in the API request.

POST {base_url}/api/v3/resellers/{reseller_id}/payments/
{
    "data":
    {
        "attributes":
        {
            "account_id": {account_id},
            "total": {amount_of_payment},
            "comment": "{comment}",
            "purpose": "{payment_purpose}"
        }
    }
      
}

Arguments

Name

Parameter Type

Data type

Required/ Optional

Description

X-Api-TokenheaderstringRequiredAPI token of the Manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredIndicates the media type (text/html or text/JSON) of the request that is sent to the server by the client (browser)
AcceptheaderstringRequiredInformation about data types that the client (browser) supports
reseller_idpathnumberRequiredID of the current Reseller or any of its downstream Resellers (see Viewing and updating reseller general information)
account_idformnumberRequiredID of the Account to top up the balance
totalformnumberRequiredTotal amount of the Payment
commentformstringRequiredComment on the Payment
purposeformstringOptionalThe purpose of the top-up Payment displayed in the receipt (see Creating a payment manually)

Response model

If a Payment is successfully created, the method returns information about the Payment (see Get the Reseller's Payment information by ID without included additional information) with the 201 Created status.

Request example

POST /api/v3/resellers/1/payments
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
    "data":
    {
        "attributes":
        {
            "account_id": 505,
            "total": 199.99,
            "comment": "top-up payment",
            "purpose": "prepay payment"
        }
    }
      
}

Response example

If a Payment is successfully created, the method returns information about the Payment.

{
    "data": {
        "id": "6477",
        "type": "payments",
        "attributes": {
            "created_at": "2019-11-01T06:49:55.347536+0300",
            "updated_at": "2019-11-01T06:49:55.347536+0300",
            "account_id": 505,
            "discount_amount": "0.0",
            "total": "199.99",
            "comment": "top-up payment",
            "status": "waiting_for_payment",
            "document_id": "2005260",
            "expiration_date": null,
            "payment_method_id": null,
            "requester_ip": null,
            "manager_id": null,
            "purpose": "prepay payment",
            "payment_method_name": null,
            "closed_at": null
        },
        "relationships": {
            "orders": {
                "data": []
            },
            "invoices": {
                "data": []
            },
            "reseller": {
                "data": {
                    "id": "1",
                    "type": "resellers"
                }
            },
            "account": {
                "data": {
                    "id": "505",
                    "type": "accounts"
                }
            },
            "payment_method": {
                "data": null
            }
        }
    }
}

In case of error, the method returns the error description. For example, for error 422:

{
    "errors": {
        "title": "Invalid params.",
        "status": "422"
    }
}